diff --git a/include/nlohmann/detail/view/image.hpp b/include/nlohmann/detail/view/image.hpp index e7de241ef..c1776f699 100644 --- a/include/nlohmann/detail/view/image.hpp +++ b/include/nlohmann/detail/view/image.hpp @@ -10,7 +10,7 @@ #include // array #include // size_t -#include // uint8_t, uint16_t, uint32_t, uint64_t +#include // int64_t, uint8_t, uint16_t, uint32_t, uint64_t #include // memcmp, memcpy #include // numeric_limits #include // string @@ -299,7 +299,7 @@ inline bool check_number(const node& n, const unsigned char* text) frac_digits = static_cast(p - f0); is_float = true; } - long exponent = 0; + std::int64_t exponent = 0; if (p != e && (*p | 0x20u) == 'e') { ++p; @@ -332,7 +332,7 @@ inline bool check_number(const node& n, const unsigned char* text) } // parse() rejects floats that overflow; as there, only a number whose // magnitude could reach 1e308 needs the conversion - if (static_cast(int_digits) + exponent > 300) + if (static_cast(int_digits) + exponent > 300) { const auto v = float_value(reinterpret_cast(s), n); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) return v <= (std::numeric_limits::max)() && v >= -(std::numeric_limits::max)(); diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index eadef00b7..5dbc10871 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -3771,7 +3771,7 @@ NLOHMANN_JSON_NAMESPACE_END #include // array #include // size_t -#include // uint8_t, uint16_t, uint32_t, uint64_t +#include // int64_t, uint8_t, uint16_t, uint32_t, uint64_t #include // memcmp, memcpy #include // numeric_limits #include // string @@ -4299,7 +4299,7 @@ inline bool check_number(const node& n, const unsigned char* text) frac_digits = static_cast(p - f0); is_float = true; } - long exponent = 0; + std::int64_t exponent = 0; if (p != e && (*p | 0x20u) == 'e') { ++p; @@ -4332,7 +4332,7 @@ inline bool check_number(const node& n, const unsigned char* text) } // parse() rejects floats that overflow; as there, only a number whose // magnitude could reach 1e308 needs the conversion - if (static_cast(int_digits) + exponent > 300) + if (static_cast(int_digits) + exponent > 300) { const auto v = float_value(reinterpret_cast(s), n); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) return v <= (std::numeric_limits::max)() && v >= -(std::numeric_limits::max)();