From 3ed059f6ffe44ae78a9b80c7323584ecb9b2ed5d Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 16 May 2020 12:56:18 +0200 Subject: [PATCH] :rewind: revert faulty changes --- include/nlohmann/detail/output/binary_writer.hpp | 6 ++---- single_include/nlohmann/json.hpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index 39935d10..48364547 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -630,9 +630,7 @@ class binary_writer // step 1.5: if this is an ext type, write the subtype if (use_ext) { - std::uint8_t subtype; - write_number(subtype); - j.m_value.binary->set_subtype(subtype); + write_number(j.m_value.binary->subtype()); } // step 2: write the byte string @@ -1087,7 +1085,7 @@ class binary_writer write_bson_entry_header(name, 0x05); write_number(static_cast(value.size())); - write_number(value.has_subtype() ? value.subtype() : 0x00); + write_number(value.has_subtype() ? value.subtype() : std::uint8_t(0x00)); oa->write_characters(reinterpret_cast(value.data()), value.size()); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 8b01d241..9a650b9d 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -12637,9 +12637,7 @@ class binary_writer // step 1.5: if this is an ext type, write the subtype if (use_ext) { - std::uint8_t subtype; - write_number(subtype); - j.m_value.binary->set_subtype(subtype); + write_number(j.m_value.binary->subtype()); } // step 2: write the byte string @@ -13094,7 +13092,7 @@ class binary_writer write_bson_entry_header(name, 0x05); write_number(static_cast(value.size())); - write_number(value.has_subtype() ? value.subtype() : 0x00); + write_number(value.has_subtype() ? value.subtype() : std::uint8_t(0x00)); oa->write_characters(reinterpret_cast(value.data()), value.size()); }