diff --git a/include/nlohmann/detail/input/parser.hpp b/include/nlohmann/detail/input/parser.hpp index ac19bb8c6..f5744196d 100644 --- a/include/nlohmann/detail/input/parser.hpp +++ b/include/nlohmann/detail/input/parser.hpp @@ -167,7 +167,7 @@ class parser template bool sax_parse_internal(SAX* sax) { - // stack to remember the hieararchy of structured values we are parsing + // stack to remember the hierarchy of structured values we are parsing // true = array; false = object std::vector states; // value to avoid a goto (see comment where set to true) @@ -351,7 +351,7 @@ class parser // we reached this line after we successfully parsed a value if (states.empty()) { - // empty stack: we reached the end of the hieararchy: done + // empty stack: we reached the end of the hierarchy: done return true; } else diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index 4c4c4d3dd..801df342c 100644 --- a/include/nlohmann/detail/meta/type_traits.hpp +++ b/include/nlohmann/detail/meta/type_traits.hpp @@ -221,28 +221,28 @@ struct is_compatible_string_type_impl < std::is_constructible::value; }; -template +template struct is_compatible_string_type - : is_compatible_string_type_impl {}; + : is_compatible_string_type_impl {}; -template struct is_constructible_string_type_impl : std::false_type {}; -template +template struct is_constructible_string_type_impl < - BasicJsonType, ConstrutibleStringType, + BasicJsonType, ConstructibleStringType, enable_if_t::value >> + value_type_t, ConstructibleStringType>::value >> { static constexpr auto value = - std::is_constructible::value; }; -template +template struct is_constructible_string_type - : is_constructible_string_type_impl {}; + : is_constructible_string_type_impl {}; template struct is_compatible_array_type_impl : std::false_type {}; diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index 8e8f5ea7f..ca819540b 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -1287,6 +1287,7 @@ class binary_writer oa->write_characters(vec.data(), sizeof(NumberType)); } + public: // The following to_char_type functions are implement the conversion // between uint8_t and CharType. In case CharType is not unsigned, // such a conversion is required to allow values greater than 128. diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index 41f248a29..a709a8ecf 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -449,9 +450,9 @@ class serializer } else { - string_buffer[bytes++] = '\xEF'; - string_buffer[bytes++] = '\xBF'; - string_buffer[bytes++] = '\xBD'; + string_buffer[bytes++] = detail::binary_writer::to_char_type('\xEF'); + string_buffer[bytes++] = detail::binary_writer::to_char_type('\xBF'); + string_buffer[bytes++] = detail::binary_writer::to_char_type('\xBD'); } bytes_after_last_accept = bytes; } diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index fe6ba6fa6..fdd692cb2 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -6750,7 +6750,7 @@ class basic_json map | object | 0xBF False | `false` | 0xF4 True | `true` | 0xF5 - Nill | `null` | 0xF6 + Null | `null` | 0xF6 Half-Precision Float | number_float | 0xF9 Single-Precision Float | number_float | 0xFA Double-Precision Float | number_float | 0xFB diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index e758206cd..d35db62ce 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -612,28 +612,28 @@ struct is_compatible_string_type_impl < std::is_constructible::value; }; -template +template struct is_compatible_string_type - : is_compatible_string_type_impl {}; + : is_compatible_string_type_impl {}; -template struct is_constructible_string_type_impl : std::false_type {}; -template +template struct is_constructible_string_type_impl < - BasicJsonType, ConstrutibleStringType, + BasicJsonType, ConstructibleStringType, enable_if_t::value >> + value_type_t, ConstructibleStringType>::value >> { static constexpr auto value = - std::is_constructible::value; }; -template +template struct is_constructible_string_type - : is_constructible_string_type_impl {}; + : is_constructible_string_type_impl {}; template struct is_compatible_array_type_impl : std::false_type {}; @@ -4979,7 +4979,7 @@ class parser template bool sax_parse_internal(SAX* sax) { - // stack to remember the hieararchy of structured values we are parsing + // stack to remember the hierarchy of structured values we are parsing // true = array; false = object std::vector states; // value to avoid a goto (see comment where set to true) @@ -5163,7 +5163,7 @@ class parser // we reached this line after we successfully parsed a value if (states.empty()) { - // empty stack: we reached the end of the hieararchy: done + // empty stack: we reached the end of the hierarchy: done return true; } else @@ -6526,7 +6526,7 @@ class binary_reader @param[in, out] result A reference to the string variable where the read string is to be stored. @tparam NumberType The type of the length @a len - @pre len > 0 + @pre len >= 1 @return `true` if the string was successfully parsed */ template @@ -9612,6 +9612,7 @@ class binary_writer oa->write_characters(vec.data(), sizeof(NumberType)); } + public: // The following to_char_type functions are implement the conversion // between uint8_t and CharType. In case CharType is not unsigned, // such a conversion is required to allow values greater than 128. @@ -10780,6 +10781,8 @@ char* to_chars(char* first, const char* last, FloatType value) // #include +// #include + // #include // #include @@ -11214,9 +11217,9 @@ class serializer } else { - string_buffer[bytes++] = '\xEF'; - string_buffer[bytes++] = '\xBF'; - string_buffer[bytes++] = '\xBD'; + string_buffer[bytes++] = detail::binary_writer::to_char_type('\xEF'); + string_buffer[bytes++] = detail::binary_writer::to_char_type('\xBF'); + string_buffer[bytes++] = detail::binary_writer::to_char_type('\xBD'); } bytes_after_last_accept = bytes; } @@ -19011,7 +19014,7 @@ class basic_json map | object | 0xBF False | `false` | 0xF4 True | `true` | 0xF5 - Nill | `null` | 0xF6 + Null | `null` | 0xF6 Half-Precision Float | number_float | 0xF9 Single-Precision Float | number_float | 0xFA Double-Precision Float | number_float | 0xFB