diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index fa6eeffc0..73820a02c 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -2435,11 +2435,7 @@ class binary_reader } } - if (JSON_HEDLEY_UNLIKELY((!sax->end_array() || !sax->end_object()))) - { - return false; - } - return true; + return (sax->end_array() && sax->end_object()); } if (size_and_type.first != string_t::npos) diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index f80b9418e..b3ef9d2a7 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -1609,11 +1609,11 @@ class binary_writer }; string_t key = "_ArrayType_"; - if (bjdtype.find(value.at(key)) == bjdtype.end()) + if (bjdtype.find(std::string(value.at(key))) == bjdtype.end()) { return 1; } - CharType dtype = bjdtype[value.at(key)]; + CharType dtype = bjdtype[std::string(value.at(key))]; key = "_ArraySize_"; std::size_t len = (value.at(key).empty() ? 0 : 1); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index e9885148b..a8a86e63c 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -10811,11 +10811,7 @@ class binary_reader } } - if (JSON_HEDLEY_UNLIKELY((!sax->end_array() || !sax->end_object()))) - { - return false; - } - return true; + return (sax->end_array() && sax->end_object()); } if (size_and_type.first != string_t::npos) @@ -15505,11 +15501,11 @@ class binary_writer }; string_t key = "_ArrayType_"; - if (bjdtype.find(value.at(key)) == bjdtype.end()) + if (bjdtype.find(std::string(value.at(key))) == bjdtype.end()) { return 1; } - CharType dtype = bjdtype[value.at(key)]; + CharType dtype = bjdtype[std::string(value.at(key))]; key = "_ArraySize_"; std::size_t len = (value.at(key).empty() ? 0 : 1);