mirror of
https://github.com/nlohmann/json.git
synced 2026-10-10 16:37:14 +00:00
Inline invalid_byte() into its call sites
The wrapper only fixed the message string of unexpected_byte(), which is
the same kind of per-argument helper that was declined for
throw_type_must_be(). Call unexpected_byte("invalid byte", ...) directly.
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+14
-34
No files matched your search
@@ -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 '#'"
|
||||
|
||||
@@ -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 '#'"
|
||||
|
||||
Reference in new issue
Block a user