diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-12-15 17:34:59 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-12-15 17:34:59 +0100 |
commit | 5113474a91b8dcac4de0e4566b9babd5da281f29 (patch) | |
tree | e7ad35c70033fb1995f5a2c6e82ee23b77a4bff5 /src/wallet | |
parent | e2300ff65e380bfe1454d0ea42a88abeeb6b8911 (diff) |
wallet: Use CDataStream.data()
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/db.cpp | 8 | ||||
-rw-r--r-- | src/wallet/db.h | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index a809c9ad64..5ff3ea3cc8 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -397,15 +397,15 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) break; } if (pszSkip && - strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), strlen(pszSkip))) == 0) + strncmp(ssKey.data(), pszSkip, std::min(ssKey.size(), strlen(pszSkip))) == 0) continue; - if (strncmp(&ssKey[0], "\x07version", 8) == 0) { + if (strncmp(ssKey.data(), "\x07version", 8) == 0) { // Update version: ssValue.clear(); ssValue << CLIENT_VERSION; } - Dbt datKey(&ssKey[0], ssKey.size()); - Dbt datValue(&ssValue[0], ssValue.size()); + Dbt datKey(ssKey.data(), ssKey.size()); + Dbt datValue(ssValue.data(), ssValue.size()); int ret2 = pdbCopy->put(NULL, &datKey, &datValue, DB_NOOVERWRITE); if (ret2 > 0) fSuccess = false; diff --git a/src/wallet/db.h b/src/wallet/db.h index a0f673ecfc..049a2ca1a8 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -122,7 +122,7 @@ protected: CDataStream ssKey(SER_DISK, CLIENT_VERSION); ssKey.reserve(1000); ssKey << key; - Dbt datKey(&ssKey[0], ssKey.size()); + Dbt datKey(ssKey.data(), ssKey.size()); // Read Dbt datValue; @@ -158,13 +158,13 @@ protected: CDataStream ssKey(SER_DISK, CLIENT_VERSION); ssKey.reserve(1000); ssKey << key; - Dbt datKey(&ssKey[0], ssKey.size()); + Dbt datKey(ssKey.data(), ssKey.size()); // Value CDataStream ssValue(SER_DISK, CLIENT_VERSION); ssValue.reserve(10000); ssValue << value; - Dbt datValue(&ssValue[0], ssValue.size()); + Dbt datValue(ssValue.data(), ssValue.size()); // Write int ret = pdb->put(activeTxn, &datKey, &datValue, (fOverwrite ? 0 : DB_NOOVERWRITE)); @@ -187,7 +187,7 @@ protected: CDataStream ssKey(SER_DISK, CLIENT_VERSION); ssKey.reserve(1000); ssKey << key; - Dbt datKey(&ssKey[0], ssKey.size()); + Dbt datKey(ssKey.data(), ssKey.size()); // Erase int ret = pdb->del(activeTxn, &datKey, 0); @@ -207,7 +207,7 @@ protected: CDataStream ssKey(SER_DISK, CLIENT_VERSION); ssKey.reserve(1000); ssKey << key; - Dbt datKey(&ssKey[0], ssKey.size()); + Dbt datKey(ssKey.data(), ssKey.size()); // Exists int ret = pdb->exists(activeTxn, &datKey, 0); @@ -234,7 +234,7 @@ protected: Dbt datKey; unsigned int fFlags = DB_NEXT; if (setRange) { - datKey.set_data(&ssKey[0]); + datKey.set_data(ssKey.data()); datKey.set_size(ssKey.size()); fFlags = DB_SET_RANGE; } |