diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-01 13:52:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-01 13:52:10 +0000 |
commit | 25a9dd837d2fb1b49d8c59203f52af2242056db6 (patch) | |
tree | 5b8c7731d683c18c7fe164b802fa8281114c8968 /plugins/Db3x_mmap | |
parent | 6d99149365c5b279127644bfc12e76f800c806f3 (diff) |
fix for the resident variables
git-svn-id: http://svn.miranda-ng.org/main/trunk@2129 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap')
-rw-r--r-- | plugins/Db3x_mmap/src/dbsettings.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index 298fd4b2b1..47bfef5e08 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -331,20 +331,18 @@ STDMETHODIMP_(BOOL) CDb3Base::FreeVariant(DBVARIANT *dbv) STDMETHODIMP_(BOOL) CDb3Base::SetSettingResident(BOOL bIsResident, const char *pszSettingName)
{
- int cbSettingNameLen = (int)strlen(pszSettingName) + 2;
- if (cbSettingNameLen < 512) {
- char *szSetting = m_cache->InsertCachedSetting(pszSettingName, cbSettingNameLen);
- *szSetting = (char)bIsResident;
-
- mir_cslock lck(m_csDbAccess);
- int idx = m_lResidentSettings.getIndex(szSetting+1);
- if (idx == -1) {
- if (bIsResident)
- m_lResidentSettings.insert(szSetting+1);
- }
- else if (!bIsResident)
- m_lResidentSettings.remove(idx);
+ char *szSetting = m_cache->GetCachedSetting(NULL, pszSettingName, 0, strlen(pszSettingName));
+ szSetting[-1] = (char)bIsResident;
+
+ mir_cslock lck(m_csDbAccess);
+ int idx = m_lResidentSettings.getIndex(szSetting);
+ if (idx == -1) {
+ if (bIsResident)
+ m_lResidentSettings.insert(szSetting);
}
+ else if (!bIsResident)
+ m_lResidentSettings.remove(idx);
+
return 0;
}
|