From eccbb5307a048e70ac4adb0d3fd333be28245fa8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 28 Mar 2017 14:21:33 +0300 Subject: massive cleanup of useless cbSize fields --- src/mir_app/src/meta_services.cpp | 2 +- src/mir_app/src/meta_utils.cpp | 2 +- src/mir_app/src/srmm_statusicon.cpp | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 327136abbb..5943c196cc 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -645,7 +645,7 @@ int Meta_ModulesLoaded(WPARAM, LPARAM) InitMenus(); // create srmm icon - StatusIconData sid = { sizeof(sid) }; + StatusIconData sid = {}; sid.szModule = META_PROTO; sid.flags = MBF_UNICODE; sid.tszTooltip = LPGENW("Select metacontact"); diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index 1192b28693..4ae42c329b 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -545,7 +545,7 @@ void Meta_FixStatus(DBCachedContact *ccMeta) void Meta_UpdateSrmmIcon(DBCachedContact *ccMeta, int) { - StatusIconData sid = { sizeof(sid) }; + StatusIconData sid = {}; sid.szModule = META_PROTO; sid.flags = (ccMeta->IsMeta()) ? 0 : MBF_HIDDEN; Srmm_ModifyIcon(ccMeta->contactID, &sid); diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp index 9b2f37207f..f7887095fe 100644 --- a/src/mir_app/src/srmm_statusicon.cpp +++ b/src/mir_app/src/srmm_statusicon.cpp @@ -79,13 +79,13 @@ static int CompareIcons(const StatusIconMain *p1, const StatusIconMain *p2) static OBJLIST arIcons(3, CompareIcons); -static HANDLE hHookIconsChanged; +HANDLE hHookIconsChanged, hHookSrmmEvent; ///////////////////////////////////////////////////////////////////////////////////////// MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack) { - if (sid == nullptr || sid->cbSize != sizeof(StatusIconData)) + if (sid == nullptr) return 1; StatusIconMain *p = arIcons.find((StatusIconMain*)sid); @@ -110,7 +110,7 @@ MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack) MIR_APP_DLL(int) Srmm_ModifyIcon(MCONTACT hContact, StatusIconData *sid) { - if (sid == nullptr || sid->cbSize != sizeof(StatusIconData)) + if (sid == nullptr) return 1; StatusIconMain *p = arIcons.find((StatusIconMain*)sid); @@ -151,7 +151,7 @@ MIR_APP_DLL(int) Srmm_ModifyIcon(MCONTACT hContact, StatusIconData *sid) MIR_APP_DLL(void) Srmm_RemoveIcon(const char *szProto, DWORD iconId) { - StatusIconData tmp = { sizeof(tmp), (char*)szProto, iconId }; + StatusIconData tmp = { (char*)szProto, iconId }; StatusIconMain *p = arIcons.find((StatusIconMain*)&tmp); if (p != nullptr) arIcons.remove(p); @@ -211,6 +211,7 @@ int LoadSrmmModule() LoadSrmmToolbarModule(); + hHookSrmmEvent = CreateHookableEvent(ME_MSG_WINDOWEVENT); hHookIconsChanged = CreateHookableEvent(ME_MSG_ICONSCHANGED); return 0; } @@ -219,7 +220,9 @@ void UnloadSrmmModule() { arIcons.destroy(); NotifyEventHooks(hHookIconsChanged, 0, 0); + DestroyHookableEvent(hHookIconsChanged); + DestroyHookableEvent(hHookSrmmEvent); DestroyCursor(g_hCurHyperlinkHand); -- cgit v1.2.3