summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/dbsettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Dbx_mdb/src/dbsettings.cpp')
-rw-r--r--plugins/Dbx_mdb/src/dbsettings.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/plugins/Dbx_mdb/src/dbsettings.cpp b/plugins/Dbx_mdb/src/dbsettings.cpp
index ed7ec5011c..67bb88de60 100644
--- a/plugins/Dbx_mdb/src/dbsettings.cpp
+++ b/plugins/Dbx_mdb/src/dbsettings.cpp
@@ -567,7 +567,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTEN
DBSettingKey keySearch;
keySearch.dwContactID = contactID;
keySearch.dwOfsModule = GetModuleNameOfs(dbces->szModule);
- memset(keySearch.szSettingName, 0, _countof(keySearch.szSettingName));
+ memset(keySearch.szSettingName, 0, sizeof(keySearch.szSettingName));
mir_cslockfull lck(m_csDbAccess);
txn_ptr_ro trnlck(m_txn);
@@ -575,19 +575,15 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTEN
MDB_val key = { sizeof(keySearch), &keySearch }, data;
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) == MDB_SUCCESS)
+ for (int res = mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE); res == MDB_SUCCESS; res = mdb_cursor_get(cursor, &key, &data, MDB_NEXT))
{
- do
- {
- const DBSettingKey *pKey = (const DBSettingKey*)key.mv_data;
- if (pKey->dwContactID != contactID || pKey->dwOfsModule != keySearch.dwOfsModule)
- return result;
+ const DBSettingKey *pKey = (const DBSettingKey*)key.mv_data;
+ if (pKey->dwContactID != contactID || pKey->dwOfsModule != keySearch.dwOfsModule)
+ return result;
- char szSetting[256];
- strncpy_s(szSetting, pKey->szSettingName, key.mv_size - sizeof(DWORD) * 2);
- result = (dbces->pfnEnumProc)(szSetting, dbces->lParam);
- }
- while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS);
+ char szSetting[256];
+ strncpy_s(szSetting, pKey->szSettingName, key.mv_size - sizeof(DWORD)* 2);
+ result = (dbces->pfnEnumProc)(szSetting, dbces->lParam);
}
return result;