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.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/plugins/Dbx_mdb/src/dbsettings.cpp b/plugins/Dbx_mdb/src/dbsettings.cpp
index dac3892d79..89750b8fc7 100644
--- a/plugins/Dbx_mdb/src/dbsettings.cpp
+++ b/plugins/Dbx_mdb/src/dbsettings.cpp
@@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "commonheaders.h"
+#include "stdafx.h"
struct DBSettingKey
{
@@ -121,8 +121,8 @@ LBL_Seek:
DBCachedContact *cc = (contactID) ? m_cache->GetCachedContact(contactID) : NULL;
- txn_ptr trnlck(m_pMdbEnv);
- //mdb_open(trnlck, "settings", 0, &m_dbSettings);
+ txn_ptr trnlck(m_pMdbEnv);
+ //mdb_open(trnlck, "settings", 0, &m_dbSettings);
DBSettingKey keySearch;
keySearch.dwContactID = contactID;
@@ -140,10 +140,10 @@ LBL_Seek:
}
}
}
- return 1;
+ return 1;
}
- BYTE *pBlob = (BYTE*)data.mv_data;
+ BYTE *pBlob = (BYTE*)data.mv_data;
if (isStatic && (pBlob[0] & DBVTF_VARIABLELENGTH) && VLT(dbv->type) != VLT(pBlob[0]))
return 1;
@@ -493,7 +493,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::WriteContactSetting(MCONTACT contactID, DBCONTACTWR
}
for (;; Remap()) {
- txn_ptr trnlck(m_pMdbEnv);
+ txn_ptr trnlck(m_pMdbEnv);
MDB_CHECK(mdb_put(trnlck, m_dbSettings, &key, &data, MDB_RESERVE), 1);
BYTE *pBlob = (BYTE*)data.mv_data;
@@ -561,9 +561,9 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteContactSetting(MCONTACT contactID, LPCSTR szM
MDB_val key = { 2 * sizeof(DWORD) + settingNameLen, &keySearch }, data;
for (;; Remap()) {
- txn_ptr trnlck(m_pMdbEnv);
+ txn_ptr trnlck(m_pMdbEnv);
if (mdb_del(trnlck, m_dbSettings, &key, &data))
- return 1;
+ return 1;
if (trnlck.commit())
break;
@@ -593,36 +593,36 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTEN
DBSettingKey keySearch;
keySearch.dwContactID = contactID;
keySearch.dwOfsModule = GetModuleNameOfs(dbces->szModule);
- memset(keySearch.szSettingName, 0, SIZEOF(keySearch.szSettingName));
+ memset(keySearch.szSettingName, 0, _countof(keySearch.szSettingName));
LIST<char> arSettings(50);
{
- txn_ptr trnlck(m_pMdbEnv, true);
- cursor_ptr cursor(trnlck, m_dbSettings);
-
- MDB_val key = { sizeof(keySearch), &keySearch }, data;
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) == MDB_SUCCESS) {
- do {
- DBSettingKey *pKey = (DBSettingKey*)key.mv_data;
- if (pKey->dwContactID != contactID || pKey->dwOfsModule != keySearch.dwOfsModule)
- break;
-
+ txn_ptr trnlck(m_pMdbEnv, true);
+ cursor_ptr cursor(trnlck, m_dbSettings);
+
+ MDB_val key = { sizeof(keySearch), &keySearch }, data;
+ if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) == MDB_SUCCESS) {
+ do {
+ DBSettingKey *pKey = (DBSettingKey*)key.mv_data;
+ if (pKey->dwContactID != contactID || pKey->dwOfsModule != keySearch.dwOfsModule)
+ break;
+
char szSetting[256];
strncpy_s(szSetting, pKey->szSettingName, key.mv_size - sizeof(DWORD) * 2);
arSettings.insert(mir_strdup(szSetting));
- }
- while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS);
- }
- }
-
- if (arSettings.getCount() == 0)
- return -1;
-
- for (int i = 0; i < arSettings.getCount(); i++) {
+ }
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS);
+ }
+ }
+
+ if (arSettings.getCount() == 0)
+ return -1;
+
+ for (int i = 0; i < arSettings.getCount(); i++) {
result = (dbces->pfnEnumProc)(arSettings[i], dbces->lParam);
mir_free(arSettings[i]);
}
-
+
return result;
}