♻️ simplify code
This commit is contained in:
3 files changed
+14
-10
No files matched your search
@@ -45,6 +45,7 @@ class serializer
|
||||
using number_integer_t = typename BasicJsonType::number_integer_t;
|
||||
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
||||
using binary_char_t = typename BasicJsonType::binary_t::value_type;
|
||||
using diagnostics_t = detail::diagnostics_t<BasicJsonType>;
|
||||
static constexpr std::uint8_t UTF8_ACCEPT = 0;
|
||||
static constexpr std::uint8_t UTF8_REJECT = 1;
|
||||
|
||||
@@ -500,7 +501,7 @@ class serializer
|
||||
{
|
||||
std::string sn(3, '\0');
|
||||
(std::snprintf)(&sn[0], sn.size(), "%.2X", byte);
|
||||
JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + sn, detail::diagnostics_t<BasicJsonType>()));
|
||||
JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + sn, diagnostics_t()));
|
||||
}
|
||||
|
||||
case error_handler_t::ignore:
|
||||
@@ -594,7 +595,7 @@ class serializer
|
||||
{
|
||||
std::string sn(3, '\0');
|
||||
(std::snprintf)(&sn[0], sn.size(), "%.2X", static_cast<std::uint8_t>(s.back()));
|
||||
JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + sn, detail::diagnostics_t<BasicJsonType>()));
|
||||
JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + sn, diagnostics_t()));
|
||||
}
|
||||
|
||||
case error_handler_t::ignore:
|
||||
|
||||
Reference in new issue
Block a user