From 8b14c9b305bfc2aac685825db2e543f98526b3a2 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 21 Jul 2020 23:00:56 +0200 Subject: [PATCH] :rotating_light: fix warnings --- include/nlohmann/detail/input/binary_reader.hpp | 2 +- include/nlohmann/json.hpp | 2 +- single_include/nlohmann/json.hpp | 4 ++-- test/src/unit-cbor.cpp | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index 0b649d0289..72e652a4b5 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -2279,7 +2279,7 @@ class binary_reader success = false; break; } - result.push_back(std::char_traits::to_char_type(current)); + result.push_back(static_cast(current)); }; return success; } diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 986cf71f37..c7ccb750c9 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -7507,7 +7507,7 @@ class basic_json const bool allow_exceptions = true, const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) { - return from_cbor(ptr, ptr + len, strict, tag_handler); + return from_cbor(ptr, ptr + len, strict, allow_exceptions, tag_handler); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 9476994af5..dd09e18ba7 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -8264,7 +8264,7 @@ class binary_reader success = false; break; } - result.push_back(std::char_traits::to_char_type(current)); + result.push_back(static_cast(current)); }; return success; } @@ -23786,7 +23786,7 @@ class basic_json const bool allow_exceptions = true, const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) { - return from_cbor(ptr, ptr + len, strict, tag_handler); + return from_cbor(ptr, ptr + len, strict, allow_exceptions, tag_handler); } diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp index 2aeac10d46..ee32983ad0 100644 --- a/test/src/unit-cbor.cpp +++ b/test/src/unit-cbor.cpp @@ -2558,10 +2558,10 @@ TEST_CASE("Tagged values") SECTION("0xC6..0xD4") { - for (std::uint8_t b : - { - 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4 - }) + for (auto b : std::vector + { + 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4 + }) { // add tag to value auto v_tagged = v;