From cd4a3aab6a6406bcaca07734848e57477db4485d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Mar 2015 16:26:47 +0000 Subject: fix for enumerating settings in dbx_kv git-svn-id: http://svn.miranda-ng.org/main/trunk@12430 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_kv/src/dbsettings.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins') 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; } -- cgit v1.2.3