diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-28 14:21:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-28 14:21:33 +0300 |
commit | eccbb5307a048e70ac4adb0d3fd333be28245fa8 (patch) | |
tree | a9a2c92c13391a5cf288c9e0d841833c54f3cd5e /src | |
parent | 6a9e3738066370dac38f5f6768b8a6f61fe709e0 (diff) |
massive cleanup of useless cbSize fields
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/cmdlist.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 16 | ||||
-rw-r--r-- | src/mir_app/src/meta_services.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/meta_utils.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/srmm_statusicon.cpp | 11 |
5 files changed, 17 insertions, 16 deletions
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index d334eb19ef..9c615e3271 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -100,7 +100,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *sz dbei.cbBlob = (DWORD)(mir_strlen(p->szMsg) + 1);
dbei.pBlob = (PBYTE)p->szMsg;
- MessageWindowEvent evt = { sizeof(evt), id, hContact, &dbei };
+ MessageWindowEvent evt = { id, hContact, &dbei };
NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
p->szMsg = (char*)dbei.pBlob;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 0c049ff6f6..48b8832a70 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -30,7 +30,7 @@ const CLSID IID_IRichEditOleCallback = { 0x00020D03, 0x00, 0x00, { 0xC0, 0x00, 0 int OnCheckPlugins(WPARAM, LPARAM);
-HANDLE hHookWinEvt, hHookWinPopup, hHookWinWrite;
+HANDLE hHookWinPopup, hHookWinWrite;
HGENMENU hMsgMenuItem;
HMODULE hMsftEdit;
@@ -479,6 +479,10 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam)
{
+ StatusTextData *st = (StatusTextData*)lParam;
+ if (st == NULL)
+ return 1;
+
HWND hwnd = WindowList_Find(pci->hWindowList, wParam);
if (hwnd == NULL)
return 1;
@@ -487,10 +491,6 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) if (dat == NULL)
return 1;
- StatusTextData *st = (StatusTextData*)lParam;
- if (st != NULL && st->cbSize != sizeof(StatusTextData))
- return 1;
-
dat->SetStatusData(st);
return 0;
}
@@ -498,11 +498,11 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
- if (mwid == NULL || (mwid->cbSize != sizeof(MessageWindowInputData)) || (mwid->hContact == NULL) || (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH))
+ if (mwid == NULL || mwid->hContact == 0 || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)
return 1;
MessageWindowData *mwd = (MessageWindowData*)lParam;
- if(mwd == NULL || (mwd->cbSize != sizeof(MessageWindowData)))
+ if(mwd == NULL)
return 1;
HWND hwnd = WindowList_Find(pci->hWindowList, mwid->hContact);
@@ -547,7 +547,6 @@ int LoadSendRecvMessageModule(void) CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText);
CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
- hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
@@ -565,7 +564,6 @@ int LoadSendRecvMessageModule(void) void SplitmsgShutdown(void)
{
- DestroyHookableEvent(hHookWinEvt);
DestroyHookableEvent(hHookWinPopup);
DestroyHookableEvent(hHookWinWrite);
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<StatusIconMain> 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);
|