diff options
author | George Hazan <george.hazan@gmail.com> | 2015-04-05 11:22:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-04-05 11:22:18 +0000 |
commit | 555cb30158d41cb7f66eae95d5aaf400a413731a (patch) | |
tree | 51612042c6a1f0fa29991e9d9e1b51e737e9161e /plugins/Dbx_kyoto/src/dbsettings.cpp | |
parent | 340d879890f5099c21e36fc147d6432a1ac050bf (diff) |
fix for custom sorting procedures
git-svn-id: http://svn.miranda-ng.org/main/trunk@12605 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_kyoto/src/dbsettings.cpp')
-rw-r--r-- | plugins/Dbx_kyoto/src/dbsettings.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/Dbx_kyoto/src/dbsettings.cpp b/plugins/Dbx_kyoto/src/dbsettings.cpp index c1b4eea707..5edd642bf8 100644 --- a/plugins/Dbx_kyoto/src/dbsettings.cpp +++ b/plugins/Dbx_kyoto/src/dbsettings.cpp @@ -120,7 +120,7 @@ LBL_Seek: strncpy_s(keySearch.szSettingName, szSetting, _TRUNCATE);
char *rec = (char*)_alloca(65536);
- if (-1 == m_dbSettings.get((LPCSTR)&keySearch, 2 * sizeof(DWORD) + settingNameLen, rec, 65536)) {
+ if (-1 == m_dbSettings.get((LPCSTR)&keySearch, 2 * sizeof(DWORD) + settingNameLen+1, rec, 65536)) {
// try to get the missing mc setting from the active sub
if (cc && cc->IsMeta() && ValidLookupName(szModule, szSetting)) {
if (contactID = db_mc_getDefault(contactID)) {
@@ -503,7 +503,7 @@ STDMETHODIMP_(BOOL) CDbxKyoto::WriteContactSetting(MCONTACT contactID, DBCONTACT *(WORD*)pBlob = dbcwWork.value.cpbVal;
memcpy(pBlob+2, dbcwWork.value.pbVal, dbcwWork.value.cpbVal);
}
- m_dbSettings.set((LPCSTR)&keySearch, 2 * sizeof(DWORD) + settingNameLen, recData, recSize);
+ m_dbSettings.set((LPCSTR)&keySearch, 2 * sizeof(DWORD) + settingNameLen+1, recData, recSize);
lck.unlock();
// notify
@@ -541,7 +541,7 @@ STDMETHODIMP_(BOOL) CDbxKyoto::DeleteContactSetting(MCONTACT contactID, LPCSTR s keySearch.dwContactID = contactID;
keySearch.dwOfsModule = GetModuleNameOfs(szModule);
strncpy_s(keySearch.szSettingName, szSetting, _TRUNCATE);
- if (!m_dbSettings.remove((LPCSTR)&keySearch, 2 * sizeof(DWORD) + settingNameLen))
+ if (!m_dbSettings.remove((LPCSTR)&keySearch, 2 * sizeof(DWORD) + settingNameLen+1))
return 1;
}
@@ -576,13 +576,17 @@ STDMETHODIMP_(BOOL) CDbxKyoto::EnumContactSettings(MCONTACT contactID, DBCONTACT while (cursor->step()) {
size_t size, keySize;
const char *pRec, *key = cursor->get(&keySize, &pRec, &size);
+ if (key == NULL)
+ break;
+
DBSettingSortingKey *pKey = (DBSettingSortingKey*)key;
- if (pKey->dwContactID != contactID || pKey->dwOfsModule != keySearch.dwOfsModule)
+ if (pKey->dwContactID != contactID || pKey->dwOfsModule != keySearch.dwOfsModule) {
+ delete[] pKey;
break;
+ }
- char szSetting[256];
- strncpy_s(szSetting, pKey->szSettingName, keySize - sizeof(DWORD) * 2);
- result = (dbces->pfnEnumProc)(szSetting, dbces->lParam);
+ result = (dbces->pfnEnumProc)(pKey->szSettingName, dbces->lParam);
+ delete[] pKey;
}
return result;
|