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/FloatingContacts/src/filedrop.cpp | 4 ++-- plugins/FloatingContacts/src/main.cpp | 4 ++-- plugins/FloatingContacts/src/options.cpp | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'plugins/FloatingContacts') diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index 38f688381e..4280ed8f61 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -202,7 +202,7 @@ static int CountFiles(char *szItem) if (NULL != strstr(szItem, "*.*")) { size_t offset = mir_strlen(szDirName) - 3; - mir_snprintf(szDirName + offset, SIZEOF(szDirName) - offset, "%s\0", fd.cFileName); + mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName); } ++nCount; @@ -237,7 +237,7 @@ static void SaveFiles(char *szItem, char **ppFiles, int *pnCount) if (NULL != strstr(szItem, "*.*")) { size_t offset = mir_strlen(szDirName) - 3; - mir_snprintf(szDirName + offset, SIZEOF(szDirName) - offset, "%s\0", fd.cFileName); + mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName); } ppFiles[*pnCount] = _strdup(szDirName); diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 0a5fd39e64..35c42ab534 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -908,7 +908,7 @@ extern "C" int __declspec(dllexport) Load() InitOptions(); - for (int i = 0; i < SIZEOF(s_fonts); i++) { + for (int i = 0; i < _countof(s_fonts); i++) { LOGFONT lf; SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, FALSE); if (i == FLT_FONTID_OFFINVIS || i == FLT_FONTID_INVIS) @@ -917,7 +917,7 @@ extern "C" int __declspec(dllexport) Load() COLORREF defColor = GetSysColor((i == FLT_FONTID_NOTONLIST) ? COLOR_3DSHADOW : COLOR_WINDOWTEXT); char szId[20]; - mir_snprintf(szId, SIZEOF(szId), "Font%d", i); + mir_snprintf(szId, _countof(szId), "Font%d", i); FontService_RegisterFont(MODULE, szId, LPGENT("Floating contacts"), s_fonts[i], NULL, NULL, i + 1, false, &lf, defColor); } diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index 2e0cf20636..3f6a7e8c0d 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -199,7 +199,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETRANGE, TRUE, MAKELONG(0, 100)); SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETPOS, TRUE, btOpacity); - mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", btOpacity); + mir_snprintf(szPercent, _countof(szPercent), "%d%%", btOpacity); SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent); EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != 0); @@ -230,7 +230,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP fcOpt.thumbAlpha = (BYTE)((nPos * 255) / 100); SetThumbsOpacity(fcOpt.thumbAlpha); - mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", nPos); + mir_snprintf(szPercent, _countof(szPercent), "%d%%", nPos); SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } @@ -245,8 +245,8 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP case IDC_BROWSE: { TCHAR str[MAX_PATH], filter[512]; - GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); - Bitmap_GetFilter(filter, SIZEOF(filter)); + GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str)); + Bitmap_GetFilter(filter, _countof(filter)); OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); @@ -254,7 +254,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP ofn.lpstrFilter = filter; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.nMaxFile = SIZEOF(str); + ofn.nMaxFile = _countof(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = _T("bmp"); if (!GetOpenFileName(&ofn)) @@ -302,7 +302,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP db_set_b(NULL, MODULE, "BkUseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); TCHAR str[MAX_PATH]; - GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str)); db_set_ts(NULL, MODULE, "BkBitmap", str); WORD flags = 0; -- cgit v1.2.3