From 4c814798c7bc7f6a0f92c21b027b26290622aa2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 19:35:42 +0000 Subject: SIZEOF replaced with more secure analog - _countof git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Ping/src/pingthread.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'plugins/Ping/src/pingthread.cpp') diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index c0465a06a0..71e4f54b16 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -115,9 +115,9 @@ void __cdecl sttCheckStatusThreadProc(void *vp) pa.item_id = i->item_id; pa.miss_count = i->miss_count; pa.port = i->port; - mir_tstrncpy(pa.pszLabel, i->pszLabel, SIZEOF(pa.pszLabel)); - mir_tstrncpy(pa.pszName, i->pszName, SIZEOF(pa.pszName)); - mir_strncpy(pa.pszProto, i->pszProto, SIZEOF(pa.pszProto)); + mir_tstrncpy(pa.pszLabel, i->pszLabel, _countof(pa.pszLabel)); + mir_tstrncpy(pa.pszName, i->pszName, _countof(pa.pszName)); + mir_strncpy(pa.pszProto, i->pszProto, _countof(pa.pszProto)); pa.set_status = i->set_status; pa.status = i->status; break; @@ -317,9 +317,9 @@ void CALLBACK TimerProc( { TCHAR TBcapt[255]; if (total > 0) - mir_sntprintf(TBcapt, SIZEOF(TBcapt), _T("Ping (%d/%d)"), upCount, total); + mir_sntprintf(TBcapt, _countof(TBcapt), _T("Ping (%d/%d)"), upCount, total); else - mir_sntprintf(TBcapt, SIZEOF(TBcapt), _T("Ping")); + mir_sntprintf(TBcapt, _countof(TBcapt), _T("Ping")); CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_TBNAME | FO_TCHAR, frame_id), (LPARAM)TBcapt); CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_TBTIPNAME | FO_TCHAR, frame_id), (LPARAM)TBcapt); @@ -1007,27 +1007,27 @@ void InitList() { font_id.cbSize = sizeof(FontIDT); - mir_tstrncpy(font_id.group, LPGENT("Ping"), SIZEOF(font_id.group)); - mir_tstrncpy(font_id.name, LPGENT("List"), SIZEOF(font_id.name)); - mir_strncpy(font_id.dbSettingsGroup, "PING", SIZEOF(font_id.dbSettingsGroup)); - mir_strncpy(font_id.prefix, "Font", SIZEOF(font_id.prefix)); - mir_tstrncpy(font_id.backgroundGroup, _T("Ping"), SIZEOF(font_id.backgroundGroup)); - mir_tstrncpy(font_id.backgroundName, _T("Background"), SIZEOF(font_id.backgroundName)); + mir_tstrncpy(font_id.group, LPGENT("Ping"), _countof(font_id.group)); + mir_tstrncpy(font_id.name, LPGENT("List"), _countof(font_id.name)); + mir_strncpy(font_id.dbSettingsGroup, "PING", _countof(font_id.dbSettingsGroup)); + mir_strncpy(font_id.prefix, "Font", _countof(font_id.prefix)); + mir_tstrncpy(font_id.backgroundGroup, _T("Ping"), _countof(font_id.backgroundGroup)); + mir_tstrncpy(font_id.backgroundName, _T("Background"), _countof(font_id.backgroundName)); font_id.order = 0; font_id.flags = FIDF_DEFAULTVALID; font_id.deffontsettings.charset = DEFAULT_CHARSET; font_id.deffontsettings.size = -14; font_id.deffontsettings.style = 0; font_id.deffontsettings.colour = RGB(255, 255, 255); - mir_tstrncpy(font_id.deffontsettings.szFace, _T("Tahoma"), SIZEOF(font_id.deffontsettings.szFace)); + mir_tstrncpy(font_id.deffontsettings.szFace, _T("Tahoma"), _countof(font_id.deffontsettings.szFace)); FontRegisterT(&font_id); bk_col_id.cbSize = sizeof(ColourIDT); - mir_tstrncpy(bk_col_id.group, _T("Ping"), SIZEOF(bk_col_id.group)); - mir_tstrncpy(bk_col_id.name, _T("Background"), SIZEOF(bk_col_id.name)); - mir_strncpy(bk_col_id.dbSettingsGroup, "PING", SIZEOF(bk_col_id.dbSettingsGroup)); - mir_strncpy(bk_col_id.setting, "BgColor", SIZEOF(bk_col_id.setting)); + mir_tstrncpy(bk_col_id.group, _T("Ping"), _countof(bk_col_id.group)); + mir_tstrncpy(bk_col_id.name, _T("Background"), _countof(bk_col_id.name)); + mir_strncpy(bk_col_id.dbSettingsGroup, "PING", _countof(bk_col_id.dbSettingsGroup)); + mir_strncpy(bk_col_id.setting, "BgColor", _countof(bk_col_id.setting)); bk_col_id.defcolour = RGB(0, 0, 0); ColourRegisterT(&bk_col_id); -- cgit v1.2.3