aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src/portable_storage.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-04-16 13:52:44 -0500
committerluigi1111 <luigi1111w@gmail.com>2021-04-16 13:52:44 -0500
commite45619e61e4831eea70a43fe6985f4d57ea02e9e (patch)
tree0d4b5301559941855cbce9525148c3a55137e827 /contrib/epee/src/portable_storage.cpp
parentMerge pull request #7653 (diff)
downloadmonero-e45619e61e4831eea70a43fe6985f4d57ea02e9e.tar.xz
Revert "Merge pull request #7136"
This reverts commit 63c7ca07fba2f063c760f786a986fb3e02fb040e, reversing changes made to 2218e23e84a89e9a1e4c0be5d50f891ab836754f.
Diffstat (limited to 'contrib/epee/src/portable_storage.cpp')
-rw-r--r--contrib/epee/src/portable_storage.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/contrib/epee/src/portable_storage.cpp b/contrib/epee/src/portable_storage.cpp
index b922cc9e3..c3c9ccc02 100644
--- a/contrib/epee/src/portable_storage.cpp
+++ b/contrib/epee/src/portable_storage.cpp
@@ -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();