From 391980ce1e890445542441eeb5d9f9cc18ae1baf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Jan 2018 22:31:20 +0300 Subject: code optimization --- src/core/stdclist/src/clcopts.cpp | 14 +++++--------- src/core/stdclist/src/contact.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src/core/stdclist') diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index 7b889c2a21..932e546e52 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -149,12 +149,9 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); { - int i; DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle()); - for (i = 0; i < _countof(checkBoxToStyleEx); i++) - CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id, - (exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag * - checkBoxToStyleEx[i].not) ? BST_CHECKED : BST_UNCHECKED); + for (auto &it : checkBoxToStyleEx) + CheckDlgButton(hwndDlg, it.id, (exStyle & it.flag) ^ (it.flag * it.not) ? BST_CHECKED : BST_UNCHECKED); } { UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } }; @@ -242,11 +239,10 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam case 0: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - int i; DWORD exStyle = 0; - for (i = 0; i < _countof(checkBoxToStyleEx); i++) - if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not) - exStyle |= checkBoxToStyleEx[i].flag; + for (auto &it : checkBoxToStyleEx) + if ((IsDlgButtonChecked(hwndDlg, it.id) == 0) == it.not) + exStyle |= it.flag; db_set_dw(NULL, "CLC", "ExStyle", exStyle); { diff --git a/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp index b3b46976a5..d03630e45b 100644 --- a/src/core/stdclist/src/contact.cpp +++ b/src/core/stdclist/src/contact.cpp @@ -44,10 +44,10 @@ static statusModeOrder[] = { int GetStatusModeOrdering(int statusMode) { - int i; - for (i = 0; i < _countof(statusModeOrder); i++) - if (statusModeOrder[i].status == statusMode) - return statusModeOrder[i].order; + for (auto &it : statusModeOrder) + if (it.status == statusMode) + return it.order; + return 1000; } -- cgit v1.2.3