mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 13:10:33 +00:00
Fix CI: clang-tidy and JSON_NOEXCEPTION in the #3989 changes
ci_clang_tidy flagged nested conditional operators in the BON8 skip code and in remove_incomplete_utf8_sequence() (readability-avoid-nested-conditional-operator), and two branches with the same body in recover_string() (bugprone-branch-clone). Use if chains instead of the nested conditionals and merge the two branches into one condition; the short-circuit order is unchanged. ci_test_noexceptions aborted in the #3989 regression test: it compares the first recovered error with the message of the exception that from_cbor() and friends throw, and under JSON_NOEXCEPTION that call aborts instead of throwing. Guard binary_error_message() and its uses with #if !defined(JSON_NOEXCEPTION), as other tests in the suite do. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -4537,7 +4537,11 @@ class binary_reader
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return skip_bon8_bytes((byte <= 0xDF) ? 0 : ((byte <= 0xEF) ? 1 : 2));
|
||||
if (byte <= 0xDF)
|
||||
{
|
||||
return skip_bon8_bytes(0);
|
||||
}
|
||||
return skip_bon8_bytes((byte <= 0xEF) ? 1 : 2);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user