mirror of
https://github.com/nlohmann/json.git
synced 2026-09-30 22:15:19 +00:00
Address the cpplint findings of the view's parser
The exponent of the overflow check is an std::int64_t instead of a long (runtime/int). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include <algorithm> // max
|
||||
#include <array> // array
|
||||
#include <cstddef> // size_t, ptrdiff_t
|
||||
#include <cstdint> // uint8_t, uint16_t, uint32_t, uint64_t
|
||||
#include <cstdint> // int64_t, uint8_t, uint16_t, uint32_t, uint64_t
|
||||
#include <cstring> // memcmp, memcpy
|
||||
#include <limits> // numeric_limits
|
||||
#include <string> // string
|
||||
@@ -890,7 +890,7 @@ indent_done:
|
||||
frac_digits = static_cast<std::size_t>(p - f0);
|
||||
is_float = true;
|
||||
}
|
||||
long exponent = 0;
|
||||
std::int64_t exponent = 0;
|
||||
if (p != e && (*p | 0x20) == 'e')
|
||||
{
|
||||
++p;
|
||||
@@ -944,7 +944,7 @@ indent_done:
|
||||
}
|
||||
// parse() rejects floats that overflow; only numbers whose magnitude
|
||||
// could reach 1e308 need the conversion
|
||||
if (NLOHMANN_VIEW_UNLIKELY(static_cast<long>(int_digits) + exponent > 300 && kind == value_t::number_float))
|
||||
if (NLOHMANN_VIEW_UNLIKELY(static_cast<std::int64_t>(int_digits) + exponent > 300 && kind == value_t::number_float))
|
||||
{
|
||||
if (builder::float_overflows(s, p))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user