diff options
author | George Hazan <george.hazan@gmail.com> | 2015-01-12 21:16:52 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-01-12 21:16:52 +0000 |
commit | 3f5208b9147b32ddcf259ec8bb3fb280192928f8 (patch) | |
tree | 18556c5846701e85403843f4bc66422dcdb3bf6a /plugins/Dbx_mdb/src/dbmodulechain.cpp | |
parent | 0eab78fa8138134301a4887d292f5c2e4c260a34 (diff) |
fix for reading
git-svn-id: http://svn.miranda-ng.org/main/trunk@11846 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbmodulechain.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbmodulechain.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/Dbx_mdb/src/dbmodulechain.cpp b/plugins/Dbx_mdb/src/dbmodulechain.cpp index 70e843111a..59b2b8d509 100644 --- a/plugins/Dbx_mdb/src/dbmodulechain.cpp +++ b/plugins/Dbx_mdb/src/dbmodulechain.cpp @@ -43,18 +43,17 @@ int CDbxMdb::InitModuleNames(void) m_maxModuleID = 0;
MDB_txn *txn;
- mdb_txn_begin(m_pMdbEnv, NULL, MDB_RDONLY, &txn); + mdb_txn_begin(m_pMdbEnv, NULL, 0, &txn); mdb_open(txn, "modules", MDB_CREATE | MDB_INTEGERKEY, &m_dbModules); + mdb_open(txn, "events", MDB_CREATE | MDB_INTEGERKEY, &m_dbEvents); MDB_cursor *cursor; mdb_cursor_open(txn, m_dbModules, &cursor); - int rc, moduleId; - char valueBuf[100]; - MDB_val key = { sizeof(int), &moduleId }, data = { sizeof(valueBuf), valueBuf }; + MDB_val key, data; - while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) { - DBModuleName *pmod = (DBModuleName*)valueBuf; + while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) { + DBModuleName *pmod = (DBModuleName*)data.mv_data; if (pmod->signature != DBMODULENAME_SIGNATURE) DatabaseCorruption(NULL); @@ -62,6 +61,7 @@ int CDbxMdb::InitModuleNames(void) memcpy(pVal, pmod->name, pmod->cbName);
pVal[pmod->cbName] = 0;
+ int moduleId = *(int*)key.mv_data; AddToList(pVal, moduleId);
if (moduleId > m_maxModuleID)
|