summaryrefslogtreecommitdiff
path: root/plugins/Dbx_kv
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-03-18 16:26:47 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-03-18 16:26:47 +0000
commitcd4a3aab6a6406bcaca07734848e57477db4485d (patch)
tree74eb28b16b70adae81a7243a7ddd208c539f7fc3 /plugins/Dbx_kv
parent53a085f57ea760c94346e47af743970a37ed3d0f (diff)
fix for enumerating settings in dbx_kv
git-svn-id: http://svn.miranda-ng.org/main/trunk@12430 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_kv')
-rw-r--r--plugins/Dbx_kv/src/dbsettings.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/plugins/Dbx_kv/src/dbsettings.cpp b/plugins/Dbx_kv/src/dbsettings.cpp
index 0ec5a21667..e58b90fad8 100644
--- a/plugins/Dbx_kv/src/dbsettings.cpp
+++ b/plugins/Dbx_kv/src/dbsettings.cpp
@@ -574,23 +574,23 @@ STDMETHODIMP_(BOOL) CDbxKV::EnumContactSettings(MCONTACT contactID, DBCONTACTENU
keySearch.dwOfsModule = GetModuleNameOfs(dbces->szModule);
memset(keySearch.szSettingName, 0, SIZEOF(keySearch.szSettingName));
+ int result = -1;
+
ham_record_t rec = { 0 };
ham_key_t key = { sizeof(keySearch), &keySearch };
cursor_ptr cursor(m_dbSettings);
- if (ham_cursor_find(cursor, &key, &rec, HAM_FIND_GEQ_MATCH) != HAM_SUCCESS)
- return -1;
-
- int result = 0;
- do {
- DBSettingSortingKey *pKey = (DBSettingSortingKey*)key.data;
- if (pKey->dwContactID != contactID || pKey->dwOfsModule != keySearch.dwOfsModule)
- break;
-
- char szSetting[256];
- strncpy_s(szSetting, pKey->szSettingName, key.size - sizeof(DWORD) * 2);
- result = (dbces->pfnEnumProc)(szSetting, dbces->lParam);
- } while (ham_cursor_move(cursor, &key, &rec, HAM_CURSOR_NEXT) == HAM_SUCCESS);
+ if (ham_cursor_find(cursor, &key, &rec, HAM_FIND_GEQ_MATCH) == HAM_SUCCESS) {
+ do {
+ DBSettingSortingKey *pKey = (DBSettingSortingKey*)key.data;
+ if (pKey->dwContactID != contactID || pKey->dwOfsModule != keySearch.dwOfsModule)
+ break;
+
+ char szSetting[256];
+ strncpy_s(szSetting, pKey->szSettingName, key.size - sizeof(DWORD) * 2);
+ result = (dbces->pfnEnumProc)(szSetting, dbces->lParam);
+ } while (ham_cursor_move(cursor, &key, &rec, HAM_CURSOR_NEXT) == HAM_SUCCESS);
+ }
return result;
}