From 7c55510f76b8943941764e9fc7a3320eab0397a5 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 20 Mar 2019 11:06:39 +0100 Subject: [PATCH] :rotating_light: fixed some warnings #1527 --- include/nlohmann/detail/input/binary_reader.hpp | 4 ++-- include/nlohmann/detail/input/lexer.hpp | 2 +- single_include/nlohmann/json.hpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index edff24587d..42976d70f6 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -268,7 +268,7 @@ class binary_reader default: // anything else not supported (yet) { - std::array cr{}; + std::array cr{{}}; (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast(element_type)); return sax->parse_error(element_type_parse_position, std::string(cr.data()), parse_error::create(114, element_type_parse_position, "Unsupported BSON record type 0x" + std::string(cr.data()))); } @@ -1924,7 +1924,7 @@ class binary_reader */ std::string get_token_string() const { - std::array cr{}; + std::array cr{{}}; (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast(current)); return std::string{cr.data()}; } diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index baee769ebe..c135420f22 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -1357,7 +1357,7 @@ class lexer if ('\x00' <= c and c <= '\x1F') { // escape control characters - std::array cs{}; + std::array cs{{}}; (std::snprintf)(cs.data(), cs.size(), "", static_cast(c)); result += cs.data(); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 59f02775c6..6b0702c43b 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3776,7 +3776,7 @@ class binary_reader default: // anything else not supported (yet) { - std::array cr{}; + std::array cr{{}}; (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast(element_type)); return sax->parse_error(element_type_parse_position, std::string(cr.data()), parse_error::create(114, element_type_parse_position, "Unsupported BSON record type 0x" + std::string(cr.data()))); } @@ -5432,7 +5432,7 @@ class binary_reader */ std::string get_token_string() const { - std::array cr{}; + std::array cr{{}}; (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast(current)); return std::string{cr.data()}; } @@ -6858,7 +6858,7 @@ class lexer if ('\x00' <= c and c <= '\x1F') { // escape control characters - std::array cs{}; + std::array cs{{}}; (std::snprintf)(cs.data(), cs.size(), "", static_cast(c)); result += cs.data(); }