mirror of
https://github.com/nlohmann/json.git
synced 2024-11-24 06:29:03 +08:00
add break to binary_reader::get_binary and get_string
This commit is contained in:
parent
43ab8a2357
commit
a3a9d5665e
@ -2271,15 +2271,15 @@ class binary_reader
|
||||
string_t& result)
|
||||
{
|
||||
bool success = true;
|
||||
std::generate_n(std::back_inserter(result), len, [this, &success, &format]()
|
||||
{
|
||||
for(NumberType i = 0; i < len; i++) {
|
||||
get();
|
||||
if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(format, "string")))
|
||||
{
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
return std::char_traits<char_type>::to_char_type(current);
|
||||
});
|
||||
};
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -2303,15 +2303,15 @@ class binary_reader
|
||||
binary_t& result)
|
||||
{
|
||||
bool success = true;
|
||||
std::generate_n(std::back_inserter(result), len, [this, &success, &format]()
|
||||
{
|
||||
for(NumberType i = 0; i < len; i++) {
|
||||
get();
|
||||
if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(format, "binary")))
|
||||
{
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
return static_cast<std::uint8_t>(current);
|
||||
});
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user