mirror of
https://github.com/nlohmann/json.git
synced 2025-08-07 18:02:57 +03:00
@@ -1 +1 @@
|
|||||||
cppcheck==1.5.0
|
cppcheck==1.5.1
|
||||||
|
@@ -830,9 +830,11 @@ class serializer
|
|||||||
// get number of digits for a float -> text -> float round-trip
|
// get number of digits for a float -> text -> float round-trip
|
||||||
static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
|
static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
|
||||||
|
|
||||||
// the actual conversion
|
// the actual conversion (Note that is_ieee_single_or_double==false
|
||||||
|
// rules out that number_float_t is double or long double. Therefore,
|
||||||
|
// we need to cast the argument x to double to be able to use snprintf.)
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||||
std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), "%.*g", d, x);
|
std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), "%.*g", d, static_cast<double>(x));
|
||||||
|
|
||||||
// negative value indicates an error
|
// negative value indicates an error
|
||||||
JSON_ASSERT(len > 0);
|
JSON_ASSERT(len > 0);
|
||||||
|
@@ -19565,9 +19565,11 @@ class serializer
|
|||||||
// get number of digits for a float -> text -> float round-trip
|
// get number of digits for a float -> text -> float round-trip
|
||||||
static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
|
static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
|
||||||
|
|
||||||
// the actual conversion
|
// the actual conversion (Note that is_ieee_single_or_double==false
|
||||||
|
// rules out that number_float_t is double or long double. Therefore,
|
||||||
|
// we need to cast the argument x to double to be able to use snprintf.)
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||||
std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), "%.*g", d, x);
|
std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), "%.*g", d, static_cast<double>(x));
|
||||||
|
|
||||||
// negative value indicates an error
|
// negative value indicates an error
|
||||||
JSON_ASSERT(len > 0);
|
JSON_ASSERT(len > 0);
|
||||||
|
Reference in New Issue
Block a user