From dd1460d664f7266920b07527f25f87ec8233daaf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 25 Sep 2013 10:58:24 +0000 Subject: valid options initialization git-svn-id: http://svn.miranda-ng.org/main/trunk@6225 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdaway/sendmsg.cpp | 3 +-- src/core/stdchat/src/options.cpp | 4 +--- src/core/stdclist/src/clcopts.cpp | 7 +------ src/core/stdclist/src/clistopts.cpp | 3 +-- src/core/stdclist/src/cluiopts.cpp | 4 +--- src/core/stdfile/fileopts.cpp | 3 +-- src/core/stdidle/idle.cpp | 3 +-- src/core/stduserinfo/stdinfo.cpp | 5 +---- src/modules/clist/clcutils.cpp | 15 ++++----------- src/modules/clist/contacts.cpp | 3 +-- src/modules/clist/genmenuopt.cpp | 3 +-- src/modules/extraicons/options_ei.cpp | 4 +--- src/modules/fonts/FontOptions.cpp | 3 +-- src/modules/icolib/skin2opts.cpp | 3 +-- src/modules/ignore/ignore.cpp | 3 +-- src/modules/netlib/netlibopts.cpp | 4 +--- src/modules/plugins/pluginopts.cpp | 3 +-- src/modules/skin/hotkey_opts.cpp | 3 +-- src/modules/skin/sounds.cpp | 3 +-- src/modules/visibility/visibility.cpp | 3 +-- 20 files changed, 23 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/core/stdaway/sendmsg.cpp b/src/core/stdaway/sendmsg.cpp index e9119d4eda..b981615f65 100644 --- a/src/core/stdaway/sendmsg.cpp +++ b/src/core/stdaway/sendmsg.cpp @@ -534,8 +534,7 @@ static int AwayMsgOptInitialise(WPARAM wParam, LPARAM) if (protoModeMsgFlags == 0) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 870000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AWAYMSG); diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 96dc9f1cf3..65a41422ff 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -903,9 +903,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam static int OptionsInitialize(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1); diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index 5b3bd0e4fa..62ddcc3626 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -421,11 +421,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int ClcOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp; - - ZeroMemory(&odp, sizeof(odp)); - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszGroup = LPGEN("Contact List"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC); @@ -439,7 +435,6 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcClcBkgOpts; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index 8191f2c7b6..77727d539c 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -234,8 +234,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int CListOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -1000000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST); diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 4552b10015..c93baae470 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -320,9 +320,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L int CluiOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI); odp.pszTitle = LPGEN("Window"); diff --git a/src/core/stdfile/fileopts.cpp b/src/core/stdfile/fileopts.cpp index a19a912e6a..26baee16ff 100644 --- a/src/core/stdfile/fileopts.cpp +++ b/src/core/stdfile/fileopts.cpp @@ -230,8 +230,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L int FileOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILETRANSFER); diff --git a/src/core/stdidle/idle.cpp b/src/core/stdidle/idle.cpp index 4881c0f592..5dff57cefc 100644 --- a/src/core/stdidle/idle.cpp +++ b/src/core/stdidle/idle.cpp @@ -416,8 +416,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L static int IdleOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IDLE); diff --git a/src/core/stduserinfo/stdinfo.cpp b/src/core/stduserinfo/stdinfo.cpp index 9858bf59b1..5ef8310ce6 100644 --- a/src/core/stduserinfo/stdinfo.cpp +++ b/src/core/stduserinfo/stdinfo.cpp @@ -580,11 +580,8 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) if (GetContactProto((HANDLE)lParam) == 0) return 0; - OPTIONSDIALOGPAGE odp; - odp.cbSize = sizeof(odp); - odp.hIcon = NULL; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; - odp.flags = 0; odp.pfnDlgProc = SummaryDlgProc; odp.position = -2100000000; diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 4de2705787..e6ad8acf57 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -67,7 +67,6 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ClcContact *hitcontact = NULL; ClcGroup *hitgroup = NULL; int indent, i; - HFONT hFont; DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); if (flags) @@ -79,20 +78,16 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ClientToScreen(hwnd, &pt); HWND hwndParent = hwnd, hwndTemp; - do - { + do { hwndTemp = hwndParent; hwndParent = (HWND)GetWindowLongPtr(hwndTemp, GWLP_HWNDPARENT); POINT pt1 = pt; ScreenToClient(hwndParent, &pt1); - HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), - pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); + HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); if (h != hwndTemp) - { if ( !hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX)) return -1; - } } while (hwndParent); @@ -164,11 +159,9 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * return hit; } } + HDC hdc = GetDC(hwnd); - if (hitcontact->type == CLCIT_GROUP) - hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont); - else - hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont); + HFONT hFont = (HFONT)SelectObject(hdc, dat->fontInfo[hitcontact->type == CLCIT_GROUP ? FONTID_GROUPS : FONTID_CONTACTS].hFont); SIZE textSize; GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize); diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index ff2763964c..cc95f496c6 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -487,8 +487,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara static int ContactOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -1000000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACT); diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 8c4b35dafe..d290d4cd7f 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -857,8 +857,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int GenMenuOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.position = -1000000000; diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp index 81d5a3f7bf..38ce9bb2b3 100644 --- a/src/modules/extraicons/options_ei.cpp +++ b/src/modules/extraicons/options_ei.cpp @@ -742,8 +742,7 @@ int InitOptionsCallback(WPARAM wParam, LPARAM lParam) if (GetNumberOfSlots() < 1) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszGroup = LPGEN("Contact List"); odp.pszTitle = LPGEN("Extra icons"); @@ -752,6 +751,5 @@ int InitOptionsCallback(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_EI_OPTIONS); odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 694eb01ad9..820090b3ac 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -1255,8 +1255,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, int OptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS); diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 261f239ce7..093317a516 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -1037,8 +1037,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int SkinOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS; odp.position = -180000000; diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index 5e07e69bfa..b7e2ca1728 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -323,8 +323,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM static int IgnoreOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IGNORE); diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index b165f55156..1c81da3c41 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -512,9 +512,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) if (optionsCount == 0) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NETLIB); diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 5d0aced019..6e3a88d6a3 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -479,8 +479,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar int PluginOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pfnDlgProc = DlgPluginOpt; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PLUGINS); diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index 21372b1eec..6f524e422a 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -997,8 +997,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, int HotkeyOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS; odp.position = -180000000; diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index a4f5c52bcb..e73a73d0bd 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -433,8 +433,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM static int SkinOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -200000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SOUND); diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index a2a0f71c88..0bd0c007c0 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -278,8 +278,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP static int VisibilityOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 850000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VISIBILITY); -- cgit v1.2.3