diff --git a/include/rapidjson/reader.h b/include/rapidjson/reader.h index 8628b53f..870ed94a 100644 --- a/include/rapidjson/reader.h +++ b/include/rapidjson/reader.h @@ -886,7 +886,7 @@ private: while (s.Peek() >= '0' && s.Peek() <= '9') { if (i64 >= RAPIDJSON_UINT64_C2(0x0CCCCCCC, 0xCCCCCCCC)) // 2^63 = 9223372036854775808 if (i64 != RAPIDJSON_UINT64_C2(0x0CCCCCCC, 0xCCCCCCCC) || s.Peek() > '8') { - d = i64; + d = static_cast(i64); useDouble = true; break; } @@ -897,7 +897,7 @@ private: while (s.Peek() >= '0' && s.Peek() <= '9') { if (i64 >= RAPIDJSON_UINT64_C2(0x19999999, 0x99999999)) // 2^64 - 1 = 18446744073709551615 if (i64 != RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || s.Peek() > '5') { - d = i64; + d = static_cast(i64); useDouble = true; break; } @@ -968,7 +968,7 @@ private: int exp = 0; if (s.Peek() == 'e' || s.Peek() == 'E') { if (!useDouble) { - d = use64bit ? i64 : i; + d = static_cast(use64bit ? i64 : i); useDouble = true; } s.Take(); diff --git a/test/unittest/readertest.cpp b/test/unittest/readertest.cpp index f2a0be1a..3b84ab79 100644 --- a/test/unittest/readertest.cpp +++ b/test/unittest/readertest.cpp @@ -409,7 +409,7 @@ TEST(Reader, ParseNumber_NormalPrecisionError) { a = h.actual_; uint64_t bias1 = e.ToBias(); uint64_t bias2 = a.ToBias(); - double ulp = bias1 >= bias2 ? bias1 - bias2 : bias2 - bias1; + double ulp = static_cast(bias1 >= bias2 ? bias1 - bias2 : bias2 - bias1); ulpMax = std::max(ulpMax, ulp); ulpSum += ulp; }