From 03abc0234e40183256bba3d2b9cdf809d92363f2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 19 Apr 2018 19:04:41 +0300 Subject: minor code cleaning --- plugins/QuickMessages/src/main.cpp | 2 -- plugins/TabSRMM/src/globals.cpp | 4 ---- plugins/TabSRMM/src/stdafx.h | 1 - plugins/TabSRMM/src/themes.cpp | 2 +- protocols/IcqOscarJ/src/icq_rates.cpp | 2 +- protocols/IcqOscarJ/src/init.cpp | 9 --------- protocols/IcqOscarJ/src/stdafx.h | 1 - protocols/MRA/src/Mra.cpp | 10 +--------- protocols/MRA/src/MraAvatars.cpp | 4 ++-- protocols/MRA/src/stdafx.h | 2 +- 10 files changed, 6 insertions(+), 31 deletions(-) diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index 0b70c4aa66..cd9da5c4bc 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -25,7 +25,6 @@ int hLangpack; WNDPROC mainProc; int g_iButtonsCount=0; -int g_bShutDown=0; int g_bStartup=0; BOOL g_bRClickAuto=0; BOOL g_bLClickAuto=0; @@ -46,7 +45,6 @@ PLUGININFOEX pluginInfo = { int PreShutdown(WPARAM, LPARAM) { - g_bShutDown = 1; DestructButtonsList(); return 0; } diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 6ab4e3d396..6935c5f924 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -32,8 +32,6 @@ void Chat_ModulesLoaded(); void CB_InitCustomButtons(); -bool g_bShutdown = false; - CGlobals PluginConfig; static TContainerSettings _cnt_default = { CNT_FLAGS_DEFAULT, CNT_FLAGSEX_DEFAULT, 255, CInfoPanel::DEGRADE_THRESHOLD, 60, 60, L"%n (%s)", 1, 0 }; @@ -450,8 +448,6 @@ int CGlobals::MetaContactEvent(WPARAM hContact, LPARAM) int CGlobals::PreshutdownSendRecv(WPARAM, LPARAM) { - g_bShutdown = true; - ::TN_ModuleDeInit(); ::CloseAllContainers(); diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index 3318f05af7..2e28832839 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -232,7 +232,6 @@ extern char *TemplateNames[]; extern HANDLE hUserPrefsWindowList; extern TCpTable cpTable[]; extern HMODULE g_hIconDLL; -extern bool g_bShutdown; extern pfnDoPopup oldDoPopup, oldLogToFile; extern pfnDoTrayIcon oldDoTrayIcon; diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 1a94eed47f..fb7c3ce8c2 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1172,7 +1172,7 @@ void CSkin::Unload() ::DestroyIcon(*(m_skinIcons[i].phIcon)); mir_free(m_skinIcons); - if (!g_bShutdown) { + if (!Miranda_IsTerminated()) { M.getAeroState(); // refresh after unload ::FreeTabConfig(); ::ReloadTabConfig(); diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp index e2dc3d569f..dfc42bbe7c 100644 --- a/protocols/IcqOscarJ/src/icq_rates.cpp +++ b/protocols/IcqOscarJ/src/icq_rates.cpp @@ -318,7 +318,7 @@ void rates_queue::handleDelay() { SleepEx(scheduledDelay, TRUE); - if (!g_bTerminated) + if (!Miranda_IsTerminated()) processQueue(); } diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 8d21b12056..bf88320592 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -29,7 +29,6 @@ #include "m_icolib.h" int hLangpack; -bool g_bTerminated; BOOL bPopupService = FALSE; @@ -70,12 +69,6 @@ int ModuleLoad(WPARAM, LPARAM) return 0; } -static int OnPreShutdown(WPARAM, LPARAM) -{ - g_bTerminated = true; - return 0; -} - IconItem iconList[] = { { LPGEN("Expand string edit"), "ICO_EXPANDSTRINGEDIT", IDI_EXPANDSTRINGEDIT } @@ -101,8 +94,6 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); - hExtraXStatus = ExtraIcon_RegisterIcolib("xstatus", LPGEN("ICQ xStatus"), "icq_xstatus13"); Icon_Register(g_plugin.getInst(), "ICQ", iconList, _countof(iconList)); diff --git a/protocols/IcqOscarJ/src/stdafx.h b/protocols/IcqOscarJ/src/stdafx.h index 9aefe64717..54f1712620 100644 --- a/protocols/IcqOscarJ/src/stdafx.h +++ b/protocols/IcqOscarJ/src/stdafx.h @@ -117,5 +117,4 @@ #include "icq_popups.h" #include "icq_proto.h" -extern bool g_bTerminated; extern IconItem iconList[]; \ No newline at end of file diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index 58f455fc23..46e06b3be9 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -6,7 +6,7 @@ CLIST_INTERFACE *pcli; HMODULE g_hDLLXStatusIcons; HICON g_hMainIcon; -bool g_bChatExist, g_bShutdown = false; +bool g_bChatExist; size_t g_dwMirWorkDirPathLen; WCHAR g_szMirWorkDirPath[MAX_FILEPATH]; @@ -43,12 +43,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC /////////////////////////////////////////////////////////////////////////////// -static int __cdecl OnPreShutdown(WPARAM, LPARAM) -{ - g_bShutdown = true; - return 0; -} - extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); @@ -56,8 +50,6 @@ extern "C" __declspec(dllexport) int Load(void) IconsLoad(); InitXStatusIcons(); - - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); return 0; } diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index ba2f4fe98c..bbaa46ff86 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -105,7 +105,7 @@ void CMraProto::MraAvatarsQueueDestroy(HANDLE hQueue) DWORD CMraProto::MraAvatarsQueueAdd(HANDLE hQueue, DWORD dwFlags, MCONTACT hContact, DWORD *pdwAvatarsQueueID) { MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hQueue; - if (pmraaqAvatarsQueue == nullptr || g_bShutdown) + if (pmraaqAvatarsQueue == nullptr || Miranda_IsTerminated()) return ERROR_INVALID_HANDLE; MRA_AVATARS_QUEUE_ITEM *pmraaqiAvatarsQueueItem = (MRA_AVATARS_QUEUE_ITEM*)mir_calloc(sizeof(MRA_AVATARS_QUEUE_ITEM)); @@ -152,7 +152,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) pmraaqAvatarsQueue->hThreadEvents[pmraaqAvatarsQueue->iThreadsRunning++] = hThreadEvent; } - while (!g_bShutdown) { + while (!Miranda_IsTerminated()) { if (FifoMTItemPop(pmraaqAvatarsQueue, nullptr, (LPVOID*)&pmraaqiAvatarsQueueItem) != NO_ERROR) { // waiting until service stop or new task NETLIB_CLOSEHANDLE(hConnection); WaitForSingleObjectEx(hThreadEvent, INFINITE, FALSE); diff --git a/protocols/MRA/src/stdafx.h b/protocols/MRA/src/stdafx.h index 6ee9201b4c..54860e5227 100644 --- a/protocols/MRA/src/stdafx.h +++ b/protocols/MRA/src/stdafx.h @@ -159,7 +159,7 @@ extern IconItem gdiExtraStatusIconsItems[]; extern HMODULE g_hDLLXStatusIcons; extern HICON g_hMainIcon; -extern bool g_bChatExist, g_bShutdown; +extern bool g_bChatExist; extern size_t g_dwMirWorkDirPathLen; extern WCHAR g_szMirWorkDirPath[MAX_FILEPATH]; -- cgit v1.2.3