Revert "Merge pull request #7136"

This reverts commit 63c7ca07fb, reversing
changes made to 2218e23e84.
This commit is contained in:
luigi1111
2021-04-16 13:52:44 -05:00
parent d544fd0f52
commit e45619e61e
20 changed files with 215 additions and 319 deletions
+7 -10
View File
@@ -48,23 +48,15 @@ namespace serialization
TRY_ENTRY();
byte_stream ss;
ss.reserve(initial_buffer_size);
store_to_binary(ss);
target = epee::byte_slice{std::move(ss)};
return true;
CATCH_ENTRY("portable_storage::store_to_binary", false);
}
bool portable_storage::store_to_binary(byte_stream& ss)
{
TRY_ENTRY();
storage_block_header sbh{};
sbh.m_signature_a = SWAP32LE(PORTABLE_STORAGE_SIGNATUREA);
sbh.m_signature_b = SWAP32LE(PORTABLE_STORAGE_SIGNATUREB);
sbh.m_ver = PORTABLE_STORAGE_FORMAT_VER;
ss.write(epee::as_byte_span(sbh));
pack_entry_to_buff(ss, m_root);
target = epee::byte_slice{std::move(ss)};
return true;
CATCH_ENTRY("portable_storage::store_to_binary", false);
CATCH_ENTRY("portable_storage::store_to_binary", false)
}
bool portable_storage::dump_as_json(std::string& buff, size_t indent, bool insert_newlines)
@@ -84,6 +76,11 @@ namespace serialization
CATCH_ENTRY("portable_storage::load_from_json", false)
}
bool portable_storage::load_from_binary(const std::string& target, const limits_t *limits)
{
return load_from_binary(epee::strspan<uint8_t>(target), limits);
}
bool portable_storage::load_from_binary(const epee::span<const uint8_t> source, const limits_t *limits)
{
m_root.m_entries.clear();