diff options
Diffstat (limited to 'plugins/Dbx_mdb/src/dbmodulechain.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbmodulechain.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/plugins/Dbx_mdb/src/dbmodulechain.cpp b/plugins/Dbx_mdb/src/dbmodulechain.cpp index 1a78284d78..a42ab0b221 100644 --- a/plugins/Dbx_mdb/src/dbmodulechain.cpp +++ b/plugins/Dbx_mdb/src/dbmodulechain.cpp @@ -42,24 +42,24 @@ int CDbxMdb::InitModuleNames(void) {
m_maxModuleID = 0;
- txn_ptr trnlck(m_pMdbEnv); - mdb_open(trnlck, "modules", MDB_INTEGERKEY, &m_dbModules); -
- cursor_ptr cursor(trnlck, m_dbModules); - if (!cursor) - return 1; - - MDB_val key, data; - while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) { - DBModuleName *pmod = (DBModuleName*)data.mv_data; - if (pmod->signature != DBMODULENAME_SIGNATURE) - DatabaseCorruption(NULL); - - char *pVal = (char*)HeapAlloc(m_hModHeap, 0, pmod->cbName+1); + txn_ptr trnlck(m_pMdbEnv);
+ mdb_open(trnlck, "modules", MDB_INTEGERKEY, &m_dbModules);
+
+ cursor_ptr cursor(trnlck, m_dbModules);
+ if (!cursor)
+ return 1;
+
+ MDB_val key, data;
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) {
+ DBModuleName *pmod = (DBModuleName*)data.mv_data;
+ if (pmod->dwSignature != DBMODULENAME_SIGNATURE)
+ DatabaseCorruption(NULL);
+
+ char *pVal = (char*)HeapAlloc(m_hModHeap, 0, pmod->cbName+1);
memcpy(pVal, pmod->name, pmod->cbName);
pVal[pmod->cbName] = 0;
- - int moduleId = *(int*)key.mv_data; +
+ int moduleId = *(int*)key.mv_data;
AddToList(pVal, moduleId);
if (moduleId > m_maxModuleID)
@@ -94,15 +94,15 @@ DWORD CDbxMdb::GetModuleNameOfs(const char *szName) // need to create the module name
int newIdx = ++m_maxModuleID;
DBModuleName *pmod = (DBModuleName*)_alloca(sizeof(DBModuleName) + nameLen);
- pmod->signature = DBMODULENAME_SIGNATURE;
+ pmod->dwSignature = DBMODULENAME_SIGNATURE;
pmod->cbName = (char)nameLen;
strcpy(pmod->name, szName);
- MDB_val key = { sizeof(int), &newIdx }, data = { sizeof(DBModuleName) + nameLen, pmod }; + MDB_val key = { sizeof(int), &newIdx }, data = { sizeof(DBModuleName) + nameLen, pmod };
for (;; Remap()) {
- txn_ptr trnlck(m_pMdbEnv); - mdb_open(trnlck, "modules", MDB_INTEGERKEY, &m_dbModules); + txn_ptr trnlck(m_pMdbEnv);
+ mdb_open(trnlck, "modules", MDB_INTEGERKEY, &m_dbModules);
mdb_put(trnlck, m_dbModules, &key, &data, 0);
if (trnlck.commit())
break;
|