From be3185a374d39a8ee0f12a4e985ecca279633fff Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 28 Jul 2012 18:29:52 +0000 Subject: - MS_DB_CHECKPROFILE - service for checking databases - added menu item "Check" to a context menu in profile manager git-svn-id: http://svn.miranda-ng.org/main/trunk@1228 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_tree/DataBase.cpp | 38 +++++++++++++++++++------------------- plugins/Dbx_tree/DatabaseLink.cpp | 4 ++-- 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'plugins/Dbx_tree') diff --git a/plugins/Dbx_tree/DataBase.cpp b/plugins/Dbx_tree/DataBase.cpp index b685981037..033e472c9d 100644 --- a/plugins/Dbx_tree/DataBase.cpp +++ b/plugins/Dbx_tree/DataBase.cpp @@ -106,25 +106,25 @@ int CDataBase::CheckFile(TDBFileType Index) HANDLE htmp = CreateFile(m_FileName[Index], GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL); if (htmp != INVALID_HANDLE_VALUE) { - SetFilePointer(htmp, 0, NULL, FILE_BEGIN); - if (ReadFile(htmp, &h, sizeof(h), &r, NULL)) - { - if (0 != memcmp(h.Gen.Signature, cFileSignature[Index], sizeof(cFileSignature[Index]))) - { - CloseHandle(htmp); - return EGROKPRF_UNKHEADER; - } - - if (cDBVersion < h.Gen.Version) - { - CloseHandle(htmp); - return EGROKPRF_VERNEWER; - } - - CloseHandle(htmp); - return EGROKPRF_NOERROR; - } - CloseHandle(htmp); + SetFilePointer(htmp, 0, NULL, FILE_BEGIN); + if (ReadFile(htmp, &h, sizeof(h), &r, NULL)) + { + if (0 != memcmp(h.Gen.Signature, cFileSignature[Index], sizeof(cFileSignature[Index]))) + { + CloseHandle(htmp); + return EGROKPRF_UNKHEADER; + } + + if (cDBVersion < h.Gen.Version) + { + CloseHandle(htmp); + return EGROKPRF_VERNEWER; + } + + CloseHandle(htmp); + return EGROKPRF_NOERROR; + } + CloseHandle(htmp); } return EGROKPRF_CANTREAD; diff --git a/plugins/Dbx_tree/DatabaseLink.cpp b/plugins/Dbx_tree/DatabaseLink.cpp index 579076613d..79c1758fca 100644 --- a/plugins/Dbx_tree/DatabaseLink.cpp +++ b/plugins/Dbx_tree/DatabaseLink.cpp @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int makeDatabase(const TCHAR *profile) { std::auto_ptr db( new CDataBase(profile)); - return gDataBase->CreateDB(); + return db->CreateDB(); } /* @@ -54,7 +54,7 @@ static int makeDatabase(const TCHAR *profile) static int grokHeader(const TCHAR *profile) { std::auto_ptr db( new CDataBase(profile)); - return gDataBase->CheckDB(); + return db->CheckDB(); } /* -- cgit v1.2.3