diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-19 17:00:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-19 17:00:58 +0000 |
commit | 1bbbc601b0bb2297c8074bdacf3d6ef6cb3491e1 (patch) | |
tree | f7d5ca8118963a5c39bccb1db8d50a7e1d27ff51 /plugins/Db3x_mmap/src | |
parent | 2bded955e286f0fcb860e0ed3a1ff3574f7db52c (diff) |
dbx_mmap:
- support for the obsolete profiles detection;
- don't print errors during headers change
git-svn-id: http://svn.miranda-ng.org/main/trunk@9866 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src')
-rw-r--r-- | plugins/Db3x_mmap/src/dbheaders.cpp | 14 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.h | 3 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/init.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/version.h | 2 |
5 files changed, 14 insertions, 9 deletions
diff --git a/plugins/Db3x_mmap/src/dbheaders.cpp b/plugins/Db3x_mmap/src/dbheaders.cpp index f279b98cfa..005b0022ec 100644 --- a/plugins/Db3x_mmap/src/dbheaders.cpp +++ b/plugins/Db3x_mmap/src/dbheaders.cpp @@ -57,15 +57,16 @@ int CDb3Mmap::CreateDbHeaders(const DBSignature& _sign) static TCHAR tszOldHeaders[] =
LPGENT("This profile is too old to be updated with PluginUpdater, your database must be converted first.\n\nWould you like to read how to fix this?");
-int CDb3Mmap::CheckDbHeaders()
+int CDb3Mmap::CheckDbHeaders(bool bInteractive)
{
if (memcmp(m_dbHeader.signature, &dbSignatureU, sizeof(m_dbHeader.signature)) &&
memcmp(m_dbHeader.signature, &dbSignatureE, sizeof(m_dbHeader.signature)))
{
if (!memcmp(&m_dbHeader.signature, &dbSignatureIM, sizeof(m_dbHeader.signature)) ||
- !memcmp(&m_dbHeader.signature, &dbSignatureSA, sizeof(m_dbHeader.signature)) ||
- !memcmp(&m_dbHeader.signature, &dbSignatureSD, sizeof(m_dbHeader.signature)))
- {
+ !memcmp(&m_dbHeader.signature, &dbSignatureSA, sizeof(m_dbHeader.signature)))
+ return EGROKPRF_OBSOLETE;
+
+ if (bInteractive && !memcmp(&m_dbHeader.signature, &dbSignatureSD, sizeof(m_dbHeader.signature))) {
if (IDYES == MessageBox(NULL, TranslateTS(tszOldHeaders), TranslateT("Obsolete database format"), MB_YESNO | MB_ICONWARNING)) {
TCHAR tszCurPath[MAX_PATH];
GetModuleFileName(NULL, tszCurPath, SIZEOF(tszCurPath));
@@ -87,9 +88,12 @@ int CDb3Mmap::CheckDbHeaders() }
switch (m_dbHeader.version) {
+ case DB_OLD_VERSION:
case DB_094_VERSION:
- case DB_095_1_VERSION:
case DB_095_VERSION:
+ return EGROKPRF_OBSOLETE;
+
+ case DB_095_1_VERSION:
break;
default:
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index 28107e7cee..5b1b8e9712 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -185,7 +185,7 @@ int CDb3Mmap::Create() int CDb3Mmap::PrepareCheck()
{
- int ret = CheckDbHeaders();
+ int ret = CheckDbHeaders(true);
if (ret != ERROR_SUCCESS)
return ret;
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index 1477bf27f2..f6f0f5f6de 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -47,6 +47,7 @@ DBHeader #define DBMODE_SHARED 0x0001
#define DBMODE_READONLY 0x0002
+#define DB_OLD_VERSION 0x00000700u
#define DB_094_VERSION 0x00000701u
#define DB_095_VERSION 0x00000800u
#define DB_095_1_VERSION 0x00000801u
@@ -188,7 +189,7 @@ struct CDb3Mmap : public MIDatabase, public MIDatabaseChecker, public MZeroedObj int Load(bool bSkipInit);
int Create(void);
int CreateDbHeaders(const DBSignature&);
- int CheckDbHeaders();
+ int CheckDbHeaders(bool bInteractive);
void ToggleEncryption(void);
void StoreKey(void);
diff --git a/plugins/Db3x_mmap/src/init.cpp b/plugins/Db3x_mmap/src/init.cpp index 928ec0739f..debdbba05b 100644 --- a/plugins/Db3x_mmap/src/init.cpp +++ b/plugins/Db3x_mmap/src/init.cpp @@ -63,7 +63,7 @@ static int grokHeader(const TCHAR *profile) if (db->Load(true) != ERROR_SUCCESS)
return EGROKPRF_CANTREAD;
- return db->CheckDbHeaders();
+ return db->CheckDbHeaders(false);
}
// returns 0 if all the APIs are injected otherwise, 1
diff --git a/plugins/Db3x_mmap/src/version.h b/plugins/Db3x_mmap/src/version.h index f625baeeeb..3622fa9133 100644 --- a/plugins/Db3x_mmap/src/version.h +++ b/plugins/Db3x_mmap/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 95
#define __RELEASE_NUM 1
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>
|