summaryrefslogtreecommitdiff
path: root/plugins/Import
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/Import
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/Import')
-rw-r--r--plugins/Import/src/import.cpp6
-rw-r--r--plugins/Import/src/miranda.cpp18
-rw-r--r--plugins/Import/src/utils.cpp6
3 files changed, 15 insertions, 15 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 88aadd22ea..ddaa811273 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -77,7 +77,7 @@ void AddMessage(const TCHAR* fmt, ...)
va_list args;
TCHAR msgBuf[4096];
va_start(args, fmt);
- mir_vsntprintf(msgBuf, SIZEOF(msgBuf), TranslateTS(fmt), args);
+ mir_vsntprintf(msgBuf, _countof(msgBuf), TranslateTS(fmt), args);
SendMessage(hdlgProgress, PROGM_ADDMESSAGE, 0, (LPARAM)msgBuf);
}
@@ -252,7 +252,7 @@ static LRESULT CALLBACK ListWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
r.top--; r.bottom--;
TCHAR tszText[100];
- ListView_GetItemText(hwnd, hit.iItem, 1, tszText, SIZEOF(tszText));
+ ListView_GetItemText(hwnd, hit.iItem, 1, tszText, _countof(tszText));
LVITEM lvitem;
lvitem.iItem = hit.iItem;
@@ -734,7 +734,7 @@ void ImportMeta(DBCachedContact *ccSrc)
ccDst->pSubs[i] = MapContact(ccSrc->pSubs[i]);
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "Handle%d", i);
+ mir_snprintf(szSettingName, _countof(szSettingName), "Handle%d", i);
db_set_dw(hDest, META_PROTO, szSettingName, ccDst->pSubs[i]);
db_set_b(ccDst->pSubs[i], META_PROTO, "IsSubcontact", 1);
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp
index eaf35058fb..4d9e697389 100644
--- a/plugins/Import/src/miranda.cpp
+++ b/plugins/Import/src/miranda.cpp
@@ -33,7 +33,7 @@ static void SearchForLists(HWND hwndDlg, const TCHAR *mirandaPath, const TCHAR *
{
// find in Miranda profile subfolders
TCHAR searchspec[MAX_PATH];
- mir_sntprintf(searchspec, SIZEOF(searchspec), _T("%s\\*.*"), mirandaPath);
+ mir_sntprintf(searchspec, _countof(searchspec), _T("%s\\*.*"), mirandaPath);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(searchspec, &fd);
@@ -52,7 +52,7 @@ static void SearchForLists(HWND hwndDlg, const TCHAR *mirandaPath, const TCHAR *
TCHAR buf[MAX_PATH], profile[MAX_PATH];
mir_sntprintf(buf, _T("%s\\%s\\%s.dat"), mirandaPath, fd.cFileName, fd.cFileName);
if (_taccess(buf, 0) == 0) {
- mir_sntprintf(profile, SIZEOF(profile), _T("%s.dat"), fd.cFileName);
+ mir_sntprintf(profile, _countof(profile), _T("%s.dat"), fd.cFileName);
int i = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)profile);
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETITEMDATA, i, (LPARAM)mir_tstrdup(buf));
@@ -82,7 +82,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, 0, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_LIST, LBN_SELCHANGE), 0);
TCHAR filename[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILENAME, filename, SIZEOF(filename));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, filename, _countof(filename));
if (_taccess(filename, 4))
SendMessage(GetParent(hwndDlg), WIZM_DISABLEBUTTON, 1, 0);
return TRUE;
@@ -95,7 +95,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM
case IDOK:
TCHAR filename[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILENAME, filename, SIZEOF(filename));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, filename, _countof(filename));
if (_taccess(filename, 4)) {
MessageBox(hwndDlg, TranslateT("The given file does not exist. Please check that you have entered the name correctly."), TranslateT("Miranda Import"), MB_OK);
break;
@@ -122,7 +122,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM
ptrT pfd(Utils_ReplaceVarsT(_T("%miranda_profilesdir%")));
TCHAR str[MAX_PATH], text[256];
- GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
mir_sntprintf(text, _T("%s (*.dat, *.bak)%c*.dat;*.bak%c%s (*.*)%c*.*%c%c"), TranslateT("Miranda NG database"), 0, 0, TranslateT("All Files"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
@@ -132,7 +132,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM
ofn.lpstrDefExt = _T("dat");
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_DONTADDTORECENT;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.lpstrInitialDir = pfd;
if (GetOpenFileName(&ofn)) {
SetDlgItemText(hwndDlg, IDC_FILENAME, str);
@@ -306,15 +306,15 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hwndDlg, UINT message, WPARAM wP
case IDC_INCOMING:
case IDC_OUTGOING:
if (LOWORD(wParam) == IDC_ALL)
- for (int i = 0; i < SIZEOF(SysControls); i++)
+ for (int i = 0; i < _countof(SysControls); i++)
CheckDlgButton(hwndDlg, SysControls[i], IsDlgButtonChecked(hwndDlg, SysControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
if (LOWORD(wParam) != IDC_OUTGOING)
- for (int i = 0; i < SIZEOF(InControls); i++)
+ for (int i = 0; i < _countof(InControls); i++)
CheckDlgButton(hwndDlg, InControls[i], IsDlgButtonChecked(hwndDlg, InControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
if (LOWORD(wParam) != IDC_INCOMING)
- for (int i = 0; i < SIZEOF(OutControls); i++)
+ for (int i = 0; i < _countof(OutControls); i++)
CheckDlgButton(hwndDlg, OutControls[i], IsDlgButtonChecked(hwndDlg, OutControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
break;
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp
index 180294196b..3c48c93462 100644
--- a/plugins/Import/src/utils.cpp
+++ b/plugins/Import/src/utils.cpp
@@ -218,7 +218,7 @@ static IconItem iconList[] =
HICON GetIcon(int iIconId, bool size)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iIconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, size);
@@ -227,7 +227,7 @@ HICON GetIcon(int iIconId, bool size)
HANDLE GetIconHandle(int iIconId)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iIconId)
return iconList[i].hIcolib;
@@ -236,5 +236,5 @@ HANDLE GetIconHandle(int iIconId)
void RegisterIcons()
{
- Icon_Register(hInst, "Import", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "Import", iconList, _countof(iconList));
}