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/Popup/src/font.cpp | 62 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'plugins/Popup/src/font.cpp') diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 264f45d188..78a2f58274 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -30,53 +30,53 @@ void InitFonts() // Fonts FontIDT fid = { 0 }; fid.cbSize = sizeof(FontIDT); - mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.group)); - mir_strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(fid.dbSettingsGroup)); + mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), _countof(fid.group)); + mir_strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, _countof(fid.dbSettingsGroup)); fid.flags = FIDF_DEFAULTVALID; fid.deffontsettings.charset = DEFAULT_CHARSET; fid.deffontsettings.size = -11; - mir_tstrncpy(fid.backgroundGroup, _T(PU_FNT_AND_COLOR), SIZEOF(fid.backgroundGroup)); - mir_tstrncpy(fid.backgroundName, PU_COL_BACK_NAME, SIZEOF(fid.backgroundName)); - mir_tstrncpy(fid.deffontsettings.szFace, _T("Tahoma"), SIZEOF(fid.deffontsettings.szFace)); + mir_tstrncpy(fid.backgroundGroup, _T(PU_FNT_AND_COLOR), _countof(fid.backgroundGroup)); + mir_tstrncpy(fid.backgroundName, PU_COL_BACK_NAME, _countof(fid.backgroundName)); + mir_tstrncpy(fid.deffontsettings.szFace, _T("Tahoma"), _countof(fid.deffontsettings.szFace)); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name)); - mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), _countof(fid.name)); + mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE); fid.deffontsettings.style = DBFONTF_BOLD; fid.deffontsettings.colour = RGB(0, 0, 0); FontRegisterT(&fid); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name)); - mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), _countof(fid.name)); + mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK); FontRegisterT(&fid); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name)); - mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), _countof(fid.name)); + mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT); fid.deffontsettings.style = 0; FontRegisterT(&fid); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name)); - mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_ACTION); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), _countof(fid.name)); + mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_ACTION); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; fid.deffontsettings.colour = RGB(0, 0, 255); FontRegisterT(&fid); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name)); - mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), _countof(fid.name)); + mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION); fid.deffontsettings.style = DBFONTF_UNDERLINE; FontRegisterT(&fid); ColourIDT cid = { 0 }; cid.cbSize = sizeof(ColourIDT); - mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group)); - mir_strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(cid.dbSettingsGroup)); + mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), _countof(cid.group)); + mir_strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, _countof(cid.dbSettingsGroup)); - mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name)); - mir_strncpy(cid.setting, PU_COL_BACK_SETTING, SIZEOF(cid.setting)); + mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name)); + mir_strncpy(cid.setting, PU_COL_BACK_SETTING, _countof(cid.setting)); cid.defcolour = SETTING_BACKCOLOUR_DEFAULT; ColourRegisterT(&cid); - mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name)); - mir_strncpy(cid.setting, PU_COL_AVAT_SETTING, SIZEOF(cid.setting)); + mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name)); + mir_strncpy(cid.setting, PU_COL_AVAT_SETTING, _countof(cid.setting)); cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT; ColourRegisterT(&cid); @@ -95,36 +95,36 @@ void ReloadFonts() LOGFONT lf = { 0 }; FontIDT fid = { 0 }; fid.cbSize = sizeof(FontIDT); - mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.name)); + mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), _countof(fid.name)); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name)); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), _countof(fid.name)); fonts.clTitle = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.title = CreateFontIndirect(&lf); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name)); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), _countof(fid.name)); fonts.clClock = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.clock = CreateFontIndirect(&lf); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name)); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), _countof(fid.name)); fonts.clText = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.text = CreateFontIndirect(&lf); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name)); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), _countof(fid.name)); fonts.clAction = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.action = CreateFontIndirect(&lf); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name)); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), _countof(fid.name)); fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.actionHover = CreateFontIndirect(&lf); ColourIDT cid = { 0 }; cid.cbSize = sizeof(ColourIDT); - mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group)); - mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name)); + mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), _countof(cid.group)); + mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name)); fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf); - mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group)); - mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name)); + mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), _countof(cid.group)); + mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name)); fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf); // update class popupps(only temp at this point, must rework) -- cgit v1.2.3