mirror of
https://github.com/nlohmann/json.git
synced 2026-11-19 09:45:20 +00:00
Future-proof the Draft-3-only 'B' marker gate
@gregmarr pointed out that dtype == 'B' && bjdata_version != draft3 only future-proofs by accident, since bjdata_version_t currently has exactly two values. Compare with < instead, so a later draft that keeps the 'B' marker valid does not need this gate revisited. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+12
-12
No files matched your search
@@ -1691,12 +1691,12 @@ class binary_writer
|
||||
}
|
||||
CharType dtype = it->second;
|
||||
|
||||
// the 'B' (byte) marker is only defined by BJData Draft 3; emitting it
|
||||
// under the default Draft 2 mode would produce a stream that Draft 2
|
||||
// readers reject, so such an object falls back to a plain object
|
||||
// encoding instead (see the "Binary values" section of the BJData
|
||||
// documentation)
|
||||
if (dtype == 'B' && bjdata_version != bjdata_version_t::draft3)
|
||||
// the 'B' (byte) marker is only defined from BJData Draft 3 onward;
|
||||
// emitting it under an earlier draft would produce a stream that an
|
||||
// earlier-draft reader rejects, so such an object falls back to a
|
||||
// plain object encoding instead (see the "Binary values" section of
|
||||
// the BJData documentation)
|
||||
if (dtype == 'B' && bjdata_version < bjdata_version_t::draft3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20262,12 +20262,12 @@ class binary_writer
|
||||
}
|
||||
CharType dtype = it->second;
|
||||
|
||||
// the 'B' (byte) marker is only defined by BJData Draft 3; emitting it
|
||||
// under the default Draft 2 mode would produce a stream that Draft 2
|
||||
// readers reject, so such an object falls back to a plain object
|
||||
// encoding instead (see the "Binary values" section of the BJData
|
||||
// documentation)
|
||||
if (dtype == 'B' && bjdata_version != bjdata_version_t::draft3)
|
||||
// the 'B' (byte) marker is only defined from BJData Draft 3 onward;
|
||||
// emitting it under an earlier draft would produce a stream that an
|
||||
// earlier-draft reader rejects, so such an object falls back to a
|
||||
// plain object encoding instead (see the "Binary values" section of
|
||||
// the BJData documentation)
|
||||
if (dtype == 'B' && bjdata_version < bjdata_version_t::draft3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user