From d84c40216b5e60224eb365f633b5f142d459fc9e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 25 Feb 2014 19:51:01 +0000 Subject: merge from branch git-svn-id: http://svn.miranda-ng.org/main/trunk@8274 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/dbtool/eventchain.cpp | 37 +++++++++++++------------- plugins/Db3x_mmap/src/dbtool/initialchecks.cpp | 2 +- plugins/Db3x_mmap/src/dbtool/modulechain.cpp | 6 ++--- 3 files changed, 22 insertions(+), 23 deletions(-) (limited to 'plugins/Db3x_mmap/src/dbtool') diff --git a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp index 362f86436d..ff5defe281 100644 --- a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp @@ -31,7 +31,7 @@ static DWORD ofsThisEvent, ofsPrevEvent; static DWORD ofsDestPrevEvent; static DWORD eventCount; static DWORD lastTimestamp; -static DWORD ofsFirstUnread, timestampFirstUnread; +static DWORD ofsFirstUnread, tsFirstUnread; static DWORD memsize = 0; static DBEvent* memblock = NULL; static DBEvent* dbePrevEvent = NULL; @@ -87,12 +87,12 @@ void CDb3Mmap::FinishUp(DWORD ofsLast, DBContact *dbc) dbc->eventCount = eventCount; dbc->ofsLastEvent = ofsLast; if (cb->bMarkRead) { - dbc->ofsFirstUnreadEvent = 0; - dbc->timestampFirstUnread = 0; + dbc->ofsFirstUnread = 0; + dbc->tsFirstUnread = 0; } else { - dbc->ofsFirstUnreadEvent = ofsFirstUnread; - dbc->timestampFirstUnread = timestampFirstUnread; + dbc->ofsFirstUnread = ofsFirstUnread; + dbc->tsFirstUnread = tsFirstUnread; } if (memsize && memblock) { free(memblock); @@ -128,13 +128,13 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) eventCount = 0; backLookup = 0; lastTimestamp = 0; - ofsFirstUnread = timestampFirstUnread = 0; + ofsFirstUnread = tsFirstUnread = 0; if (cb->bEraseHistory) { dbc->eventCount = 0; dbc->ofsFirstEvent = 0; dbc->ofsLastEvent = 0; - dbc->ofsFirstUnreadEvent = 0; - dbc->timestampFirstUnread = 0; + dbc->ofsFirstUnread = 0; + dbc->tsFirstUnread = 0; return ERROR_NO_MORE_ITEMS; } } @@ -194,7 +194,7 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (!(dbeOld.flags & (DBEF_READ | DBEF_SENT))) { if (cb->bMarkRead) dbeOld.flags |= DBEF_READ; else if (ofsFirstUnread == 0) { - if (dbc->ofsFirstUnreadEvent != ofsThisEvent || dbc->timestampFirstUnread != dbeOld.timestamp) + if (dbc->ofsFirstUnread != ofsThisEvent || dbc->tsFirstUnread != dbeOld.timestamp) cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("First unread event marked wrong: fixing")); isUnread = 1; } @@ -235,7 +235,7 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) dbeNew->ofsPrev = ofsDestPrevEvent; dbeNew->ofsNext = 0; - if (dbeOld.eventType == EVENTTYPE_MESSAGE && cb->bConvertUtf && !(dbeOld.flags & DBEF_ENCRYPTED)) { + if (dbeOld.wEventType == EVENTTYPE_MESSAGE && cb->bConvertUtf && !(dbeOld.flags & DBEF_ENCRYPTED)) { DWORD oldSize = dbeNew->cbBlob; BYTE* pOldMemo = (BYTE*)_alloca(dbeNew->cbBlob); memcpy(pOldMemo, dbeNew->blob, dbeNew->cbBlob); @@ -249,10 +249,9 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (dbePrev) { if (dbePrev->cbBlob == dbeNew->cbBlob && - dbePrev->ofsModuleName == dbeNew->ofsModuleName && - dbePrev->eventType == dbeNew->eventType && - (dbePrev->flags & DBEF_SENT) == (dbeNew->flags & DBEF_SENT) && - !memcmp(dbePrev->blob, dbeNew->blob, dbeNew->cbBlob)) + dbePrev->ofsModuleName == dbeNew->ofsModuleName && + dbePrev->wEventType == dbeNew->wEventType && + (dbePrev->flags & DBEF_SENT) == (dbeNew->flags & DBEF_SENT) && !memcmp(dbePrev->blob, dbeNew->blob, dbeNew->cbBlob)) { cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("Duplicate event was found: skipping")); if (dbc->eventCount) @@ -316,9 +315,9 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (!ofsDestThis) return ERROR_HANDLE_DISK_FULL; - if (isUnread && timestampFirstUnread >= dbeNew->timestamp) { + if (isUnread && tsFirstUnread >= dbeNew->timestamp) { ofsFirstUnread = ofsDestThis; - timestampFirstUnread = dbeNew->timestamp; + tsFirstUnread = dbeNew->timestamp; } // fix first event WriteOfsNextToPrevious(0, dbc, ofsDestThis); @@ -335,9 +334,9 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (!ofsDestThis) return ERROR_HANDLE_DISK_FULL; - if (isUnread && timestampFirstUnread >= dbeNew->timestamp) { + if (isUnread && tsFirstUnread >= dbeNew->timestamp) { ofsFirstUnread = ofsDestThis; - timestampFirstUnread = dbeNew->timestamp; + tsFirstUnread = dbeNew->timestamp; } // fix previous event WriteOfsNextToPrevious(dbeNew->ofsPrev, dbc, ofsDestThis); @@ -363,7 +362,7 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (isUnread) { ofsFirstUnread = ofsDestThis; - timestampFirstUnread = dbeOld.timestamp; + tsFirstUnread = dbeOld.timestamp; } eventCount++; diff --git a/plugins/Db3x_mmap/src/dbtool/initialchecks.cpp b/plugins/Db3x_mmap/src/dbtool/initialchecks.cpp index 549c8937fe..86bad8729d 100644 --- a/plugins/Db3x_mmap/src/dbtool/initialchecks.cpp +++ b/plugins/Db3x_mmap/src/dbtool/initialchecks.cpp @@ -27,7 +27,7 @@ int CDb3Mmap::WorkInitialCheckHeaders() cb->pfnAddLogMessage(STATUS_FATAL, TranslateT("Database signature is corrupted, automatic repair is impossible")); return ERROR_BAD_FORMAT; } - if (m_dbHeader.version != DB_095_VERSION) { + if (m_dbHeader.version != DB_095_1_VERSION) { cb->pfnAddLogMessage(STATUS_FATAL, TranslateT("Database version doesn't match this driver's one. Convert a database first")); return ERROR_BAD_FORMAT; } diff --git a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp index 011c7eaa62..135935e4ed 100644 --- a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp @@ -41,7 +41,7 @@ int CDb3Mmap::WorkModuleChain(int firstTime) free(modChain); modChain = (ModChainEntry*)malloc(sizeof(ModChainEntry)); phase = 0; - ofsCurrent = m_dbHeader.ofsFirstModuleName; + ofsCurrent = m_dbHeader.ofsModuleNames; } switch (phase) { @@ -73,7 +73,7 @@ int CDb3Mmap::WorkModuleChain(int firstTime) case 1: ofsLast = 0; iCurrentModName = 0; - m_dbHeader.ofsFirstModuleName = 0; + m_dbHeader.ofsModuleNames = 0; phase++; case 2: if (iCurrentModName >= modChainCount) { @@ -104,7 +104,7 @@ int CDb3Mmap::WorkModuleChain(int firstTime) } if (iCurrentModName == 0) - m_dbHeader.ofsFirstModuleName = modChain[iCurrentModName].ofsNew; + m_dbHeader.ofsModuleNames = modChain[iCurrentModName].ofsNew; else if (WriteSegment(ofsLast + offsetof(DBModuleName, ofsNext), &modChain[iCurrentModName].ofsNew, sizeof(DWORD)) == WS_ERROR) return ERROR_HANDLE_DISK_FULL; ofsLast = modChain[iCurrentModName].ofsNew; -- cgit v1.2.3