From 13b7fd021e0b061789b8a3d72f0d719d58f6af4e Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Wed, 9 Oct 2024 16:24:30 -0400 Subject: [PATCH] Upgrade JSON BinPack to correctly encode unicode strings (#177) Signed-off-by: Juan Cruz Viotti --- DEPENDENCIES | 2 +- vendor/jsonbinpack/src/runtime/encoder_string.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index a4760711..15e8bb39 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -3,4 +3,4 @@ noa https://github.com/sourcemeta/noa 517e88aef5981b88ac6bb8caff15d17dffcb4320 jsontoolkit https://github.com/sourcemeta/jsontoolkit 9abbaee71e9e00e95632858d29c7ebe5c2a723b0 hydra https://github.com/sourcemeta/hydra 3c53d3fdef79e9ba603d48470a508cc45472a0dc alterschema https://github.com/sourcemeta/alterschema 358df64771979da64e043a416cf340d83a5382ca -jsonbinpack https://github.com/sourcemeta/jsonbinpack 3046d0b9820b7da7f10645ca5fae6b0ffb749422 +jsonbinpack https://github.com/sourcemeta/jsonbinpack b25d54363f5a88cd23c1af41e4c6025b9c94d0d6 diff --git a/vendor/jsonbinpack/src/runtime/encoder_string.cc b/vendor/jsonbinpack/src/runtime/encoder_string.cc index 4ff6e798..316749ef 100644 --- a/vendor/jsonbinpack/src/runtime/encoder_string.cc +++ b/vendor/jsonbinpack/src/runtime/encoder_string.cc @@ -20,7 +20,7 @@ auto Encoder::FLOOR_VARINT_PREFIX_UTF8_STRING_SHARED( assert(document.is_string()); const sourcemeta::jsontoolkit::JSON::String value{document.to_string()}; const auto size{value.size()}; - assert(document.size() == size); + assert(document.byte_size() == size); const auto shared{this->cache_.find(value, Cache::Type::Standalone)}; // (1) Write 0x00 if shared, else do nothing @@ -46,7 +46,7 @@ auto Encoder::ROOF_VARINT_PREFIX_UTF8_STRING_SHARED( assert(document.is_string()); const sourcemeta::jsontoolkit::JSON::String value{document.to_string()}; const auto size{value.size()}; - assert(document.size() == size); + assert(document.byte_size() == size); assert(size <= options.maximum); const auto shared{this->cache_.find(value, Cache::Type::Standalone)}; @@ -73,7 +73,7 @@ auto Encoder::BOUNDED_8BIT_PREFIX_UTF8_STRING_SHARED( assert(document.is_string()); const sourcemeta::jsontoolkit::JSON::String value{document.to_string()}; const auto size{value.size()}; - assert(document.size() == size); + assert(document.byte_size() == size); assert(options.minimum <= options.maximum); assert(is_byte(options.maximum - options.minimum + 1)); assert(is_within(size, options.minimum, options.maximum)); @@ -137,7 +137,7 @@ auto Encoder::PREFIX_VARINT_LENGTH_STRING_SHARED( Cache::Type::PrefixLengthVarintPlusOne); } else { const auto size{value.size()}; - assert(document.size() == size); + assert(document.byte_size() == size); this->cache_.record(value, this->position(), Cache::Type::PrefixLengthVarintPlusOne); this->put_varint(size + 1);