summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src/dbcrypt.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-21 18:30:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:13 +0300
commit95ce21d8512af00a4c5f607091a459b789f79b79 (patch)
treea2ac7c7c7887b4c8c80e6a59ad9cc24ce4758e91 /plugins/Db3x_mmap/src/dbcrypt.cpp
parent9ceaf3659acce44d579c2db5b29d4b48dfe893f2 (diff)
mmap: C++'11 iterators
Diffstat (limited to 'plugins/Db3x_mmap/src/dbcrypt.cpp')
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index e04cc9b7be..777baae06e 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -91,13 +91,11 @@ void sttContactEnum(MCONTACT contactID, const char *szModule, CDb3Mmap *db)
SettingUgraderParam param = { db, szModule, contactID, &arSettings };
db->EnumContactSettings(0, sttSettingUgrader, szModule, &param);
- for (int i = 0; i < arSettings.getCount(); i++) {
- VarDescr &p = arSettings[i];
-
+ for (auto &p : arSettings) {
size_t len;
- BYTE *pResult = db->m_crypto->encodeString(p.szValue, &len);
+ BYTE *pResult = db->m_crypto->encodeString(p->szValue, &len);
if (pResult != nullptr) {
- DBCONTACTWRITESETTING dbcws = { szModule, p.szVar };
+ DBCONTACTWRITESETTING dbcws = { szModule, p->szVar };
dbcws.value.type = DBVT_ENCRYPTED;
dbcws.value.pbVal = pResult;
dbcws.value.cpbVal = (WORD)len;
@@ -340,13 +338,12 @@ void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID)
NeedBytes(1);
}
- for (int i = 0; i < arSettings.getCount(); i++) {
- VarDescr &p = arSettings[i];
+ for (auto &p : arSettings) {
if (!m_bEncrypted) {
size_t encodedLen;
- BYTE *pResult = m_crypto->encodeString(p.szValue, &encodedLen);
+ BYTE *pResult = m_crypto->encodeString(p->szValue, &encodedLen);
if (pResult != nullptr) {
- DBCONTACTWRITESETTING dbcws = { szModule, p.szVar };
+ DBCONTACTWRITESETTING dbcws = { szModule, p->szVar };
dbcws.value.type = DBVT_ENCRYPTED;
dbcws.value.pbVal = pResult;
dbcws.value.cpbVal = (WORD)encodedLen;
@@ -357,9 +354,9 @@ void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID)
}
else {
size_t realLen;
- ptrA decoded(m_crypto->decodeString((PBYTE)(char*)p.szValue, p.iLen, &realLen));
+ ptrA decoded(m_crypto->decodeString((PBYTE)(char*)p->szValue, p->iLen, &realLen));
if (decoded != nullptr) {
- DBCONTACTWRITESETTING dbcws = { szModule, p.szVar };
+ DBCONTACTWRITESETTING dbcws = { szModule, p->szVar };
dbcws.value.type = DBVT_UNENCRYPTED;
dbcws.value.pszVal = decoded;
dbcws.value.cchVal = (WORD)realLen;