From 343c9f9baa7bc210bd0984fa56760b8f3092d2d4 Mon Sep 17 00:00:00 2001 From: Alex Astashyn Date: Thu, 8 Dec 2016 22:36:18 -0500 Subject: [PATCH] Addressing compiler warnings --- src/json.hpp | 8 ++++---- src/json.hpp.re2c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 876c35b6b..bd172559e 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -6419,9 +6419,8 @@ class basic_json private: static constexpr size_t s_capacity = 30; - std::array m_buf{}; // +2 for leading '-' - // and trailing '\0' - + std::array m_buf{{}}; // +2 for leading '-' + // and trailing '\0' template void x_write(T x, std::true_type) { @@ -6432,7 +6431,8 @@ class basic_json while(x and i < s_capacity) { - m_buf[i++] = static_cast('0' + std::labs(x % 10)); + const auto digit = std::labs(static_cast(x % 10)); + m_buf[i++] = static_cast('0' + digit); x /= 10; } diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 55574beea..4411c64a9 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -6419,9 +6419,8 @@ class basic_json private: static constexpr size_t s_capacity = 30; - std::array m_buf{}; // +2 for leading '-' - // and trailing '\0' - + std::array m_buf{{}}; // +2 for leading '-' + // and trailing '\0' template void x_write(T x, std::true_type) { @@ -6432,7 +6431,8 @@ class basic_json while(x and i < s_capacity) { - m_buf[i++] = static_cast('0' + std::labs(x % 10)); + const auto digit = std::labs(static_cast(x % 10)); + m_buf[i++] = static_cast('0' + digit); x /= 10; } -- GitLab