From df77e258df8cec689a001ec92031538298661b1b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 27 Jul 2012 15:33:58 +0000 Subject: merge of dbtool & database plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@1213 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/dbintf.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'plugins/Db3x_mmap/src/dbintf.cpp') diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index 0479be3691..84ddc64468 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -94,6 +94,9 @@ CDb3Base::~CDb3Base() UnmapViewOfFile(m_pDbCache); } + if (m_hMap) + CloseHandle(m_hMap); + // update profile last modified time DWORD bytesWritten; SetFilePointer(m_hDbFile, 0, NULL, FILE_BEGIN); @@ -168,3 +171,34 @@ void CDb3Base::DecodeDBWrite(DWORD ofs, void *src, int size) DBWrite(ofs, src, size); } +/////////////////////////////////////////////////////////////////////////////// +// MIDatabaseChecker + +static CheckWorker Workers[6] = +{ + &CDb3Base::WorkInitialChecks, + &CDb3Base::WorkModuleChain, + &CDb3Base::WorkUser, + &CDb3Base::WorkContactChain, + &CDb3Base::WorkAggressive, + &CDb3Base::WorkFinalTasks +}; + +int CDb3Base::Start(DBCHeckCallback *callback) +{ + cb = callback; + return ERROR_SUCCESS; +} + +int CDb3Base::CheckDb(int phase, int firstTime) +{ + if (phase >= SIZEOF(Workers)) + return ERROR_OUT_OF_PAPER; + + return (this->*Workers[phase])(firstTime); +} + +void CDb3Base::Destroy() +{ + delete this; +} -- cgit v1.2.3