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 --- bin10/lib/mir_app.lib | Bin 77722 -> 78654 bytes bin10/lib/mir_app64.lib | Bin 74722 -> 75580 bytes bin12/lib/mir_app.lib | Bin 77722 -> 78654 bytes bin12/lib/mir_app64.lib | Bin 74722 -> 75580 bytes bin14/lib/mir_app.lib | Bin 77722 -> 78654 bytes bin14/lib/mir_app64.lib | Bin 74722 -> 75580 bytes include/m_db_int.h | 44 +++++++++--------------------------------- src/mir_app/src/db_intf.cpp | 40 +++++++++++++------------------------- src/mir_app/src/mir_app.def | 4 ++++ src/mir_app/src/mir_app64.def | 4 ++++ 10 files changed, 30 insertions(+), 62 deletions(-) diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib index b4cd3dad81..bf16b8891a 100644 Binary files a/bin10/lib/mir_app.lib and b/bin10/lib/mir_app.lib differ diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib index 4219f8dbce..5a7ff9981b 100644 Binary files a/bin10/lib/mir_app64.lib and b/bin10/lib/mir_app64.lib differ diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib index b4cd3dad81..bf16b8891a 100644 Binary files a/bin12/lib/mir_app.lib and b/bin12/lib/mir_app.lib differ diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib index 4219f8dbce..5a7ff9981b 100644 Binary files a/bin12/lib/mir_app64.lib and b/bin12/lib/mir_app64.lib differ diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib index b4cd3dad81..bf16b8891a 100644 Binary files a/bin14/lib/mir_app.lib and b/bin14/lib/mir_app.lib differ diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib index 4219f8dbce..5a7ff9981b 100644 Binary files a/bin14/lib/mir_app64.lib and b/bin14/lib/mir_app64.lib differ diff --git a/include/m_db_int.h b/include/m_db_int.h index 806dc3a06f..498dcf568d 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -225,51 +225,25 @@ struct DATABASELINK EXTERN_C MIR_CORE_DLL(DBCachedContact*) db_get_contact(MCONTACT); /////////////////////////////////////////////////////////////////////////////// -// Database list's services +// Database list's functions EXTERN_C MIR_CORE_DLL(MIDatabase*) db_get_current(void); -// MS_DB_REGISTER_PLUGIN : registers a database plugin -// wParam : 0 (unused) -// lParam : DATABASELINK* = database link description +// registers a database plugin -#define MS_DB_REGISTER_PLUGIN "DB/RegisterPlugin" +EXTERN_C MIR_APP_DLL(void) RegisterDatabasePlugin(DATABASELINK *pDescr); -__forceinline void RegisterDatabasePlugin(DATABASELINK* pDescr) -{ CallService(MS_DB_REGISTER_PLUGIN, 0, (LPARAM)pDescr); -} - -// MS_DB_FIND_PLUGIN : looks for a database plugin suitable to open this file -// wParam : 0 (unused) -// lParam : const wchar_t* = name of the database file +// looks for a database plugin suitable to open this file // returns DATABASELINK* of the required plugin or NULL on error -#define MS_DB_FIND_PLUGIN "DB/FindPlugin" - -__forceinline DATABASELINK* FindDatabasePlugin(const wchar_t* ptszFileName) -{ return (DATABASELINK*)CallService(MS_DB_FIND_PLUGIN, 0, (LPARAM)ptszFileName); -} - -// MS_DB_INIT_INSTANCE : initializes a database instance -// wParam : 0 (unused) -// lParam : MIDatabase* = pointer to a database instance -// returns 0 - -#define MS_DB_INIT_INSTANCE "DB/InitDbInstance" +EXTERN_C MIR_APP_DLL(DATABASELINK*) FindDatabasePlugin(const wchar_t *ptszFileName); -__forceinline void InitDbInstance(MIDatabase* pDatabase) -{ CallService(MS_DB_INIT_INSTANCE, 0, (LPARAM)pDatabase); -} +// initializes a database instance -// MS_DB_DESTROY_INSTANCE : destroys a database instance -// wParam : 0 (unused) -// lParam : MIDatabase* = pointer to a database instance -// returns 0 +EXTERN_C MIR_APP_DLL(void) InitDbInstance(MIDatabase *pDatabase); -#define MS_DB_DESTROY_INSTANCE "DB/DestroyDbInstance" +// destroys a database instance -__forceinline void DestroyDbInstance(MIDatabase* pDatabase) -{ CallService(MS_DB_DESTROY_INSTANCE, 0, (LPARAM)pDatabase); -} +EXTERN_C MIR_APP_DLL(void) DestroyDbInstance(MIDatabase *pDatabase); #endif // M_DB_INT_H__ 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