From 74bf948611cbf0d764f8975959e4b3fe14fbde29 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sat, 31 Oct 2020 18:27:53 +0300 Subject: [PATCH] mdbx++: fix `slice::encode/decode()`. Change-Id: I56122e47a552e8e343e15bc878c767e34d269069 --- mdbx.h++ | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mdbx.h++ b/mdbx.h++ index c1b29a26..8524c7b7 100644 --- a/mdbx.h++ +++ b/mdbx.h++ @@ -3127,7 +3127,7 @@ inline ::mdbx::string slice::hex_encode(bool uppercase, const ALLOCATOR &allocator) const { ::mdbx::string result(allocator); if (MDBX_LIKELY(length() > 0)) { - result.reserve(to_hex_bytes()); + result.resize(to_hex_bytes()); result.resize(to_hex(const_cast(result.data()), result.capacity()) - result.data(), uppercase); @@ -3140,7 +3140,7 @@ inline ::mdbx::string slice::hex_decode(const ALLOCATOR &allocator) const { ::mdbx::string result(allocator); if (MDBX_LIKELY(length() > 0)) { - result.reserve(from_hex_bytes()); + result.resize(from_hex_bytes()); result.resize( from_hex(static_cast( static_cast(const_cast(result.data()))), @@ -3155,7 +3155,7 @@ inline ::mdbx::string slice::base58_encode(const ALLOCATOR &allocator) const { ::mdbx::string result(allocator); if (MDBX_LIKELY(length() > 0)) { - result.reserve(to_base58_bytes()); + result.resize(to_base58_bytes()); result.resize( to_base58(const_cast(result.data()), result.capacity()) - result.data()); @@ -3168,7 +3168,7 @@ inline ::mdbx::string slice::base58_decode(const ALLOCATOR &allocator) const { ::mdbx::string result(allocator); if (MDBX_LIKELY(length() > 0)) { - result.reserve(from_base58_bytes()); + result.resize(from_base58_bytes()); result.resize( from_base58(static_cast( static_cast(const_cast(result.data()))), @@ -3183,7 +3183,7 @@ inline ::mdbx::string slice::base64_encode(const ALLOCATOR &allocator) const { ::mdbx::string result(allocator); if (MDBX_LIKELY(length() > 0)) { - result.reserve(to_base64_bytes()); + result.resize(to_base64_bytes()); result.resize( to_base64(const_cast(result.data()), result.capacity()) - result.data()); @@ -3196,7 +3196,7 @@ inline ::mdbx::string slice::base64_decode(const ALLOCATOR &allocator) const { ::mdbx::string result(allocator); if (MDBX_LIKELY(length() > 0)) { - result.reserve(from_base64_bytes()); + result.resize(from_base64_bytes()); result.resize( from_base64(static_cast( static_cast(const_cast(result.data()))),