Use spans of std::byte in serialize

This switches .read() and .write() to take spans of bytes.
This commit is contained in:
MarcoFalke
2022-01-02 11:31:25 +01:00
parent fa65bbf217
commit fa24493d63
26 changed files with 195 additions and 184 deletions

View File

@@ -147,7 +147,7 @@ public:
template<typename K> bool GetKey(K& key) {
leveldb::Slice slKey = piter->key();
try {
CDataStream ssKey(MakeUCharSpan(slKey), SER_DISK, CLIENT_VERSION);
CDataStream ssKey{MakeByteSpan(slKey), SER_DISK, CLIENT_VERSION};
ssKey >> key;
} catch (const std::exception&) {
return false;
@@ -158,7 +158,7 @@ public:
template<typename V> bool GetValue(V& value) {
leveldb::Slice slValue = piter->value();
try {
CDataStream ssValue(MakeUCharSpan(slValue), SER_DISK, CLIENT_VERSION);
CDataStream ssValue{MakeByteSpan(slValue), SER_DISK, CLIENT_VERSION};
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
ssValue >> value;
} catch (const std::exception&) {
@@ -244,7 +244,7 @@ public:
dbwrapper_private::HandleError(status);
}
try {
CDataStream ssValue(MakeUCharSpan(strValue), SER_DISK, CLIENT_VERSION);
CDataStream ssValue{MakeByteSpan(strValue), SER_DISK, CLIENT_VERSION};
ssValue.Xor(obfuscate_key);
ssValue >> value;
} catch (const std::exception&) {