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/WhoUsesMyFiles/src/list.cpp | 2 +- plugins/WhoUsesMyFiles/src/wumf.cpp | 2 +- plugins/WhoUsesMyFiles/src/wumfplug.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins/WhoUsesMyFiles/src') diff --git a/plugins/WhoUsesMyFiles/src/list.cpp b/plugins/WhoUsesMyFiles/src/list.cpp index 48d4bf80e7..89246dc052 100644 --- a/plugins/WhoUsesMyFiles/src/list.cpp +++ b/plugins/WhoUsesMyFiles/src/list.cpp @@ -24,7 +24,7 @@ PWumf new_wumf( DWORD dwID, case PERM_FILE_CREATE: mir_tstrcpy(w->szPerm, _T("Create"));break; default: mir_tstrcpy(w->szPerm, _T("Execute")); } - mir_sntprintf(w->szID, SIZEOF(w->szID), _T("%i"), dwID); + mir_sntprintf(w->szID, _countof(w->szID), _T("%i"), dwID); w->dwID = dwID; w->dwSess = dwSess; diff --git a/plugins/WhoUsesMyFiles/src/wumf.cpp b/plugins/WhoUsesMyFiles/src/wumf.cpp index 034d84f460..3eb22eb46d 100644 --- a/plugins/WhoUsesMyFiles/src/wumf.cpp +++ b/plugins/WhoUsesMyFiles/src/wumf.cpp @@ -148,7 +148,7 @@ void LogWumf(PWumf w) hLogger = mir_createLog("wumf", _T("WhoIsUsingMyFiles log file"), WumfOptions.LogFile, 0); if (hLogger == NULL) { TCHAR str[256]; - mir_sntprintf(str, SIZEOF(str), _T("Can't open log file %s"), WumfOptions.LogFile); + mir_sntprintf(str, _countof(str), _T("Can't open log file %s"), WumfOptions.LogFile); MessageBox(NULL, str, TranslateT("Error opening file"), MB_OK | MB_ICONSTOP); WumfOptions.LogToFile = FALSE; return; diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index 839d7b5752..3e7a5a1d9d 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -119,7 +119,7 @@ void ShowWumfPopup(PWumf w) TCHAR text[512], title[512]; if (!WumfOptions.AlertFolders && (w->dwAttr & FILE_ATTRIBUTE_DIRECTORY)) return; - mir_sntprintf(title, SIZEOF(title), _T("%s (%s)"), w->szComp, w->szUser); + mir_sntprintf(title, _countof(title), _T("%s (%s)"), w->szComp, w->szUser); mir_sntprintf(text, _T("%s (%s)"), w->szPath, w->szPerm); ShowThePopup(w, title, text); } @@ -266,7 +266,7 @@ void ChooseFile(HWND hDlg) ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hDlg; ofn.lpstrFile = szFile; - ofn.nMaxFile = SIZEOF(szFile); + ofn.nMaxFile = _countof(szFile); ofn.lpstrFilter = _T("All files (*.*)\0*.*\0Text files (*.txt)\0*.txt\0Log files (*.log)\0*.log\0\0"); ofn.nFilterIndex = 2; ofn.Flags = OFN_CREATEPROMPT; @@ -281,7 +281,7 @@ void ChooseFile(HWND hDlg) } else if (CommDlgExtendedError() != 0) { TCHAR str[256]; - mir_sntprintf(str, SIZEOF(str), TranslateT("Common Dialog Error 0x%lx"), CommDlgExtendedError()); + mir_sntprintf(str, _countof(str), TranslateT("Common Dialog Error 0x%lx"), CommDlgExtendedError()); MessageBox(hDlg, str, TranslateT("Error"), MB_OK | MB_ICONSTOP); } } @@ -413,7 +413,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_FILE: - GetDlgItemText(hwndDlg,IDC_FILE,WumfOptions.LogFile, SIZEOF(WumfOptions.LogFile)); + GetDlgItemText(hwndDlg,IDC_FILE,WumfOptions.LogFile, _countof(WumfOptions.LogFile)); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } @@ -453,7 +453,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara db_set_b(NULL, MODULENAME, ALERT_UNC, (BYTE)WumfOptions.AlertUNC); db_set_b(NULL, MODULENAME, LOG_COMP, (BYTE)WumfOptions.LogComp); db_set_b(NULL, MODULENAME, ALERT_COMP, (BYTE)WumfOptions.AlertComp); - GetDlgItemText(hwndDlg, IDC_FILE, WumfOptions.LogFile, SIZEOF(WumfOptions.LogFile)); + GetDlgItemText(hwndDlg, IDC_FILE, WumfOptions.LogFile, _countof(WumfOptions.LogFile)); db_set_ts(NULL, MODULENAME, OPT_FILE, WumfOptions.LogFile); } } -- cgit v1.2.3