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 /plugins/BuddyPounce | |
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 'plugins/BuddyPounce')
-rw-r--r-- | plugins/BuddyPounce/src/dialog.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index cf75e3e48d..c3d7725e15 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -16,7 +16,7 @@ void populateContacts(MCONTACT BPhContact, HWND hwnd2CB) char *szProto = GetContactProto(hContact);
if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM)) {
TCHAR name[300];
- mir_sntprintf(name, SIZEOF(name), _T("%s (%s)"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), _A2T(szProto));
+ mir_sntprintf(name, _countof(name), _T("%s (%s)"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), _A2T(szProto));
int index = SendMessage(hwnd2CB, CB_ADDSTRING, 0, (LPARAM)name);
SendMessage(hwnd2CB, CB_SETITEMDATA, index, hContact);
if (BPhContact == hContact)
@@ -37,18 +37,18 @@ void saveLastSetting(MCONTACT hContact, HWND hwnd) case 6: // nothing to do...
break;
case 3: // Reuse Pounce
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
db_set_b(hContact, modname, "Reuse", (BYTE)_ttoi(number));
break;
case 4: // Give Up delay
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
db_set_b(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number));
{
db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(_ttoi(number)*SECONDSINADAY));
}
break;
case 5: // confirm window
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
db_set_w(hContact, modname, "ConfirmTimeout", (WORD)_ttoi(number));
break;
}
@@ -89,7 +89,7 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case IDCANCEL:
windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
TCHAR type[32];
- GetDlgItemText(hwnd, IDC_CHECK1, type, SIZEOF(type));
+ GetDlgItemText(hwnd, IDC_CHECK1, type, _countof(type));
WORD flag = (IsDlgButtonChecked(hwnd, IDC_CHECK1))
|(IsDlgButtonChecked(hwnd, IDC_CHECK2)<<1)
@@ -202,7 +202,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP getDefaultMessage(hwnd, IDC_MESSAGE, hContact);
{
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
}
return FALSE;
@@ -214,7 +214,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP int length;
TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
}
break;
@@ -262,7 +262,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
{
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
}
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
@@ -278,7 +278,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l int length;
TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
}
break;
@@ -322,7 +322,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
{
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
}
db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",0));
@@ -396,7 +396,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wi);
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
SendDlgItemMessage(hwnd, IDC_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)1024, (short)0));
@@ -441,7 +441,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L int length;
TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
@@ -532,7 +532,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_TIMER:
{
TCHAR message[1024];
- mir_sntprintf(message, SIZEOF(message), TranslateT("Pounce being sent to %s in %d seconds"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)spdps->hContact, GCDNF_TCHAR), spdps->timer);
+ mir_sntprintf(message, _countof(message), TranslateT("Pounce being sent to %s in %d seconds"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)spdps->hContact, GCDNF_TCHAR), spdps->timer);
SetDlgItemText(hwnd, LBL_CONTACT, message);
}
spdps->timer--;
@@ -589,9 +589,9 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case IDOK:
{
TCHAR text[2048];
- GetDlgItemText(hwnd, IDOK, text, SIZEOF(text));
+ GetDlgItemText(hwnd, IDOK, text, _countof(text));
if (!mir_tstrcmp(text, TranslateT("Retry"))) {
- GetDlgItemText(hwnd, IDC_MESSAGE, text, SIZEOF(text));
+ GetDlgItemText(hwnd, IDC_MESSAGE, text, _countof(text));
SendPounce(text, hContact);
}
}
@@ -609,12 +609,12 @@ void CreateMessageAcknowlegedWindow(MCONTACT hContact, int SentSuccess) HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, hContact);
TCHAR msg[256];
if (SentSuccess) {
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Message successfully sent to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Message successfully sent to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
SetDlgItemText(hwnd, IDOK, TranslateT("OK"));
ShowWindow(GetDlgItem(hwnd, IDCANCEL), 0);
}
else {
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Message failed to send to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Message failed to send to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
SetDlgItemText(hwnd, IDOK, TranslateT("Retry"));
}
SetDlgItemText(hwnd, LBL_CONTACT, msg);
|