mirror of https://github.com/CGAL/cgal
build CORE lib without warnings
This commit is contained in:
parent
11d5e2ec50
commit
c9728abdee
|
|
@ -48,6 +48,8 @@
|
|||
#define CGAL_INLINE_FUNCTION
|
||||
#endif
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <CGAL/CORE/BigFloat.h>
|
||||
#include <CGAL/CORE/Expr.h>
|
||||
|
|
@ -942,7 +944,7 @@ BigFloatRep::toDecimal(unsigned int width, bool Scientific) const {
|
|||
return toDecimal(width, true);
|
||||
}
|
||||
}
|
||||
decOut.noSignificant = decRep.length();
|
||||
decOut.noSignificant = static_cast<int>(decRep.length());
|
||||
if (L10 + 1 < (long)width ) {
|
||||
decRep.insert(L10 + 1, ".");
|
||||
} else { // L10 + 1 == width
|
||||
|
|
@ -957,7 +959,7 @@ BigFloatRep::toDecimal(unsigned int width, bool Scientific) const {
|
|||
decRep = round(decRep, L10, width );
|
||||
// cannot overflow since there are L10 leading zeroes.
|
||||
}
|
||||
decOut.noSignificant = decRep.length() - (-L10);
|
||||
decOut.noSignificant = static_cast<int>(decRep.length() - (-L10));
|
||||
decRep.insert(1, ".");
|
||||
}
|
||||
decOut.isScientific = false;
|
||||
|
|
@ -1085,7 +1087,7 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
|
|||
// Change to:
|
||||
// int status;
|
||||
do {
|
||||
c = i.get();
|
||||
i.get(c);
|
||||
} while (isspace(c)); /* loop if met end-of-file, or
|
||||
char read in is white-space. */
|
||||
// Chen Li, "if (c == EOF)" is unsafe since c is of char type and
|
||||
|
|
@ -1135,7 +1137,7 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
|
|||
|
||||
// chenli: make sure that the p is still in the range
|
||||
if (p - str >= size) {
|
||||
int len = p - str;
|
||||
std::size_t len = p - str;
|
||||
char *t = str;
|
||||
str = new char[len + 1];
|
||||
memcpy(str, t, len);
|
||||
|
|
@ -1327,3 +1329,5 @@ BigFloat root(const BigFloat& x, unsigned long k,
|
|||
CORE_MEMORY_IMPL(BigFloatRep)
|
||||
|
||||
} //namespace CORE
|
||||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
|
|
|||
|
|
@ -102,15 +102,15 @@ void append_char (char * &s, int & sz, int pos, char c) {
|
|||
// skip blanks, tabs, line breaks and comment lines
|
||||
CGAL_INLINE_FUNCTION
|
||||
int skip_comment_line (std::istream & in) {
|
||||
int c;
|
||||
char c;
|
||||
|
||||
do {
|
||||
c = in.get();
|
||||
in.get(c);
|
||||
while ( c == '#' ) {
|
||||
do {
|
||||
c = in.get();
|
||||
in.get(c);
|
||||
} while ( c != '\n' );
|
||||
c = in.get();
|
||||
in.get(c);
|
||||
}
|
||||
} while (c == ' ' || c == '\t' || c == '\n');
|
||||
|
||||
|
|
@ -123,14 +123,15 @@ int skip_comment_line (std::istream & in) {
|
|||
|
||||
// skips '\\' followed by '\n'
|
||||
CGAL_INLINE_FUNCTION
|
||||
int skip_backslash_new_line (std::istream & in) {
|
||||
int c = in.get();
|
||||
char skip_backslash_new_line (std::istream & in) {
|
||||
char c;
|
||||
in.get(c);
|
||||
|
||||
while (c == '\\') {
|
||||
c = in.get();
|
||||
in.get(c);
|
||||
|
||||
if (c == '\n')
|
||||
c = in.get();
|
||||
in.get(c);
|
||||
else
|
||||
core_io_error_handler("CoreIO::operator>>", "\\ must be immediately followed by new line.");
|
||||
}
|
||||
|
|
@ -140,10 +141,11 @@ int skip_backslash_new_line (std::istream & in) {
|
|||
|
||||
CGAL_INLINE_FUNCTION
|
||||
void read_string(std::istream& in, char* &buffer, int sz) {
|
||||
int c, pos=0;
|
||||
char c;
|
||||
int pos=0;
|
||||
skip_comment_line(in);
|
||||
|
||||
while ( (c = in.get()) != EOF ) {
|
||||
while ( in.get(c) ) {
|
||||
if ( c == ' ' || c == '\t' || c == '\n' || c == '#')
|
||||
break;
|
||||
else
|
||||
|
|
@ -159,20 +161,21 @@ void read_base_number(std::istream& in, BigInt& m, long length, long maxBits) {
|
|||
int base;
|
||||
bool is_negate;
|
||||
|
||||
int c, pos = 0;
|
||||
char c;
|
||||
int pos = 0;
|
||||
skip_comment_line(in);
|
||||
|
||||
// read sign
|
||||
c = in.get();
|
||||
in.get(c);
|
||||
if (c == '-') {
|
||||
is_negate = true;
|
||||
c = in.get();
|
||||
in.get(c);
|
||||
} else
|
||||
is_negate = false;
|
||||
|
||||
// read base and compute digits
|
||||
if (c == '0') {
|
||||
c = in.get();
|
||||
in.get(c);
|
||||
if (c == 'b') {
|
||||
base = 2;
|
||||
size = (maxBits == 0 || maxBits > length) ? length : maxBits;
|
||||
|
|
@ -225,7 +228,7 @@ void read_base_number(std::istream& in, BigInt& m, long length, long maxBits) {
|
|||
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
void write_base_number(std::ostream& out, char* buffer, int length, int base, int charsPerLine) {
|
||||
void write_base_number(std::ostream& out, char* buffer, std::size_t length, int base, int charsPerLine) {
|
||||
// write big number in a format that gmp's mpz_set_str() can
|
||||
// automatically recognize with argument base = 0.
|
||||
if (base == 2)
|
||||
|
|
@ -237,7 +240,7 @@ void write_base_number(std::ostream& out, char* buffer, int length, int base, in
|
|||
|
||||
// write big number in charsPerLine.
|
||||
char* start, *end, c;
|
||||
for (int i=0; i<length; i += charsPerLine) {
|
||||
for (std::size_t i=0; i<length; i += charsPerLine) {
|
||||
start = buffer + i;
|
||||
if (i + charsPerLine >= length)
|
||||
out << start;
|
||||
|
|
@ -281,7 +284,7 @@ void writeToFile(const BigInt& z, std::ostream& out, int base, int charsPerLine)
|
|||
// get the absoulte value string
|
||||
char* buffer = new char[mpz_sizeinbase(c.get_mp(), base) + 2];
|
||||
mpz_get_str(buffer, base, c.get_mp());
|
||||
int length = std::strlen(buffer);
|
||||
std::size_t length = std::strlen(buffer);
|
||||
|
||||
// write type name of big number and length
|
||||
//out << "# This is an experimental big number format.\n";
|
||||
|
|
@ -343,7 +346,7 @@ void writeToFile(const BigFloat& bf, std::ostream& out, int base, int charsPerLi
|
|||
// get the absoulte value string
|
||||
char* buffer = new char[mpz_sizeinbase(c.get_mp(), base) + 2];
|
||||
mpz_get_str(buffer, base, c.get_mp());
|
||||
int length = std::strlen(buffer);
|
||||
std::size_t length = std::strlen(buffer);
|
||||
|
||||
|
||||
// write type name, base, length
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
#define CGAL_INLINE_FUNCTION
|
||||
#endif
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <CGAL/CORE/Expr.h>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
|
|
@ -1248,3 +1250,5 @@ template class Realbase_for<BigFloat>;
|
|||
template class ConstPolyRep<BigInt>;
|
||||
template class ConstPolyRep<BigRat>;
|
||||
} //namespace CORE
|
||||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@
|
|||
#define CGAL_INLINE_FUNCTION
|
||||
#endif
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <CGAL/CORE/Real.h>
|
||||
#include <CGAL/tss.h>
|
||||
|
|
@ -268,7 +270,7 @@ std::istream& operator >>(std::istream& i, Real& x) {
|
|||
}
|
||||
// chenli: make sure that the p is still in the range
|
||||
if (p - str >= size) {
|
||||
int len = p - str;
|
||||
std::ptrdiff_t len = p - str;
|
||||
char *t = str;
|
||||
str = new char[len + 1];
|
||||
std::memcpy(str, t, len);
|
||||
|
|
@ -291,3 +293,5 @@ std::istream& operator >>(std::istream& i, Real& x) {
|
|||
|
||||
|
||||
} //namespace CORE
|
||||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue