From 30707c980d1560b358dbf2671a4d2a26a1e8173c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 21:45:37 +0000 Subject: various menu initialization quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/icq_menu.cpp | 10 +++------- protocols/IcqOscarJ/src/icq_xstatus.cpp | 12 +++++------- protocols/IcqOscarJ/src/init.cpp | 9 ++------- 3 files changed, 10 insertions(+), 21 deletions(-) (limited to 'protocols/IcqOscarJ/src') diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index 6694b6145b..a5d3d684e5 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -92,8 +92,7 @@ static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam) static void sttEnableMenuItem( HANDLE hMenuItem, bool bEnable ) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; if ( !bEnable ) clmi.flags |= CMIF_HIDDEN; @@ -126,8 +125,7 @@ void g_MenuInit(void) char str[MAXMODULELABELLENGTH], *pszDest = str + 3; strcpy( str, "ICQ" ); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = str; mi.flags = CMIF_ICONFROMICOLIB; @@ -238,9 +236,7 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM) sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0); if (bXStatus && !m_bHideXStatusUI) { - CLISTMENUITEM clmi = {0}; - - clmi.cbSize = sizeof(clmi); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_ICON; if (bXStatus > 0 && bXStatus <= XSTATUS_COUNT) diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index f5b659d867..89b530e607 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -789,12 +789,10 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) { - CLISTMENUITEM mi = {0}; BYTE bOldXStatus = getSettingByte(NULL, DBSETTING_XSTATUS_ID, 0); - mi.cbSize = sizeof(mi); - if (!m_bHideXStatusUI) { + CLISTMENUITEM mi = { sizeof(mi) }; if (bOldXStatus <= XSTATUS_COUNT) { mi.flags = CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hXStatusItems[bOldXStatus], (LPARAM)&mi); @@ -854,8 +852,7 @@ INT_PTR CIcqProto::menuXStatus(WPARAM wParam,LPARAM lParam,LPARAM fParam) void CIcqProto::InitXStatusItems(BOOL bAllowStatus) { - CLISTMENUITEM mi; - int i = 0, len = strlennull(m_szModuleName); + int len = strlennull(m_szModuleName); char srvFce[MAX_PATH + 64]; char szItem[MAX_PATH + 64]; int bXStatusMenuBuilt = 0; @@ -873,12 +870,13 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) return; null_snprintf(szItem, sizeof(szItem), Translate("%s Custom Status"), m_szModuleName); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszPopupName = szItem; mi.popupPosition = 500084000; mi.position = 2000040000; - for (i = 0; i <= XSTATUS_COUNT; i++) { + for (int i = 0; i <= XSTATUS_COUNT; i++) { null_snprintf(srvFce, sizeof(srvFce), "%s/menuXStatus%d", m_szModuleName, i); mi.position++; diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 6ee98fa8bb..de4c5ff4be 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -147,9 +147,7 @@ extern "C" int __declspec(dllexport) Unload(void) void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow) { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; if (bShow) mi.flags = CMIM_FLAGS; else @@ -160,11 +158,8 @@ void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow) static void CListSetMenuItemIcon(HANDLE hMenuItem, HICON hIcon) { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIM_ICON; - mi.hIcon = hIcon; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi); } -- cgit v1.2.3