From 9fd2b766b2e4487bde13755522a6972415b5b0d6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 13 Apr 2021 11:22:07 +0300 Subject: code cleaning --- plugins/Dbx_mdbx/src/dbintf.cpp | 28 ++++++---------------------- plugins/Dbx_mdbx/src/dbintf.h | 13 ++++++++++--- 2 files changed, 16 insertions(+), 25 deletions(-) (limited to 'plugins') diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp index 5fbfdf1f69..73cd10b497 100644 --- a/plugins/Dbx_mdbx/src/dbintf.cpp +++ b/plugins/Dbx_mdbx/src/dbintf.cpp @@ -334,29 +334,13 @@ void CDbxMDBX::TouchFile() /////////////////////////////////////////////////////////////////////////////// // MIDatabaseChecker -typedef int (CDbxMDBX::*CheckWorker)(void); - -int CDbxMDBX::Start(DBCHeckCallback *callback) -{ - cb = callback; - return ERROR_SUCCESS; -} - -static CheckWorker Workers[] = -{ - &CDbxMDBX::CheckEvents1, - &CDbxMDBX::CheckEvents2, - &CDbxMDBX::CheckEvents3, -}; - int CDbxMDBX::CheckDb(int phase) { - if (phase >= _countof(Workers)) - return ERROR_OUT_OF_PAPER; - - return (this->*Workers[phase])(); -} + switch (phase) { + case 0: return CDbxMDBX::CheckEvents1(); + case 1: return CDbxMDBX::CheckEvents2(); + case 2: return CDbxMDBX::CheckEvents3(); + } -void CDbxMDBX::Destroy() -{ + return ERROR_OUT_OF_PAPER; } diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h index 4b6aac5804..25469bc606 100644 --- a/plugins/Dbx_mdbx/src/dbintf.h +++ b/plugins/Dbx_mdbx/src/dbintf.h @@ -296,9 +296,16 @@ protected: return this; } - STDMETHODIMP_(BOOL) Start(DBCHeckCallback *callback); - STDMETHODIMP_(BOOL) CheckDb(int phase); - STDMETHODIMP_(VOID) Destroy(); + STDMETHODIMP_(BOOL) Start(DBCHeckCallback *callback) + { + cb = callback; + return ERROR_SUCCESS; + } + + STDMETHODIMP_(VOID) Destroy() + {} + + STDMETHODIMP_(BOOL) CheckDb(int phase); DBCHeckCallback *cb; }; -- cgit v1.2.3