diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
commit | 4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch) | |
tree | 9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /src/core/stdauth | |
parent | f0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (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 'src/core/stdauth')
-rw-r--r-- | src/core/stdauth/src/auth.cpp | 10 | ||||
-rw-r--r-- | src/core/stdauth/src/authdialogs.cpp | 30 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp index e2a4148e67..5d5d158d18 100644 --- a/src/core/stdauth/src/auth.cpp +++ b/src/core/stdauth/src/auth.cpp @@ -80,7 +80,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) break;
case CNFT_DWORD:
- mir_sntprintf(szUid, SIZEOF(szUid), _T("%u"), ci.dVal);
+ mir_sntprintf(szUid, _countof(szUid), _T("%u"), ci.dVal);
break;
}
}
@@ -88,9 +88,9 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
SkinPlaySound("AuthRequest");
if (szUid[0])
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%s requests authorization"), szUid);
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%s requests authorization"), szUid);
else
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST);
cli.pszService = MS_AUTH_SHOWREQUEST;
@@ -99,9 +99,9 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) else if (dbei.eventType == EVENTTYPE_ADDED) {
SkinPlaySound("AddedEvent");
if (szUid[0])
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%s added you to their contact list"), szUid);
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%s added you to their contact list"), szUid);
else
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
+ mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD);
cli.pszService = MS_AUTH_SHOWADDED;
diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp index 4d4674d81c..ddf2fdc738 100644 --- a/src/core/stdauth/src/authdialogs.cpp +++ b/src/core/stdauth/src/authdialogs.cpp @@ -63,14 +63,14 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar TCHAR name[128] = _T("");
int off = 0;
if (firstT[0] && lastT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s %s"), firstT, lastT);
+ off = mir_sntprintf(name, _countof(name), _T("%s %s"), firstT, lastT);
else if (firstT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s"), firstT);
+ off = mir_sntprintf(name, _countof(name), _T("%s"), firstT);
else if (lastT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s"), lastT);
+ off = mir_sntprintf(name, _countof(name), _T("%s"), lastT);
if (nickT[0]) {
if (off)
- mir_sntprintf(name + off, SIZEOF(name) - off, _T(" (%s)"), nickT);
+ mir_sntprintf(name + off, _countof(name) - off, _T(" (%s)"), nickT);
else
_tcsncpy_s(name, nickT, _TRUNCATE);
}
@@ -79,11 +79,11 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar TCHAR hdr[256];
if (uin && emailT[0])
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName);
else if (uin)
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
else
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
@@ -188,14 +188,14 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR name[128] = _T("");
int off = 0;
if (firstT[0] && lastT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s %s"), (TCHAR*)firstT, (TCHAR*)lastT);
+ off = mir_sntprintf(name, _countof(name), _T("%s %s"), (TCHAR*)firstT, (TCHAR*)lastT);
else if (firstT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s"), (TCHAR*)firstT);
+ off = mir_sntprintf(name, _countof(name), _T("%s"), (TCHAR*)firstT);
else if (lastT[0])
- off = mir_sntprintf(name, SIZEOF(name), _T("%s"), (TCHAR*)lastT);
+ off = mir_sntprintf(name, _countof(name), _T("%s"), (TCHAR*)lastT);
if (mir_tstrlen(nickT)) {
if (off)
- mir_sntprintf(name + off, SIZEOF(name) - off, _T(" (%s)"), (TCHAR*)nickT);
+ mir_sntprintf(name + off, _countof(name) - off, _T(" (%s)"), (TCHAR*)nickT);
else
_tcsncpy_s(name, nickT, _TRUNCATE);
}
@@ -204,11 +204,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR hdr[256];
if (uin && emailT[0])
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (TCHAR*)emailT, acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (TCHAR*)emailT, acc->tszAccountName);
else if (uin)
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName);
else
- mir_sntprintf(hdr, SIZEOF(hdr), TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (TCHAR*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ mir_sntprintf(hdr, _countof(hdr), TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (TCHAR*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
SetDlgItemText(hwndDlg, IDC_REASON, reasonT);
@@ -265,7 +265,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON))) {
TCHAR tszReason[256];
- GetDlgItemText(hwndDlg, IDC_DENYREASON, tszReason, SIZEOF(tszReason));
+ GetDlgItemText(hwndDlg, IDC_DENYREASON, tszReason, _countof(tszReason));
CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, (LPARAM)tszReason);
}
else CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, 0);
|