diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-07 14:08:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-07 14:08:15 +0000 |
commit | 7b8b7fa685ea5de62002d5637b4c34e19dfedeee (patch) | |
tree | e56c7f34d2470edc5cf40dea77d8e6ca0f6a17ac /plugins/Db3x_mmap/src/dbtool | |
parent | 7f2e5db6faeded54a61e9e1595d6d1596647db4d (diff) |
- the internal DBContact structure extended to hold one more DWORD: contact ID;
- when called from dbchecker, mmap now refuses to check the old versions of database;
- old classes hierarchy removed, all classes were merged into one due to the death of db3x & mmap_sa;
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@8061 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbtool')
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/aggressive.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/contactchain.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/disk.cpp | 10 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/eventchain.cpp | 14 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/finaltasks.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/initialchecks.cpp | 11 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/modulechain.cpp | 6 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/settingschain.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/user.cpp | 2 |
9 files changed, 25 insertions, 26 deletions
diff --git a/plugins/Db3x_mmap/src/dbtool/aggressive.cpp b/plugins/Db3x_mmap/src/dbtool/aggressive.cpp index 92266f37b3..e5146e9660 100644 --- a/plugins/Db3x_mmap/src/dbtool/aggressive.cpp +++ b/plugins/Db3x_mmap/src/dbtool/aggressive.cpp @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define BLOCKSIZE 65536
-int CDb3Base::WorkAggressive(int firstTime)
+int CDb3Mmap::WorkAggressive(int firstTime)
{
if (firstTime) {
if (!cb->bAggressive)
diff --git a/plugins/Db3x_mmap/src/dbtool/contactchain.cpp b/plugins/Db3x_mmap/src/dbtool/contactchain.cpp index d1aa5a933e..979071fad4 100644 --- a/plugins/Db3x_mmap/src/dbtool/contactchain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/contactchain.cpp @@ -25,7 +25,7 @@ static DWORD ofsDestThis, ofsNextContact; static int phase;
static DBContact dbc;
-int CDb3Base::WorkContactChain(int firstTime)
+int CDb3Mmap::WorkContactChain(int firstTime)
{
int first = 0;
int ret;
diff --git a/plugins/Db3x_mmap/src/dbtool/disk.cpp b/plugins/Db3x_mmap/src/dbtool/disk.cpp index d22afb70d9..7cd4dfd88c 100644 --- a/plugins/Db3x_mmap/src/dbtool/disk.cpp +++ b/plugins/Db3x_mmap/src/dbtool/disk.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\commonheaders.h"
-int CDb3Base::SignatureValid(DWORD ofs, DWORD signature)
+int CDb3Mmap::SignatureValid(DWORD ofs, DWORD signature)
{
if (ofs + sizeof(DWORD) >= sourceFileSize) {
cb->pfnAddLogMessage(STATUS_ERROR, TranslateT("Invalid offset found (database truncated?)"));
@@ -30,7 +30,7 @@ int CDb3Base::SignatureValid(DWORD ofs, DWORD signature) return sig == signature;
}
-int CDb3Base::PeekSegment(DWORD ofs, PVOID buf, int cbBytes)
+int CDb3Mmap::PeekSegment(DWORD ofs, PVOID buf, int cbBytes)
{
if (ofs >= sourceFileSize) {
cb->pfnAddLogMessage(STATUS_ERROR, TranslateT("Invalid offset found"));
@@ -54,7 +54,7 @@ int CDb3Base::PeekSegment(DWORD ofs, PVOID buf, int cbBytes) return ERROR_SUCCESS;
}
-int CDb3Base::ReadSegment(DWORD ofs, PVOID buf, int cbBytes)
+int CDb3Mmap::ReadSegment(DWORD ofs, PVOID buf, int cbBytes)
{
int ret = PeekSegment(ofs, buf, cbBytes);
if (ret != ERROR_SUCCESS && ret != ERROR_HANDLE_EOF) return ret;
@@ -70,7 +70,7 @@ int CDb3Base::ReadSegment(DWORD ofs, PVOID buf, int cbBytes) return ERROR_SUCCESS;
}
-DWORD CDb3Base::WriteSegment(DWORD ofs, PVOID buf, int cbBytes)
+DWORD CDb3Mmap::WriteSegment(DWORD ofs, PVOID buf, int cbBytes)
{
DWORD bytesWritten;
if (cb->bCheckOnly) return 0xbfbfbfbf;
@@ -87,7 +87,7 @@ DWORD CDb3Base::WriteSegment(DWORD ofs, PVOID buf, int cbBytes) return ofs;
}
-int CDb3Base::ReadWrittenSegment(DWORD ofs, PVOID buf, int cbBytes)
+int CDb3Mmap::ReadWrittenSegment(DWORD ofs, PVOID buf, int cbBytes)
{
DWORD bytesRead;
if (cb->bCheckOnly) return 0xbfbfbfbf;
diff --git a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp index 9062d2f389..362f86436d 100644 --- a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp @@ -36,7 +36,7 @@ static DWORD memsize = 0; static DBEvent* memblock = NULL;
static DBEvent* dbePrevEvent = NULL;
-void CDb3Base::ConvertOldEvent(DBEvent*& dbei)
+void CDb3Mmap::ConvertOldEvent(DBEvent*& dbei)
{
int msglen = (int)strlen((char*)dbei->blob) + 1, msglenW = 0;
if (msglen != (int)dbei->cbBlob) {
@@ -71,7 +71,7 @@ void CDb3Base::ConvertOldEvent(DBEvent*& dbei) }
}
-void CDb3Base::WriteOfsNextToPrevious(DWORD ofsPrev, DBContact *dbc, DWORD ofsNext)
+void CDb3Mmap::WriteOfsNextToPrevious(DWORD ofsPrev, DBContact *dbc, DWORD ofsNext)
{
if (ofsPrev)
WriteSegment(ofsPrev + offsetof(DBEvent, ofsNext), &ofsNext, sizeof(DWORD));
@@ -79,7 +79,7 @@ void CDb3Base::WriteOfsNextToPrevious(DWORD ofsPrev, DBContact *dbc, DWORD ofsNe dbc->ofsFirstEvent = ofsNext;
}
-void CDb3Base::FinishUp(DWORD ofsLast, DBContact *dbc)
+void CDb3Mmap::FinishUp(DWORD ofsLast, DBContact *dbc)
{
WriteOfsNextToPrevious(ofsLast, dbc, 0);
if (eventCount != dbc->eventCount)
@@ -101,7 +101,7 @@ void CDb3Base::FinishUp(DWORD ofsLast, DBContact *dbc) }
}
-DWORD CDb3Base::WriteEvent(DBEvent *dbe)
+DWORD CDb3Mmap::WriteEvent(DBEvent *dbe)
{
DWORD ofs = WriteSegment(WSOFS_END, dbe, offsetof(DBEvent, blob) + dbe->cbBlob);
if (ofs == WS_ERROR) {
@@ -113,7 +113,7 @@ DWORD CDb3Base::WriteEvent(DBEvent *dbe) return ofs;
}
-int CDb3Base::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime)
+int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime)
{
DBEvent *dbeNew, dbeOld;
DBEvent *dbePrev = NULL;
@@ -239,12 +239,12 @@ int CDb3Base::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) DWORD oldSize = dbeNew->cbBlob;
BYTE* pOldMemo = (BYTE*)_alloca(dbeNew->cbBlob);
memcpy(pOldMemo, dbeNew->blob, dbeNew->cbBlob);
- DecodeCopyMemory(dbeNew->blob, pOldMemo, dbeNew->cbBlob); // decode
+ MoveMemory(dbeNew->blob, pOldMemo, dbeNew->cbBlob); // decode
ConvertOldEvent(dbeNew);
if (dbeNew->cbBlob > oldSize)
pOldMemo = (BYTE*)_alloca(dbeNew->cbBlob);
memcpy(pOldMemo, dbeNew->blob, dbeNew->cbBlob);
- EncodeCopyMemory(dbeNew->blob, pOldMemo, dbeNew->cbBlob); // encode
+ MoveMemory(dbeNew->blob, pOldMemo, dbeNew->cbBlob); // encode
}
if (dbePrev) {
diff --git a/plugins/Db3x_mmap/src/dbtool/finaltasks.cpp b/plugins/Db3x_mmap/src/dbtool/finaltasks.cpp index dc1e05463c..972999524b 100644 --- a/plugins/Db3x_mmap/src/dbtool/finaltasks.cpp +++ b/plugins/Db3x_mmap/src/dbtool/finaltasks.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\commonheaders.h"
-int CDb3Base::WorkFinalTasks(int firstTime)
+int CDb3Mmap::WorkFinalTasks(int firstTime)
{
FreeModuleChain();
cb->pfnAddLogMessage(STATUS_MESSAGE, TranslateT("Processing final tasks"));
diff --git a/plugins/Db3x_mmap/src/dbtool/initialchecks.cpp b/plugins/Db3x_mmap/src/dbtool/initialchecks.cpp index 4501162263..549c8937fe 100644 --- a/plugins/Db3x_mmap/src/dbtool/initialchecks.cpp +++ b/plugins/Db3x_mmap/src/dbtool/initialchecks.cpp @@ -19,23 +19,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\commonheaders.h"
-int CDb3Base::WorkInitialCheckHeaders()
+int CDb3Mmap::WorkInitialCheckHeaders()
{
if (memcmp(m_dbHeader.signature, &dbSignatureU, sizeof(m_dbHeader.signature)) &&
- memcmp(m_dbHeader.signature, &dbSignatureE, sizeof(m_dbHeader.signature)) &&
- memcmp(m_dbHeader.signature, &dbSignatureIM, sizeof(m_dbHeader.signature)))
+ memcmp(m_dbHeader.signature, &dbSignatureE, sizeof(m_dbHeader.signature)))
{
cb->pfnAddLogMessage(STATUS_FATAL, TranslateT("Database signature is corrupted, automatic repair is impossible"));
return ERROR_BAD_FORMAT;
}
- if (m_dbHeader.version != DB_OLD_VERSION && m_dbHeader.version != DB_THIS_VERSION) {
- cb->pfnAddLogMessage(STATUS_FATAL, TranslateT("Database is marked as belonging to an unknown version of Miranda"));
+ if (m_dbHeader.version != DB_095_VERSION) {
+ cb->pfnAddLogMessage(STATUS_FATAL, TranslateT("Database version doesn't match this driver's one. Convert a database first"));
return ERROR_BAD_FORMAT;
}
return ERROR_SUCCESS;
}
-int CDb3Base::WorkInitialChecks(int firstTime)
+int CDb3Mmap::WorkInitialChecks(int firstTime)
{
sourceFileSize = GetFileSize(m_hDbFile, NULL);
if (sourceFileSize == 0) {
diff --git a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp index c846455474..011c7eaa62 100644 --- a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp @@ -30,7 +30,7 @@ static int phase,iCurrentModName; static DWORD ofsLast;
static int last_mod = 0;
-int CDb3Base::WorkModuleChain(int firstTime)
+int CDb3Mmap::WorkModuleChain(int firstTime)
{
DBModuleName moduleName, *newModName;
@@ -115,7 +115,7 @@ int CDb3Base::WorkModuleChain(int firstTime) return ERROR_SUCCESS;
}
-DWORD CDb3Base::ConvertModuleNameOfs(DWORD ofsOld)
+DWORD CDb3Mmap::ConvertModuleNameOfs(DWORD ofsOld)
{
if (modChain[last_mod].ofsOld == ofsOld)
return modChain[last_mod].ofsNew;
@@ -130,7 +130,7 @@ DWORD CDb3Base::ConvertModuleNameOfs(DWORD ofsOld) return 0;
}
-void CDb3Base::FreeModuleChain()
+void CDb3Mmap::FreeModuleChain()
{
if (modChain != NULL) {
free(modChain);
diff --git a/plugins/Db3x_mmap/src/dbtool/settingschain.cpp b/plugins/Db3x_mmap/src/dbtool/settingschain.cpp index 1311b58661..8911f86e07 100644 --- a/plugins/Db3x_mmap/src/dbtool/settingschain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/settingschain.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static DWORD ofsThisSettings, ofsDestPrevSettings;
-int CDb3Base::WorkSettingsChain(DWORD ofsContact, DBContact *dbc, int firstTime)
+int CDb3Mmap::WorkSettingsChain(DWORD ofsContact, DBContact *dbc, int firstTime)
{
DWORD ofsDestThis;
int ret;
diff --git a/plugins/Db3x_mmap/src/dbtool/user.cpp b/plugins/Db3x_mmap/src/dbtool/user.cpp index 7b56e29c06..72d403f509 100644 --- a/plugins/Db3x_mmap/src/dbtool/user.cpp +++ b/plugins/Db3x_mmap/src/dbtool/user.cpp @@ -23,7 +23,7 @@ static DBContact user; static int phase;
static DWORD ofsUser;
-int CDb3Base::WorkUser(int firstTime)
+int CDb3Mmap::WorkUser(int firstTime)
{
int first = 0;
|