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/Clist_blind | |
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/Clist_blind')
-rw-r--r-- | plugins/Clist_blind/src/clcopts.cpp | 18 | ||||
-rw-r--r-- | plugins/Clist_blind/src/clcpaint.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_blind/src/cluiopts.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_blind/src/init.cpp | 22 |
4 files changed, 23 insertions, 23 deletions
diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index e85a8c0631..f54710afd9 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -133,7 +133,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam {
int i;
DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
- for (i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
+ for (i = 0; i < _countof(checkBoxToStyleEx); i++)
CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id,
(exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag *
checkBoxToStyleEx[i].not) ? BST_CHECKED : BST_UNCHECKED);
@@ -141,7 +141,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam {
UDACCEL accel[2] = { {0, 10} , {2, 50} };
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
- SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, SIZEOF(accel), (LPARAM) & accel);
+ SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM) & accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0,
MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
}
@@ -156,9 +156,9 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, SIZEOF(greyoutValues),
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, _countof(greyoutValues),
db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, SIZEOF(offlineValues),
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, _countof(offlineValues),
db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (((LPNMHDR) lParam)->code == PSN_APPLY ) {
int i;
DWORD exStyle = 0;
- for (i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
+ for (i = 0; i < _countof(checkBoxToStyleEx); i++)
if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not)
exStyle |= checkBoxToStyleEx[i].flag;
@@ -235,13 +235,13 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam (BYTE) SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
- GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateContact", tmp);
- GetDlgItemText(hwndDlg, IDC_T_GROUP, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_T_GROUP, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateGroup", tmp);
- GetDlgItemText(hwndDlg, IDC_T_DIVIDER, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_T_DIVIDER, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateDivider", tmp);
- GetDlgItemText(hwndDlg, IDC_T_INFO, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_T_INFO, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateInfo", tmp);
pcli->pfnClcOptionsChanged();
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index 2289203589..d6eb06480b 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -503,7 +503,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) pts[6].y = pts[5].y;
pts[7].x = pts[0].x;
pts[7].y = pts[4].y;
- hRgn = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE);
+ hRgn = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour);
FillRgn(hdcMem, hRgn, hBrush);
DeleteObject(hBrush);
@@ -532,7 +532,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) int greyGreen = GetGValue(greyColour) * 2;
int greyBlue = GetBValue(greyColour) * 2;
if (divide3[0] == 255) {
- for (int i = 0; i < SIZEOF(divide3); i++)
+ for (int i = 0; i < _countof(divide3); i++)
divide3[i] = (i + 1) / 3;
}
for (int i = 4 * clRect.right * clRect.bottom - 4; i >= 0; i -= 4) {
diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index 42d4e19b2e..043b197b84 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -168,7 +168,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
{
TCHAR title[256];
- GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title));
+ GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
db_set_ts(NULL, "CList", "TitleText", title);
SetWindowText(pcli->hwndContactList, title);
}
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index bf67a5b3d8..15cb50d671 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -428,13 +428,13 @@ TCHAR *GetStatusName(struct ClcContact *item) return status_name;
// Get XStatusName
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, SIZEOF(status_name), NULL);
+ MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), NULL);
if (status_name[0] != _T('\0'))
return status_name;
// Get status name
status = db_get_w(item->hContact, item->proto, "Status", ID_STATUS_OFFLINE);
- mir_tstrncpy(status_name, pcli->pfnGetStatusModeDescription(status, GSMDF_TCHAR), SIZEOF(status_name));
+ mir_tstrncpy(status_name, pcli->pfnGetStatusModeDescription(status, GSMDF_TCHAR), _countof(status_name));
return status_name;
}
@@ -448,12 +448,12 @@ TCHAR *GetStatusMessage(struct ClcContact *item) return status_message;
// Get XStatusMsg
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, SIZEOF(status_message), NULL);
+ MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), NULL);
if (status_message[0] != _T('\0'))
return status_message;
// Get status message
- MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, SIZEOF(status_message), NULL);
+ MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, _countof(status_message), NULL);
return status_message;
}
@@ -470,7 +470,7 @@ TCHAR *GetProtoName(struct ClcContact *item) proto_name[0] = '\0';
if (item->hContact == NULL || item->proto == NULL)
{
- mir_tstrncpy(proto_name, TranslateT("Unknown protocol"), SIZEOF(proto_name));
+ mir_tstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name));
return proto_name;
}
@@ -480,14 +480,14 @@ TCHAR *GetProtoName(struct ClcContact *item) {
#ifdef UNICODE
CallProtoService(item->proto, PS_GETNAME, sizeof(description),(LPARAM) description);
- mir_sntprintf(proto_name, SIZEOF(proto_name), L"%S", description);
+ mir_sntprintf(proto_name, _countof(proto_name), L"%S", description);
#else
CallProtoService(item->proto, PS_GETNAME, sizeof(proto_name),(LPARAM) proto_name);
#endif
return proto_name;
}
- mir_tstrncpy(proto_name, acc->tszAccountName, SIZEOF(proto_name));
+ mir_tstrncpy(proto_name, acc->tszAccountName, _countof(proto_name));
return proto_name;
}
@@ -528,7 +528,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) group = &dat->list;
group->scanIndex = 0;
text = tmp;
- size = SIZEOF(tmp);
+ size = _countof(tmp);
while(1)
{
if (group->scanIndex == group->cl.count)
@@ -562,11 +562,11 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) TCHAR *txt;
if (szCounts[0] != '\0')
- mir_sntprintf(count, SIZEOF(count), _T("%s "), szCounts);
+ mir_sntprintf(count, _countof(count), _T("%s "), szCounts);
else
count[0] = _T('\0');
- txt = ParseText(template_group, t, SIZEOF(t), v, SIZEOF(v));
+ txt = ParseText(template_group, t, _countof(t), v, _countof(v));
if (txt != NULL)
mir_tstrncpy(text, txt, (int)size);
mir_free(txt);
@@ -587,7 +587,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) GetStatusMessage(item)
};
- TCHAR *txt = ParseText(template_contact, t, SIZEOF(t), v, SIZEOF(v));
+ TCHAR *txt = ParseText(template_contact, t, _countof(t), v, _countof(v));
if (txt != NULL)
mir_tstrncpy(text, txt, (int)size);
mir_free(txt);
|