summaryrefslogtreecommitdiff
path: root/protocols/MSN/src/msn_opts.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 /protocols/MSN/src/msn_opts.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 'protocols/MSN/src/msn_opts.cpp')
-rw-r--r--protocols/MSN/src/msn_opts.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index c5206af9ed..183252d3db 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -47,19 +47,19 @@ static IconItem iconList[] =
void MsnInitIcons(void)
{
- Icon_Register(hInst, "Protocols/MSN", iconList, SIZEOF(iconList), "MSN");
+ Icon_Register(hInst, "Protocols/MSN", iconList, _countof(iconList), "MSN");
}
HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "MSN_%s", name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE GetIconHandle(int iconId)
{
- for (unsigned i = 0; i < SIZEOF(iconList); i++)
+ for (unsigned i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
@@ -69,7 +69,7 @@ HANDLE GetIconHandle(int iconId)
void ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "MSN_%s", name);
IcoLib_Release(szSettingName, big);
}
@@ -174,7 +174,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
HWND tEditField = GetDlgItem(hwndDlg, IDC_MAILER_APP);
- GetWindowTextA(tEditField, szFile, SIZEOF(szFile));
+ GetWindowTextA(tEditField, szFile, _countof(szFile));
size_t tSelectLen = 0;
@@ -196,7 +196,7 @@ LBL_Continue:
OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
- ofn.nMaxFile = SIZEOF(szFile);
+ ofn.nMaxFile = _countof(szFile);
ofn.lpstrFile = szFile;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
if (GetOpenFileNameA(&ofn) != TRUE)
@@ -204,7 +204,7 @@ LBL_Continue:
if (strchr(szFile, ' ') != NULL) {
char tmpBuf[MAX_PATH + 2];
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "\"%s\"", szFile);
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "\"%s\"", szFile);
mir_strcpy(szFile, tmpBuf);
}
@@ -225,7 +225,7 @@ LBL_Continue:
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(_strlwr(szEmail), proto->MyOptions.szEmail)) {
reconnectRequired = true;
mir_strcpy(proto->MyOptions.szEmail, szEmail);
@@ -234,7 +234,7 @@ LBL_Continue:
proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal)) {
reconnectRequired = true;
@@ -248,7 +248,7 @@ LBL_Continue:
}
#ifdef OBSOLETE
- GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, SIZEOF(screenStr));
+ GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, _countof(screenStr));
if (!proto->getTString("Nick", &dbv)) {
if (mir_tstrcmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
@@ -275,7 +275,7 @@ LBL_Continue:
proto->setByte("RunMailerOnHotmail", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RUN_APP_ON_HOTMAIL));
proto->setByte("ManageServer", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MANAGEGROUPS));
- GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, SIZEOF(screenStr));
+ GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, _countof(screenStr));
proto->setTString("MailerPath", screenStr);
if (reconnectRequired && proto->msnLoggedIn)
@@ -382,13 +382,13 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_LOGIN_SERVER))
proto->setString("DirectServer", str);
else
proto->delSetting("DirectServer");
- GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_GATEWAY))
proto->setString("GatewayServer", str);
else
@@ -412,7 +412,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
proto->setByte("AutoGetHost", (BYTE)gethst);
if (gethst == 0) {
- GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, _countof(str));
proto->setString("YourHost", str);
}
else proto->delSetting("YourHost");
@@ -551,7 +551,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(szEmail, proto->MyOptions.szEmail)) {
mir_strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
@@ -559,7 +559,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal))
proto->setString("Password", password);
@@ -568,7 +568,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
else proto->setString("Password", password);
TCHAR szPlace[64];
- GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, SIZEOF(szPlace));
+ GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, _countof(szPlace));
if (szPlace[0])
proto->setTString("Place", szPlace);
else