From 059f21aadae5da6f1bebbdd12e3cc1421b39b46d Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 28 Feb 2017 17:24:03 +0100 Subject: [PATCH] :lipstick: fixed a warning snprintf returns an int, but we later assign it a difference_type which is usually a long. --- src/json.hpp | 2 +- src/json.hpp.re2c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 8d545a939..739f35408 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -6684,7 +6684,7 @@ class basic_json static constexpr auto d = std::numeric_limits::digits10; // the actual conversion - auto written_bytes = snprintf(m_buf.data(), m_buf.size(), "%.*g", d, x); + long written_bytes = snprintf(m_buf.data(), m_buf.size(), "%.*g", d, x); // negative value indicates an error assert(written_bytes > 0); diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index b14fb68dc..a55792c5c 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -6684,7 +6684,7 @@ class basic_json static constexpr auto d = std::numeric_limits::digits10; // the actual conversion - auto written_bytes = snprintf(m_buf.data(), m_buf.size(), "%.*g", d, x); + long written_bytes = snprintf(m_buf.data(), m_buf.size(), "%.*g", d, x); // negative value indicates an error assert(written_bytes > 0);