diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-02 18:37:29 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-02 18:37:29 +0000 |
commit | 8a1836d5bfac6c478f26cc0ffa4d70f1d40368c8 (patch) | |
tree | 277e7b0cc31444086bd3b4e6fb9f7bdedf85a30b | |
parent | 554018a71f5591d35480cc04f3e3c8488bc6a366 (diff) |
internal function removed from the public API
git-svn-id: http://svn.miranda-ng.org/main/trunk@723 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_core.h | 1 | ||||
-rw-r--r-- | plugins/Mir_core/mir_core.def | 1 | ||||
-rw-r--r-- | plugins/Mir_core/modules.cpp | 31 | ||||
-rw-r--r-- | plugins/Sessions/Src/Main.cpp | 9 | ||||
-rw-r--r-- | src/modules/json/libJSON.cpp | 7 | ||||
-rw-r--r-- | src/modules/netlib/netliblog.cpp | 2 | ||||
-rw-r--r-- | src/modules/netlib/netlibsock.cpp | 4 | ||||
-rw-r--r-- | src/modules/plugins/pluginopts.cpp | 4 |
8 files changed, 28 insertions, 31 deletions
diff --git a/include/m_core.h b/include/m_core.h index c3b7b68ebd..eddbe7ce74 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -130,7 +130,6 @@ MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name); MIR_CORE_DLL(int) DestroyHookableEvent(HANDLE hEvent);
MIR_CORE_DLL(int) SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook);
MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam);
-MIR_CORE_DLL(int) CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
MIR_CORE_DLL(int) NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
MIR_CORE_DLL(HANDLE) HookEvent(const char* name, MIRANDAHOOK hookProc);
diff --git a/plugins/Mir_core/mir_core.def b/plugins/Mir_core/mir_core.def index e0cefde13b..6411108a72 100644 --- a/plugins/Mir_core/mir_core.def +++ b/plugins/Mir_core/mir_core.def @@ -6,7 +6,6 @@ CallProtoService @2 LangPackLookupUuid @3 NONAME
LangPackMarkPluginLoaded @4 NONAME
CallFunctionAsync @5
-CallHookSubscribers @6
CallPluginEventHook @7
CallService @8
CallServiceSync @9
diff --git a/plugins/Mir_core/modules.cpp b/plugins/Mir_core/modules.cpp index 6c023891a8..85e505684b 100644 --- a/plugins/Mir_core/modules.cpp +++ b/plugins/Mir_core/modules.cpp @@ -193,13 +193,12 @@ MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wPa return returnVal;
}
-MIR_CORE_DLL(int) CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam)
+static int CallHookSubscribers(THook* p, WPARAM wParam, LPARAM lParam)
{
- int returnVal = 0;
- THook* p = (THook*)hEvent;
if (p == NULL)
return -1;
+ int returnVal = 0;
EnterCriticalSection(&p->csHook);
// NOTE: We've got the critical section while all this lot are called. That's mostly safe, though.
@@ -227,25 +226,26 @@ MIR_CORE_DLL(int) CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lPara return returnVal;
}
-__forceinline bool checkHook(HANDLE hHook, bool& bIsValid)
+enum { hookOk, hookEmpty, hookInvalid };
+
+__forceinline int checkHook(THook* p)
{
- THook* p = (THook*)hHook;
if (p == NULL)
- return false;
+ return hookInvalid;
- bool ret;
+ int ret;
__try
{
if (p->secretSignature != HOOK_SECRET_SIGNATURE)
- bIsValid = ret = false;
+ ret = hookInvalid;
else if (p->subscriberCount == 0 && p->pfnHook == NULL)
- bIsValid = true, ret = false;
+ ret = hookEmpty;
else
- ret = true;
+ ret = hookOk;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
- bIsValid = ret = false;
+ ret = hookInvalid;
}
return ret;
@@ -260,12 +260,13 @@ static void CALLBACK HookToMainAPCFunc(ULONG_PTR dwParam) MIR_CORE_DLL(int) NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
- bool bIsValid;
- if ( !checkHook(hEvent, bIsValid))
- return (bIsValid) ? 0 : -1;
+ switch ( checkHook((THook*)hEvent)) {
+ case hookInvalid: return -1;
+ case hookEmpty: return 0;
+ }
if ( GetCurrentThreadId() == mainThreadId)
- return CallHookSubscribers(hEvent, wParam, lParam);
+ return CallHookSubscribers((THook*)hEvent, wParam, lParam);
mir_ptr<THookToMainThreadItem> item;
item->hDoneEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 8d236072ab..f6c1b8936a 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -1068,11 +1068,10 @@ BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved) extern "C" __declspec(dllexport) int Load(void)
{
-
mir_getLP(&pluginInfo);
- hEventDbPluginsLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
- hEventDbOkToExit=HookEvent(ME_SYSTEM_OKTOEXIT,OkToExit);
- hEventDbPreShutdown=HookEvent(ME_SYSTEM_PRESHUTDOWN,SessionPreShutdown);
+ hEventDbPluginsLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
+ hEventDbOkToExit = HookEvent(ME_SYSTEM_OKTOEXIT,OkToExit);
+ hEventDbPreShutdown= HookEvent(ME_SYSTEM_PRESHUTDOWN,SessionPreShutdown);
return 0;
-}
\ No newline at end of file +}
diff --git a/src/modules/json/libJSON.cpp b/src/modules/json/libJSON.cpp index a84d7bf7c0..0312898299 100644 --- a/src/modules/json/libJSON.cpp +++ b/src/modules/json/libJSON.cpp @@ -195,9 +195,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. JSONNODE * json_new_b(const json_char * name, int value){ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_b"), name = EMPTY_CSTRING;); #ifdef JSON_MEMORY_CALLBACKS - return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, (bool)value)); + return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, value != 0 )); #else - return MANAGER_INSERT(new JSONNode(name, (bool)value)); + return MANAGER_INSERT(new JSONNode(name, (bool)value)) != 0; #endif } @@ -242,7 +242,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void json_set_b(JSONNODE * node, int value){ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_b"), return;); - *((JSONNode*)node) = (bool)value; + *((JSONNode*)node) = value != 0; } void json_set_n(JSONNODE * node, const JSONNODE * orig){ @@ -251,7 +251,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *((JSONNode*)node) = *((JSONNode*)orig); } - //inspectors char json_type(const JSONNODE * node){ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_type"), return JSON_NULL;); diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 3e1265d4dd..5e312b9133 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -398,7 +398,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) }
LOGMSG logMsg = { szHead, pszMsg };
- CallHookSubscribers(hLogEvent, (WPARAM)nlu, (LPARAM)&logMsg);
+ NotifyEventHooks(hLogEvent, (WPARAM)nlu, (LPARAM)&logMsg);
SetLastError(dwOriginalLastError);
return 1;
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index 30db9ce256..badc1fe0ca 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -59,7 +59,7 @@ INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam) NetlibLeaveNestedCS(&nlc->ncsSend);
NETLIBNOTIFY nln = { nlb, result };
- CallHookSubscribers(hSendEvent, (WPARAM)&nln, (LPARAM)&nlc->nlu->user);
+ NotifyEventHooks(hSendEvent, (WPARAM)&nln, (LPARAM)&nlc->nlu->user);
return result;
}
@@ -95,7 +95,7 @@ INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam) if ((nlb->flags & MSG_PEEK) == 0) {
NETLIBNOTIFY nln = { nlb, recvResult };
- CallHookSubscribers(hRecvEvent, (WPARAM)&nln, (LPARAM)&nlc->nlu->user);
+ NotifyEventHooks(hRecvEvent, (WPARAM)&nln, (LPARAM)&nlc->nlu->user);
}
return recvResult;
}
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index a62dc08378..83a3c2f4c5 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -167,7 +167,7 @@ LBL_Error: goto LBL_Error;
dat->hInst = pPlug->bpi.hInst;
- CallHookSubscribers(hevLoadModule, (WPARAM)pPlug->bpi.InfoEx, (LPARAM)pPlug->bpi.hInst);
+ NotifyEventHooks(hevLoadModule, (WPARAM)pPlug->bpi.InfoEx, (LPARAM)pPlug->bpi.hInst);
return TRUE;
}
@@ -184,7 +184,7 @@ static int UnloadPluginDynamically(PluginListItemData* dat) if (CallPluginEventHook(pPlug->bpi.hInst, hOkToExitEvent, 0, 0) != 0)
return FALSE;
- CallHookSubscribers(hevUnloadModule, (WPARAM)pPlug->bpi.InfoEx, (LPARAM)pPlug->bpi.hInst);
+ NotifyEventHooks(hevUnloadModule, (WPARAM)pPlug->bpi.InfoEx, (LPARAM)pPlug->bpi.hInst);
CallPluginEventHook(pPlug->bpi.hInst, hPreShutdownEvent, 0, 0);
CallPluginEventHook(pPlug->bpi.hInst, hShutdownEvent, 0, 0);
|