From 22ca9312dfaedf973a735f4a9912712253dd7b37 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Fri, 14 Nov 2014 18:36:25 +0800 Subject: [PATCH] Fix gcc/clang compilation errors and turn off exhaustive number test --- include/rapidjson/internal/strtod.h | 6 +++--- test/unittest/readertest.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/rapidjson/internal/strtod.h b/include/rapidjson/internal/strtod.h index e8b1e7a..ee34766 100644 --- a/include/rapidjson/internal/strtod.h +++ b/include/rapidjson/internal/strtod.h @@ -147,8 +147,8 @@ inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosit uint64_t significand = 0; size_t i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999 for (; i < length; i++) { - if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || - significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > '5') + if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || + (significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > '5')) break; significand = significand * 10 + (decimals[i] - '0'); } @@ -262,7 +262,7 @@ inline double StrtodFullPrecision(double d, int p, const char* decimals, size_t // Trim right-most digits const int kMaxDecimalDigit = 780; - if (length > kMaxDecimalDigit) { + if ((int)length > kMaxDecimalDigit) { exp += (int(length) - kMaxDecimalDigit); length = kMaxDecimalDigit; } diff --git a/test/unittest/readertest.cpp b/test/unittest/readertest.cpp index edd47f3..6a594ad 100644 --- a/test/unittest/readertest.cpp +++ b/test/unittest/readertest.cpp @@ -257,7 +257,7 @@ static void TestParseDouble() { TEST_DOUBLE(fullPrecision, n1e308, 1E308); } -#if 1 +#if 0 // Very slow static const unsigned count = 10000000; // Random test for double {