mirror of
https://github.com/nlohmann/json.git
synced 2026-09-02 22:47:14 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d479d34677 |
@@ -850,11 +850,16 @@ class serializer
|
|||||||
// for the scan. Without it, text whose characters all have to be
|
// for the scan. Without it, text whose characters all have to be
|
||||||
// escaped - CJK under ensure_ascii, where every byte is >= 0x80 -
|
// escaped - CJK under ensure_ascii, where every byte is >= 0x80 -
|
||||||
// runs the scanner once per character only to be told zero.
|
// runs the scanner once per character only to be told zero.
|
||||||
const std::size_t run = EnsureAscii
|
const std::size_t run = [&]() -> std::size_t
|
||||||
? (is_ascii_copyable(data[i])
|
{
|
||||||
? find_ascii_copyable_run(data + i, s.size() - i)
|
if (EnsureAscii)
|
||||||
: 0)
|
{
|
||||||
: string_bulk_run(data + i, s.size() - i);
|
return is_ascii_copyable(data[i])
|
||||||
|
? find_ascii_copyable_run(data + i, s.size() - i)
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
return string_bulk_run(data + i, s.size() - i);
|
||||||
|
}();
|
||||||
if (run != 0)
|
if (run != 0)
|
||||||
{
|
{
|
||||||
// emit any bytes still pending in string_buffer first to
|
// emit any bytes still pending in string_buffer first to
|
||||||
|
|||||||
@@ -21910,11 +21910,16 @@ class serializer
|
|||||||
// for the scan. Without it, text whose characters all have to be
|
// for the scan. Without it, text whose characters all have to be
|
||||||
// escaped - CJK under ensure_ascii, where every byte is >= 0x80 -
|
// escaped - CJK under ensure_ascii, where every byte is >= 0x80 -
|
||||||
// runs the scanner once per character only to be told zero.
|
// runs the scanner once per character only to be told zero.
|
||||||
const std::size_t run = EnsureAscii
|
const std::size_t run = [&]() -> std::size_t
|
||||||
? (is_ascii_copyable(data[i])
|
{
|
||||||
? find_ascii_copyable_run(data + i, s.size() - i)
|
if (EnsureAscii)
|
||||||
: 0)
|
{
|
||||||
: string_bulk_run(data + i, s.size() - i);
|
return is_ascii_copyable(data[i])
|
||||||
|
? find_ascii_copyable_run(data + i, s.size() - i)
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
return string_bulk_run(data + i, s.size() - i);
|
||||||
|
}();
|
||||||
if (run != 0)
|
if (run != 0)
|
||||||
{
|
{
|
||||||
// emit any bytes still pending in string_buffer first to
|
// emit any bytes still pending in string_buffer first to
|
||||||
|
|||||||
Reference in New Issue
Block a user