diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index b6fefae8d..4fdb31609 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -955,7 +955,7 @@ class binary_reader { if (tag_handler == cbor_tag_handler_t::error) { - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } // ignore and store: the tag value is already in the head, so @@ -975,7 +975,7 @@ class binary_reader { case cbor_tag_handler_t::error: { - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } case cbor_tag_handler_t::ignore: @@ -1049,7 +1049,7 @@ class binary_reader default: // anything else (0xFF is handled inside the other types) { - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } } } @@ -1984,7 +1984,7 @@ class binary_reader default: // anything else { - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } } } @@ -2804,7 +2804,7 @@ class binary_reader const char* type_name = bjd_type_name(ndarray_dtype); if (JSON_HEDLEY_UNLIKELY(type_name == nullptr)) { - return invalid_byte("type"); + return unexpected_byte("invalid byte", "type"); } string_t type_key = "_ArrayType_"; @@ -3078,7 +3078,7 @@ class binary_reader default: // anything else break; } - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } /*! @@ -3545,7 +3545,7 @@ class binary_reader } // 0xFE: end of container where a value is expected - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } /*! @@ -4252,16 +4252,6 @@ class binary_reader return last_byte_error(exception_id::unexpected_byte, concat(detail, ": 0x", get_token_string()), context); } - /*! - @brief reports the last read byte as invalid (parse_error.112) - @param[in] context further context information - @return the result of the SAX parser's parse_error() - */ - bool invalid_byte(const char* context) const - { - return unexpected_byte("invalid byte", context); - } - /*! @brief reports that the last read byte is not a UBJSON/BJData length type (parse_error.113) @param[in] position where the length type was expected, e.g. " after '#'" diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index c5c40b730..006571ed3 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -14814,7 +14814,7 @@ class binary_reader { if (tag_handler == cbor_tag_handler_t::error) { - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } // ignore and store: the tag value is already in the head, so @@ -14834,7 +14834,7 @@ class binary_reader { case cbor_tag_handler_t::error: { - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } case cbor_tag_handler_t::ignore: @@ -14908,7 +14908,7 @@ class binary_reader default: // anything else (0xFF is handled inside the other types) { - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } } } @@ -15843,7 +15843,7 @@ class binary_reader default: // anything else { - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } } } @@ -16663,7 +16663,7 @@ class binary_reader const char* type_name = bjd_type_name(ndarray_dtype); if (JSON_HEDLEY_UNLIKELY(type_name == nullptr)) { - return invalid_byte("type"); + return unexpected_byte("invalid byte", "type"); } string_t type_key = "_ArrayType_"; @@ -16937,7 +16937,7 @@ class binary_reader default: // anything else break; } - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } /*! @@ -17404,7 +17404,7 @@ class binary_reader } // 0xFE: end of container where a value is expected - return invalid_byte("value"); + return unexpected_byte("invalid byte", "value"); } /*! @@ -18111,16 +18111,6 @@ class binary_reader return last_byte_error(exception_id::unexpected_byte, concat(detail, ": 0x", get_token_string()), context); } - /*! - @brief reports the last read byte as invalid (parse_error.112) - @param[in] context further context information - @return the result of the SAX parser's parse_error() - */ - bool invalid_byte(const char* context) const - { - return unexpected_byte("invalid byte", context); - } - /*! @brief reports that the last read byte is not a UBJSON/BJData length type (parse_error.113) @param[in] position where the length type was expected, e.g. " after '#'"