Update ::wire:: to be closer to Monero variant (#70)

This commit is contained in:
Lee *!* Clagett
2023-06-07 09:01:46 -04:00
committed by Lee *!* Clagett
parent 3e0555e07d
commit e1bd9541f1
36 changed files with 992 additions and 587 deletions

View File

@@ -37,7 +37,10 @@ namespace lmdb
{
epee::byte_stream initial;
initial.write({reinterpret_cast<const char*>(std::addressof(val1)), sizeof(val1)});
return wire_write::to_bytes(wire::msgpack_slice_writer{std::move(initial), true}, val2);
wire::msgpack_slice_writer dest{std::move(initial), true};
wire_write::bytes(dest, val2);
return epee::byte_slice{dest.take_sink()};
}
/*!
@@ -76,10 +79,12 @@ namespace lmdb
auto msgpack_bytes = lmdb::to_byte_span(value);
msgpack_bytes.remove_prefix(sizeof(out.first));
auto msgpack = wire::msgpack::from_bytes<msgpack_value_type>(epee::byte_slice{{msgpack_bytes}});
if (!msgpack)
return msgpack.error();
out.second = std::move(*msgpack);
msgpack_value_type second{};
const std::error_code error = wire::msgpack::from_bytes(epee::byte_slice{{msgpack_bytes}}, second);
if (error)
return error;
out.second = std::move(second);
return out;
}