summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory/src/Options.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/BasicHistory/src/Options.cpp
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff)
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BasicHistory/src/Options.cpp')
-rw-r--r--plugins/BasicHistory/src/Options.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index 15656791ae..0e472145b7 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -223,11 +223,11 @@ static HotkeyOptionsList g_HotkeyOptionsList[] = {
{ "basichistory_hot_impdat", LPGENT("Import From Dat (mContacts)"), LPGENT("History"), 0, 0, HISTORY_HK_IMPDAT },
};
-const int g_fontsSize = SIZEOF(g_FontOptionsList);
+const int g_fontsSize = _countof(g_FontOptionsList);
-const int g_colorsSize = SIZEOF(g_ColorOptionsList);
+const int g_colorsSize = _countof(g_ColorOptionsList);
-const int g_hotkeysSize = SIZEOF(g_HotkeyOptionsList);
+const int g_hotkeysSize = _countof(g_HotkeyOptionsList);
void Options::Load(void)
{
@@ -247,7 +247,7 @@ void Options::Load(void)
fid.deffontsettings.colour = g_FontOptionsList[i].defColour;
fid.deffontsettings.style = g_FontOptionsList[i].defStyle;
fid.deffontsettings.charset = DEFAULT_CHARSET;
- mir_snprintf(fid.prefix, SIZEOF(fid.prefix), "Font%d", i);
+ mir_snprintf(fid.prefix, _countof(fid.prefix), "Font%d", i);
_tcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, _TRUNCATE);
_tcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, _TRUNCATE);
fid.flags = FIDF_DEFAULTVALID | FIDF_CLASSGENERAL | g_FontOptionsList[i].flags;
@@ -258,7 +258,7 @@ void Options::Load(void)
_tcsncpy_s(cid.group, LPGENT("History"), _TRUNCATE);
for (int i = 0; i < g_colorsSize; ++i) {
_tcsncpy_s(cid.name, g_ColorOptionsList[i].tszName, _TRUNCATE);
- mir_snprintf(cid.setting, SIZEOF(cid.setting), "Color%d", i);
+ mir_snprintf(cid.setting, _countof(cid.setting), "Color%d", i);
cid.order = i;
cid.defcolour = g_ColorOptionsList[i].def;
ColourRegisterT(&cid);
@@ -714,7 +714,7 @@ void InitTaskMenuItems();
void SetEventCB(HWND hwndCB, int eventId)
{
- int cpCount = SIZEOF(EventNames);
+ int cpCount = _countof(EventNames);
int selCpIdx = -1;
for (int i = 0; i < cpCount; ++i)
if (EventNames[i].id == eventId)
@@ -769,7 +769,7 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel)
ListBox_AddString(hwndLB, TranslateT("Outgoing events"));
for (std::vector<int>::const_iterator it = sel.events.begin(); it != sel.events.end(); ++it) {
- int cpCount = SIZEOF(EventNames);
+ int cpCount = _countof(EventNames);
int selCpIdx = -1;
for (int i = 0; i < cpCount; ++i)
if (EventNames[i].id == *it)
@@ -805,9 +805,9 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR*
TCHAR extUpper[32];
_tcscpy_s(extUpper, ext);
extUpper[0] = std::toupper(ext[0], loc);
- mir_sntprintf(filter, SIZEOF(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
+ mir_sntprintf(filter, _countof(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
size_t len = mir_tstrlen(filter) + 1;
- mir_sntprintf(filter + len, SIZEOF(filter) - len, _T("*.%s"), ext);
+ mir_sntprintf(filter + len, _countof(filter) - len, _T("*.%s"), ext);
len += mir_tstrlen(filter + len) + 1;
_tcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)"));
len += mir_tstrlen(filter + len) + 1;
@@ -834,7 +834,7 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR*
ofn.nFilterIndex = 1;
ofn.lpstrFile = stzFilePath;
ofn.lpstrTitle = title;
- ofn.nMaxFile = SIZEOF(stzFilePath);
+ ofn.nMaxFile = _countof(stzFilePath);
ofn.lpstrDefExt = ext;
if (open) {
ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
@@ -871,7 +871,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
HWND ftpLog = GetDlgItem(hwndDlg, IDC_WINSCPLOG);
ComboBox_AddString(events, TranslateT("Incoming events"));
ComboBox_AddString(events, TranslateT("Outgoing events"));
- for (int i = 0 ; i < SIZEOF(EventNames); ++i)
+ for (int i = 0 ; i < _countof(EventNames); ++i)
ComboBox_AddString(events, TranslateTS(EventNames[i].name));
ComboBox_AddString(defFilter, TranslateT("Default history events"));
@@ -1702,7 +1702,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
TCHAR sep = _T(':');
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, timeFormat, 10) > 0)
sep = timeFormat[0];
- mir_sntprintf(timeFormat, SIZEOF(timeFormat), _T("HH%cmm"), sep);
+ mir_sntprintf(timeFormat, _countof(timeFormat), _T("HH%cmm"), sep);
}
SYSTEMTIME st;
@@ -1749,7 +1749,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.eventDeltaTime = GetDlgItemInt(hwndDlg, IDC_EVENT_TIME, &isOK, TRUE);
if (!isOK) {
TCHAR msg[256];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1759,7 +1759,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.importType = (enum IImport::ImportType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_IMPORT_TYPE));
toCp.compress = Button_GetCheck(GetDlgItem(hwndDlg, IDC_COMPRESS)) != 0;
char bufC[100];
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, bufC, SIZEOF(bufC));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, bufC, _countof(bufC));
toCp.zipPassword = bufC;
HWND exportPath = GetDlgItem(hwndDlg, IDC_EXPORT_PATH);
int exLen = Edit_GetTextLength(exportPath);
@@ -1780,7 +1780,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!isOK) {
if (toCp.trigerType == TaskOptions::Monthly) {
TCHAR msg[256];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Day"));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Day"));
MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1790,7 +1790,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!isOK) {
if (toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour) {
TCHAR msg[256];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1807,9 +1807,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
if (err.empty())
_tcscpy_s(msg, TranslateT("Some value is invalid"));
else if (errDescr.empty())
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), err.c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), err.c_str());
else
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
break;
}