From 58ac7561341bb9bf1e5c08960abed673b340e50c Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 29 Sep 2026 09:34:11 +0200 Subject: [PATCH] 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 --- include/nlohmann/detail/view/builder.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/nlohmann/detail/view/builder.hpp b/include/nlohmann/detail/view/builder.hpp index ef8dcb160..45f547072 100644 --- a/include/nlohmann/detail/view/builder.hpp +++ b/include/nlohmann/detail/view/builder.hpp @@ -12,7 +12,7 @@ #include // max #include // array #include // size_t, ptrdiff_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 @@ -890,7 +890,7 @@ indent_done: frac_digits = static_cast(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(int_digits) + exponent > 300 && kind == value_t::number_float)) + if (NLOHMANN_VIEW_UNLIKELY(static_cast(int_digits) + exponent > 300 && kind == value_t::number_float)) { if (builder::float_overflows(s, p)) {