diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-11-23 18:53:44 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-11-23 21:19:22 +0100 |
commit | fa8bdb048e65cae2d26bea3f991717a856e2fb39 (patch) | |
tree | c29e6b49aef28d00725ae4477de2f4b7c5bdf1ca /src/dbwrapper.h | |
parent | faa96f841fe45bc49ebb6e07ac82a129fa9c40bf (diff) |
refactor: Drop CDataStream constructors in favor of one taking a Span of bytes
Diffstat (limited to 'src/dbwrapper.h')
-rw-r--r-- | src/dbwrapper.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dbwrapper.h b/src/dbwrapper.h index 215b033708..356111b675 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -8,9 +8,10 @@ #include <clientversion.h> #include <fs.h> #include <serialize.h> +#include <span.h> #include <streams.h> -#include <util/system.h> #include <util/strencodings.h> +#include <util/system.h> #include <leveldb/db.h> #include <leveldb/write_batch.h> @@ -146,7 +147,7 @@ public: template<typename K> bool GetKey(K& key) { leveldb::Slice slKey = piter->key(); try { - CDataStream ssKey(slKey.data(), slKey.data() + slKey.size(), SER_DISK, CLIENT_VERSION); + CDataStream ssKey(MakeUCharSpan(slKey), SER_DISK, CLIENT_VERSION); ssKey >> key; } catch (const std::exception&) { return false; @@ -157,7 +158,7 @@ public: template<typename V> bool GetValue(V& value) { leveldb::Slice slValue = piter->value(); try { - CDataStream ssValue(slValue.data(), slValue.data() + slValue.size(), SER_DISK, CLIENT_VERSION); + CDataStream ssValue(MakeUCharSpan(slValue), SER_DISK, CLIENT_VERSION); ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent)); ssValue >> value; } catch (const std::exception&) { @@ -243,7 +244,7 @@ public: dbwrapper_private::HandleError(status); } try { - CDataStream ssValue(strValue.data(), strValue.data() + strValue.size(), SER_DISK, CLIENT_VERSION); + CDataStream ssValue(MakeUCharSpan(strValue), SER_DISK, CLIENT_VERSION); ssValue.Xor(obfuscate_key); ssValue >> value; } catch (const std::exception&) { @@ -333,7 +334,6 @@ public: leveldb::Slice slKey2(ssKey2.data(), ssKey2.size()); pdb->CompactRange(&slKey1, &slKey2); } - }; #endif // BITCOIN_DBWRAPPER_H |