From 7a7a6637021d78ad995f3e21e9743fae69bd2562 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 16 Sep 2016 17:47:16 +0000 Subject: service wrappers -> real functions git-svn-id: http://svn.miranda-ng.org/main/trunk@17304 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/db_intf.cpp | 40 +++++++++++++--------------------------- src/mir_app/src/mir_app.def | 4 ++++ src/mir_app/src/mir_app64.def | 4 ++++ 3 files changed, 21 insertions(+), 27 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/db_intf.cpp b/src/mir_app/src/db_intf.cpp index 504bc5bb34..5fc97fc99a 100644 --- a/src/mir_app/src/db_intf.cpp +++ b/src/mir_app/src/db_intf.cpp @@ -29,56 +29,42 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. LIST arDbPlugins(5); -static INT_PTR srvRegisterPlugin(WPARAM, LPARAM lParam) +MIR_APP_DLL(void) RegisterDatabasePlugin(DATABASELINK *pDescr) { - DATABASELINK* pPlug = (DATABASELINK*)lParam; - if (pPlug == NULL) - return 1; - - arDbPlugins.insert(pPlug); - return 0; + if (pDescr != NULL) + arDbPlugins.insert(pDescr); } -static INT_PTR srvFindPlugin(WPARAM, LPARAM lParam) +MIR_APP_DLL(DATABASELINK*) FindDatabasePlugin(const wchar_t *ptszFileName) { for (int i = arDbPlugins.getCount() - 1; i >= 0; i--) { - int error = arDbPlugins[i]->grokHeader((wchar_t*)lParam); + int error = arDbPlugins[i]->grokHeader(ptszFileName); if (error == ERROR_SUCCESS || error == EGROKPRF_OBSOLETE) - return (INT_PTR)arDbPlugins[i]; + return arDbPlugins[i]; } return NULL; } -static INT_PTR srvInitInstance(WPARAM, LPARAM lParam) +MIR_APP_DLL(void) InitDbInstance(MIDatabase *pDatabase) { - MIDatabase *pDb = (MIDatabase*)lParam; - if (pDb != NULL) - pDb->m_cache = new MDatabaseCache(pDb->GetContactSize()); - return 0; + if (pDatabase != NULL) + pDatabase->m_cache = new MDatabaseCache(pDatabase->GetContactSize()); } -static INT_PTR srvDestroyInstance(WPARAM, LPARAM lParam) +MIR_APP_DLL(void) DestroyDbInstance(MIDatabase *pDatabase) { - MIDatabase *pDb = (MIDatabase*)lParam; - if (pDb != NULL) { - MDatabaseCache *pCache = (MDatabaseCache*)pDb->m_cache; - pDb->m_cache = NULL; + if (pDatabase != NULL) { + MDatabaseCache *pCache = (MDatabaseCache*)pDatabase->m_cache; + pDatabase->m_cache = NULL; delete pCache; } - return 0; } /////////////////////////////////////////////////////////////////////////////// int LoadDbintfModule() { - CreateServiceFunction(MS_DB_REGISTER_PLUGIN, srvRegisterPlugin); - CreateServiceFunction(MS_DB_FIND_PLUGIN, srvFindPlugin); - - CreateServiceFunction(MS_DB_INIT_INSTANCE, srvInitInstance); - CreateServiceFunction(MS_DB_DESTROY_INSTANCE, srvDestroyInstance); - // create events once, they will be inherited by all database plugins CreateHookableEvent(ME_DB_CONTACT_DELETED); CreateHookableEvent(ME_DB_CONTACT_ADDED); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index b880ce3c31..0d2942d84f 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -291,3 +291,7 @@ Profile_GetNameW @291 Profile_GetPathA @292 Profile_GetPathW @293 Profile_SetDefault @294 +DestroyDbInstance @295 +FindDatabasePlugin @296 +InitDbInstance @297 +RegisterDatabasePlugin @298 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index db6e5def22..e7ff36afca 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -291,3 +291,7 @@ Profile_GetNameW @291 Profile_GetPathA @292 Profile_GetPathW @293 Profile_SetDefault @294 +DestroyDbInstance @295 +FindDatabasePlugin @296 +InitDbInstance @297 +RegisterDatabasePlugin @298 -- cgit v1.2.3