From a7d229118ef848c1e04ab2e5596b4dd5300005c1 Mon Sep 17 00:00:00 2001 From: Sumit Bhardwaj Date: Mon, 13 Apr 2020 16:47:00 -0700 Subject: [PATCH] Changes to clear warnings from MSVC 16.x --- include/nlohmann/detail/conversions/to_chars.hpp | 4 ++-- single_include/nlohmann/json.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/detail/conversions/to_chars.hpp b/include/nlohmann/detail/conversions/to_chars.hpp index d99703a54..47951d2ea 100644 --- a/include/nlohmann/detail/conversions/to_chars.hpp +++ b/include/nlohmann/detail/conversions/to_chars.hpp @@ -990,7 +990,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent, // digits[000] // len <= max_exp + 2 - std::memset(buf + k, '0', static_cast(n - k)); + std::memset(buf + k, '0', static_cast(n) - static_cast(k)); // Make it look like a floating-point number (#362, #378) buf[n + 0] = '.'; buf[n + 1] = '0'; @@ -1004,7 +1004,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent, assert(k > n); - std::memmove(buf + (n + 1), buf + n, static_cast(k - n)); + std::memmove(buf + (n + 1), buf + n, static_cast(k) - static_cast(n)); buf[n] = '.'; return buf + (k + 1); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index de146ed61..5aaf11ccb 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -13955,7 +13955,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent, // digits[000] // len <= max_exp + 2 - std::memset(buf + k, '0', static_cast(n - k)); + std::memset(buf + k, '0', static_cast(n) - static_cast(k)); // Make it look like a floating-point number (#362, #378) buf[n + 0] = '.'; buf[n + 1] = '0'; @@ -13969,7 +13969,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent, assert(k > n); - std::memmove(buf + (n + 1), buf + n, static_cast(k - n)); + std::memmove(buf + (n + 1), buf + n, static_cast(k) - static_cast(n)); buf[n] = '.'; return buf + (k + 1); }