mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-26 14:00:29 +01:00
refactor: Drop CDataStream constructors in favor of one taking a Span of bytes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user