From 4c814798c7bc7f6a0f92c21b027b26290622aa2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 19:35:42 +0000 Subject: SIZEOF replaced with more secure analog - _countof git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/opt_class.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins/Popup/src/opt_class.cpp') diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 5d70ff8e03..6af58caeb9 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -189,13 +189,13 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l for (i = 0; i < gTreeData.getCount(); ++i) { switch (gTreeData[i]->typ) { case 1: // Treeview part for typ 1 (notification) - mir_snprintf(iconName, SIZEOF(iconName), "%s_%S_%S", MODULNAME, gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); + mir_snprintf(iconName, _countof(iconName), "%s_%S_%S", MODULNAME, gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); iconIndex = ImageList_ReplaceIcon(hImgLst, -1, IcoLib_GetIcon(iconName)); - mir_sntprintf(itemName, SIZEOF(itemName), _T("%s/%s"), gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); + mir_sntprintf(itemName, _countof(itemName), _T("%s/%s"), gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); break; case 2: // Treeview part typ 2 (popup class api) iconIndex = ImageList_ReplaceIcon(hImgLst, -1, gTreeData[i]->pupClass.hIcon); - mir_sntprintf(itemName, SIZEOF(itemName), _T("%s/%s"), LPGENT("CLASS Plugins")/*gTreeData[i]->pszTreeRoot*/, gTreeData[i]->pszDescription); + mir_sntprintf(itemName, _countof(itemName), _T("%s/%s"), LPGENT("CLASS Plugins")/*gTreeData[i]->pszTreeRoot*/, gTreeData[i]->pszDescription); break; } OptTree_AddItem(hwndTree, itemName, (LPARAM)gTreeData[i], iconIndex); @@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l OptTree_Translate(hwndTree); // Bold Title - for (i = 0; i < SIZEOF(titleIds); ++i) { + for (i = 0; i < _countof(titleIds); ++i) { LOGFONT lf; GetObject((HFONT)SendDlgItemMessage(hwnd, titleIds[i], WM_GETFONT, 0, 0), sizeof(lf), &lf); lf.lfWeight = FW_BOLD; @@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_LIFETIME_MAX, SETTING_LIFETIME_INFINITE)); SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)0, TRUE); // status buttons - for (i = 0; i < SIZEOF(statusButtons); ++i) { + for (i = 0; i < _countof(statusButtons); ++i) { SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASPUSHBTN, TRUE, 0); SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BM_SETIMAGE, @@ -280,18 +280,18 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l mir_free(psztAction); psztAction = NULL; } // enable all controls - for (i = 0; i < SIZEOF(ctrlsAll); ++i){ + for (i = 0; i < _countof(ctrlsAll); ++i){ ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1); } // enable or disable controls ctrlsEnable - for (i = 0; i < SIZEOF(ctrlsEnable); ++i) + for (i = 0; i < _countof(ctrlsEnable); ++i) EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled ? TRUE : FALSE); // show or hide controls ctrlsContact - for (i = 0; i < SIZEOF(ctrlsContact); ++i) + for (i = 0; i < _countof(ctrlsContact); ++i) ShowWindow(GetDlgItem(hwnd, ctrlsContact[i]), ptd->notification.dwFlags&PNF_CONTACT ? SW_SHOW : SW_HIDE); // statusButtons state - for (i = 0; i < SIZEOF(statusButtons); ++i) + for (i = 0; i < _countof(statusButtons); ++i) CheckDlgButton(hwnd, statusButtons[i].idCtrl, ptd->disableWhen & statusButtons[i].disableWhenFlag ? BST_CHECKED : BST_UNCHECKED); } // element typ2 (CLASS Plugins) @@ -300,7 +300,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)ptd->timeoutValue, TRUE); SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1)); // enable ctrls - for (i = 0; i < SIZEOF(ctrlsAll); ++i){ + for (i = 0; i < _countof(ctrlsAll); ++i){ ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2); } @@ -316,7 +316,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } // end if (tvi.lParam) else { // enable / disable controls - for (int i = 0; i < SIZEOF(ctrlsAll); ++i) { + for (int i = 0; i < _countof(ctrlsAll); ++i) { ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0); } @@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch (idCtrl) { case IDC_ENABLE: ptd->enabled = (BYTE)Button_GetCheck((HWND)lParam); - for (i = 0; i < SIZEOF(ctrlsEnable); ++i) + for (i = 0; i < _countof(ctrlsEnable); ++i) EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; @@ -383,7 +383,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case IDC_SOFFLINE2: case IDC_SONLINE2: case IDC_SAWAY2: case IDC_SNA2: case IDC_SOCCUPIED2: case IDC_SDND2: case IDC_SFREE4CHAT2: case IDC_SINVISIBLE2: case IDC_SPHONE2: case IDC_SLUNCH2: ptd->disableWhen = 0; - for (i = 0; i < SIZEOF(statusButtons); ++i) { + for (i = 0; i < _countof(statusButtons); ++i) { if (IsDlgButtonChecked(hwnd, statusButtons[i].idCtrl)) ptd->disableWhen |= statusButtons[i].disableWhenFlag; if (idCtrl == (UINT)statusButtons[i].idCtrl) -- cgit v1.2.3