Browse Source

dbwrapper: Use new .data() method of CDataStream

0.14
Wladimir J. van der Laan 8 years ago
parent
commit
adff950fae
  1. 12
      src/dbwrapper.h

12
src/dbwrapper.h

@ -65,13 +65,13 @@ public:
CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
ssKey << key; ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size()); leveldb::Slice slKey(ssKey.data(), ssKey.size());
CDataStream ssValue(SER_DISK, CLIENT_VERSION); CDataStream ssValue(SER_DISK, CLIENT_VERSION);
ssValue.reserve(DBWRAPPER_PREALLOC_VALUE_SIZE); ssValue.reserve(DBWRAPPER_PREALLOC_VALUE_SIZE);
ssValue << value; ssValue << value;
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent)); ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
leveldb::Slice slValue(&ssValue[0], ssValue.size()); leveldb::Slice slValue(ssValue.data(), ssValue.size());
batch.Put(slKey, slValue); batch.Put(slKey, slValue);
} }
@ -82,7 +82,7 @@ public:
CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
ssKey << key; ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size()); leveldb::Slice slKey(ssKey.data(), ssKey.size());
batch.Delete(slKey); batch.Delete(slKey);
} }
@ -112,7 +112,7 @@ public:
CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
ssKey << key; ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size()); leveldb::Slice slKey(ssKey.data(), ssKey.size());
piter->Seek(slKey); piter->Seek(slKey);
} }
@ -205,7 +205,7 @@ public:
CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
ssKey << key; ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size()); leveldb::Slice slKey(ssKey.data(), ssKey.size());
std::string strValue; std::string strValue;
leveldb::Status status = pdb->Get(readoptions, slKey, &strValue); leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);
@ -239,7 +239,7 @@ public:
CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
ssKey << key; ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size()); leveldb::Slice slKey(ssKey.data(), ssKey.size());
std::string strValue; std::string strValue;
leveldb::Status status = pdb->Get(readoptions, slKey, &strValue); leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);

Loading…
Cancel
Save