Merge pull request #2244 from matthewbauer/tag-cbor

Tag binary values in cbor if set
This commit is contained in:
Niels Lohmann 2020-07-17 14:05:48 +02:00 committed by GitHub
commit a10d486e36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -279,6 +279,12 @@ class binary_writer
case value_t::binary:
{
if (j.m_value.binary->has_subtype())
{
write_number(static_cast<std::uint8_t>(0xd8));
write_number(j.m_value.binary->subtype());
}
// step 1: write control byte and the binary array size
const auto N = j.m_value.binary->size();
if (N <= 0x17)