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/actions.cpp | 6 ++-- plugins/Popup/src/font.cpp | 62 ++++++++++++++++++------------------- plugins/Popup/src/font.h | 2 +- plugins/Popup/src/notifications.cpp | 24 +++++++------- plugins/Popup/src/opt_adv.cpp | 8 ++--- plugins/Popup/src/opt_class.cpp | 26 ++++++++-------- plugins/Popup/src/opt_contacts.cpp | 8 ++--- plugins/Popup/src/opt_gen.cpp | 12 +++---- plugins/Popup/src/opt_skins.cpp | 8 ++--- plugins/Popup/src/opttree.cpp | 4 +-- plugins/Popup/src/popup_thread.cpp | 2 +- plugins/Popup/src/popup_wnd2.cpp | 18 +++++------ plugins/Popup/src/services.cpp | 22 ++++++------- plugins/Popup/src/skin.cpp | 4 +-- 14 files changed, 103 insertions(+), 103 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 3d599d9d8e..b897255edc 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -52,7 +52,7 @@ void LoadActions() #endif }; - for (int i = 0; i < SIZEOF(actions); ++i) + for (int i = 0; i < _countof(actions); ++i) RegisterAction(&actions[i]); } @@ -268,7 +268,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE; - for (i = 0; i < SIZEOF(controls); ++i) + for (i = 0; i < _countof(controls); ++i) EnableWindow(GetDlgItem(hwnd, controls[i]), enabled); } windowInitialized = true; @@ -282,7 +282,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); { BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE; - for (i = 0; i < SIZEOF(controls); ++i) + for (i = 0; i < _countof(controls); ++i) EnableWindow(GetDlgItem(hwnd, controls[i]), enabled); } break; 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) diff --git a/plugins/Popup/src/font.h b/plugins/Popup/src/font.h index a39e9053b2..0b6c53a307 100644 --- a/plugins/Popup/src/font.h +++ b/plugins/Popup/src/font.h @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PU_FNT_AND_COLOR LPGEN("Popups") //common main group for customice\font&color #define PU_FNT_AND_COLOR_DB MODULNAME //use eg mir_strcpy(fid.dbSettingsGroup, PU_FNT_GROUP_DB); -#define PU_FNT_PREFIX "fnt%s" //use eg mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_....); +#define PU_FNT_PREFIX "fnt%s" //use eg mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_....); #define PU_FNT_NAME_TITLE LPGEN("Title") //use eg mir_tstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT #define PU_FNT_NAME_CLOCK LPGEN("Clock") #define PU_FNT_NAME_TEXT LPGEN("Text") diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 6f355f68a5..a1e25be5f6 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -185,30 +185,30 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) FontID fontid = { 0 }; fontid.cbSize = sizeof(fontid); - mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup); + mir_snprintf(fontid.group, _countof(fontid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup); mir_strcpy(fontid.dbSettingsGroup, "PopupNotifications"); fontid.flags = FIDF_DEFAULTVALID; fontid.deffontsettings.charset = DEFAULT_CHARSET; fontid.deffontsettings.colour = ptd->notification.colorText; fontid.deffontsettings.size = -11; - mir_strncpy(fontid.deffontsettings.szFace, "MS Shell Dlg", SIZEOF(fontid.deffontsettings.szFace)); + mir_strncpy(fontid.deffontsettings.szFace, "MS Shell Dlg", _countof(fontid.deffontsettings.szFace)); fontid.deffontsettings.style = 0; - mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", notification->lpzName); - mir_snprintf(fontid.prefix, SIZEOF(fontid.prefix), "{%s/%s}text", notification->lpzGroup, notification->lpzName); + mir_snprintf(fontid.name, _countof(fontid.name), "%s (colors only)", notification->lpzName); + mir_snprintf(fontid.prefix, _countof(fontid.prefix), "{%s/%s}text", notification->lpzGroup, notification->lpzName); fontid.deffontsettings.style = 0; FontRegister(&fontid); ColourID colourid = { 0 }; colourid.cbSize = sizeof(colourid); - mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup); + mir_snprintf(colourid.group, _countof(colourid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup); mir_strcpy(colourid.dbSettingsGroup, "PopupNotifications"); - mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", notification->lpzName); - mir_snprintf(colourid.setting, SIZEOF(colourid.setting), "{%s/%s}backColor", notification->lpzGroup, notification->lpzName); + mir_snprintf(colourid.name, _countof(colourid.name), "%s (colors only)", notification->lpzName); + mir_snprintf(colourid.setting, _countof(colourid.setting), "{%s/%s}backColor", notification->lpzGroup, notification->lpzName); colourid.defcolour = ptd->notification.colorBack; ColourRegister(&colourid); char section[MAXMODULELABELLENGTH], setting[MAXMODULELABELLENGTH]; - mir_snprintf(section, SIZEOF(section), "Popups/%s", notification->lpzGroup); + mir_snprintf(section, _countof(section), "Popups/%s", notification->lpzGroup); mir_snprintf(setting, MODULNAME"_%s_%s", notification->lpzGroup, notification->lpzName); SKINICONDESC sid = { 0 }; @@ -248,14 +248,14 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen) LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET) FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char fontid.cbSize = sizeof(fontid); - mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); - mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", ptd->notification.lpzName); + mir_snprintf(fontid.group, _countof(fontid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); + mir_snprintf(fontid.name, _countof(fontid.name), "%s (colors only)", ptd->notification.lpzName); ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf); ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char colourid.cbSize = sizeof(colourid); - mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); - mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", ptd->notification.lpzName); + mir_snprintf(colourid.group, _countof(colourid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); + mir_snprintf(colourid.name, _countof(colourid.name), "%s (colors only)", ptd->notification.lpzName); ppd->colorBack = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&colourid, 0); char setting[MAXMODULELABELLENGTH]; diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 1183fa07d6..1557a5ce16 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -161,7 +161,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETPOS, TRUE, PopupOptions.Alpha); mir_subclassWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), AlphaTrackBarWndProc); - mir_sntprintf(tstr, SIZEOF(tstr), _T("%d%%"), Byte2Percentile(PopupOptions.Alpha)); + mir_sntprintf(tstr, _countof(tstr), _T("%d%%"), Byte2Percentile(PopupOptions.Alpha)); SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr); CheckDlgButton(hwnd, IDC_TRANS_OPAQUEONHOVER, PopupOptions.OpaqueOnHover ? BST_CHECKED : BST_UNCHECKED); { @@ -184,9 +184,9 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemInt(hwnd, IDC_FADEOUT, PopupOptions.FadeOut, FALSE); UDACCEL aAccels[] = { { 0, 50 }, { 1, 100 }, { 3, 500 } }; SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEINTIME_MAX, SETTING_FADEINTIME_MIN)); - SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels); + SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETACCEL, (WPARAM)_countof(aAccels), (LPARAM)&aAccels); SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEOUTTIME_MAX, SETTING_FADEOUTTIME_MIN)); - SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN, UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels); + SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN, UDM_SETACCEL, (WPARAM)_countof(aAccels), (LPARAM)&aAccels); BOOL how = PopupOptions.UseAnimations || PopupOptions.UseEffect; EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), how); @@ -239,7 +239,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_TRANS_SLIDER: PopupOptions.Alpha = (BYTE)SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_GETPOS, 0, 0); - mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("%d%%"), Byte2Percentile(PopupOptions.Alpha)); + mir_sntprintf(tstr, _countof(tstr), TranslateT("%d%%"), Byte2Percentile(PopupOptions.Alpha)); SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 5d70ff8e03..6af58caeb9 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -189,13 +189,13 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l for (i = 0; i < gTreeData.getCount(); ++i) { switch (gTreeData[i]->typ) { case 1: // Treeview part for typ 1 (notification) - mir_snprintf(iconName, SIZEOF(iconName), "%s_%S_%S", MODULNAME, gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); + mir_snprintf(iconName, _countof(iconName), "%s_%S_%S", MODULNAME, gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); iconIndex = ImageList_ReplaceIcon(hImgLst, -1, IcoLib_GetIcon(iconName)); - mir_sntprintf(itemName, SIZEOF(itemName), _T("%s/%s"), gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); + mir_sntprintf(itemName, _countof(itemName), _T("%s/%s"), gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription); break; case 2: // Treeview part typ 2 (popup class api) iconIndex = ImageList_ReplaceIcon(hImgLst, -1, gTreeData[i]->pupClass.hIcon); - mir_sntprintf(itemName, SIZEOF(itemName), _T("%s/%s"), LPGENT("CLASS Plugins")/*gTreeData[i]->pszTreeRoot*/, gTreeData[i]->pszDescription); + mir_sntprintf(itemName, _countof(itemName), _T("%s/%s"), LPGENT("CLASS Plugins")/*gTreeData[i]->pszTreeRoot*/, gTreeData[i]->pszDescription); break; } OptTree_AddItem(hwndTree, itemName, (LPARAM)gTreeData[i], iconIndex); @@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l OptTree_Translate(hwndTree); // Bold Title - for (i = 0; i < SIZEOF(titleIds); ++i) { + for (i = 0; i < _countof(titleIds); ++i) { LOGFONT lf; GetObject((HFONT)SendDlgItemMessage(hwnd, titleIds[i], WM_GETFONT, 0, 0), sizeof(lf), &lf); lf.lfWeight = FW_BOLD; @@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_LIFETIME_MAX, SETTING_LIFETIME_INFINITE)); SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)0, TRUE); // status buttons - for (i = 0; i < SIZEOF(statusButtons); ++i) { + for (i = 0; i < _countof(statusButtons); ++i) { SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASPUSHBTN, TRUE, 0); SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BM_SETIMAGE, @@ -280,18 +280,18 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l mir_free(psztAction); psztAction = NULL; } // enable all controls - for (i = 0; i < SIZEOF(ctrlsAll); ++i){ + for (i = 0; i < _countof(ctrlsAll); ++i){ ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1); } // enable or disable controls ctrlsEnable - for (i = 0; i < SIZEOF(ctrlsEnable); ++i) + for (i = 0; i < _countof(ctrlsEnable); ++i) EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled ? TRUE : FALSE); // show or hide controls ctrlsContact - for (i = 0; i < SIZEOF(ctrlsContact); ++i) + for (i = 0; i < _countof(ctrlsContact); ++i) ShowWindow(GetDlgItem(hwnd, ctrlsContact[i]), ptd->notification.dwFlags&PNF_CONTACT ? SW_SHOW : SW_HIDE); // statusButtons state - for (i = 0; i < SIZEOF(statusButtons); ++i) + for (i = 0; i < _countof(statusButtons); ++i) CheckDlgButton(hwnd, statusButtons[i].idCtrl, ptd->disableWhen & statusButtons[i].disableWhenFlag ? BST_CHECKED : BST_UNCHECKED); } // element typ2 (CLASS Plugins) @@ -300,7 +300,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)ptd->timeoutValue, TRUE); SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1)); // enable ctrls - for (i = 0; i < SIZEOF(ctrlsAll); ++i){ + for (i = 0; i < _countof(ctrlsAll); ++i){ ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2); } @@ -316,7 +316,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } // end if (tvi.lParam) else { // enable / disable controls - for (int i = 0; i < SIZEOF(ctrlsAll); ++i) { + for (int i = 0; i < _countof(ctrlsAll); ++i) { ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0); } @@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch (idCtrl) { case IDC_ENABLE: ptd->enabled = (BYTE)Button_GetCheck((HWND)lParam); - for (i = 0; i < SIZEOF(ctrlsEnable); ++i) + for (i = 0; i < _countof(ctrlsEnable); ++i) EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; @@ -383,7 +383,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case IDC_SOFFLINE2: case IDC_SONLINE2: case IDC_SAWAY2: case IDC_SNA2: case IDC_SOCCUPIED2: case IDC_SDND2: case IDC_SFREE4CHAT2: case IDC_SINVISIBLE2: case IDC_SPHONE2: case IDC_SLUNCH2: ptd->disableWhen = 0; - for (i = 0; i < SIZEOF(statusButtons); ++i) { + for (i = 0; i < _countof(statusButtons); ++i) { if (IsDlgButtonChecked(hwnd, statusButtons[i].idCtrl)) ptd->disableWhen |= statusButtons[i].disableWhenFlag; if (idCtrl == (UINT)statusButtons[i].idCtrl) diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 750ecf889f..3184928d05 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -33,7 +33,7 @@ static void sttSetAllContactIcons(HWND hwndList) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); DWORD dwMode = db_get_b(hContact, MODULNAME, "ShowMode", 0); - for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) + for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i) // hIml element [0] = SKINICON_OTHER_SMALLDOT // hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, ((int)dwMode == i) ? i + 1 : 0)); @@ -58,7 +58,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_FULLSCREEN, 0)); ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_BLOCK, 0)); SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); - SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRACOLUMNS, 4 /*SIZEOF(sttIcons)*/, 0); + SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRACOLUMNS, 4 /*_countof(sttIcons)*/, 0); sttResetListOptions(GetDlgItem(hwnd, IDC_LIST)); sttSetAllContactIcons(GetDlgItem(hwnd, IDC_LIST)); } @@ -86,7 +86,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) int iImage = SendDlgItemMessage(hwnd, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0)); if (iImage != EMPTY_EXTRA_ICON) { - for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) + for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i) // hIml element [0] = SKINICON_OTHER_SMALLDOT // hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (i == nm->iColumn) ? i + 1 : 0)); @@ -101,7 +101,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) HWND hwndList = GetDlgItem(hwnd, IDC_LIST); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); - for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) { + for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i) { if (SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0))) { db_set_b(hContact, MODULNAME, "ShowMode", i); break; diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 129f16fafe..d3e3c436bb 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -225,7 +225,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM continue; TCHAR prefix[128]; - mir_sntprintf(prefix, SIZEOF(prefix), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName); + mir_sntprintf(prefix, _countof(prefix), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName); pos = AddStatusModes(statusOptions, pos, prefix, protoFlags); } } @@ -240,10 +240,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM continue; char prefix[128]; - mir_snprintf(prefix, SIZEOF(prefix), "Protocol Status/%s", protocols[i]->szModuleName); + mir_snprintf(prefix, _countof(prefix), "Protocol Status/%s", protocols[i]->szModuleName); TCHAR pszSettingName[256]; - mir_sntprintf(pszSettingName, SIZEOF(pszSettingName), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName); + mir_sntprintf(pszSettingName, _countof(pszSettingName), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName); OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULNAME, prefix, 0), pszSettingName); } } @@ -526,10 +526,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM for (int i = 0; i < protocolCount; ++i) { if (!protocols[i]->bIsVirtual) { char prefix[128]; - mir_snprintf(prefix, SIZEOF(prefix), "Protocol Status/%s", protocols[i]->szModuleName); + mir_snprintf(prefix, _countof(prefix), "Protocol Status/%s", protocols[i]->szModuleName); TCHAR pszSettingName[256]; - mir_sntprintf(pszSettingName, SIZEOF(pszSettingName), _T("Protocol Status/%s"), protocols[i]->tszAccountName); + mir_sntprintf(pszSettingName, _countof(pszSettingName), _T("Protocol Status/%s"), protocols[i]->tszAccountName); db_set_dw(NULL, MODULNAME, prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName)); } } @@ -581,7 +581,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM void ErrorMSG(int minValue, int maxValue) { TCHAR str[128]; - mir_sntprintf(str, SIZEOF(str), TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue); + mir_sntprintf(str, _countof(str), TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue); MSGERROR(str); } diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 672de348be..25bf6ce808 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -48,7 +48,7 @@ void RegisterOptPrevBox() err = GetLastError(); if (!g_wndClass.cPopupPreviewBoxWndclass) { TCHAR msg[1024]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); MSGERROR(msg); } @@ -62,7 +62,7 @@ void RegisterOptPrevBox() err = GetLastError(); if (!g_wndClass.cPopupPlusDlgBox) { TCHAR msg[1024]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); MSGERROR(msg); } } @@ -210,7 +210,7 @@ static LPTSTR mainOption[] = { int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos, DWORD *dwGlobalOptions) { - for (int i = 0; i < SIZEOF(mainOption); i++) { + for (int i = 0; i < _countof(mainOption); i++) { BOOL bCheck = 0; switch (i) { case 0: @@ -280,7 +280,7 @@ bool SkinOptionList_Update(OPTTREE_OPTION* &options, int *OptionsCount, HWND hwn // check "Skin options" state char prefix[128]; - mir_snprintf(prefix, SIZEOF(prefix), "skin.%S", PopupOptions.SkinPack); + mir_snprintf(prefix, _countof(prefix), "skin.%S", PopupOptions.SkinPack); OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount, db_get_dw(NULL, MODULNAME, prefix, dwSkinOptions), _T("Skin options")); diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index e6bb00b1bd..c238b5f499 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -33,7 +33,7 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) tvi.mask = TVIF_HANDLE | TVIF_TEXT; tvi.hItem = hItem; tvi.pszText = buf; - tvi.cchTextMax = SIZEOF(buf); + tvi.cchTextMax = _countof(buf); SendMessage(hwndTree, TVM_GETITEMW, 0, (LPARAM)&tvi); tvi.pszText = TranslateTS(tvi.pszText); SendMessage(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi); @@ -80,7 +80,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHA tvi.mask = TVIF_TEXT; tvi.pszText = str; - tvi.cchTextMax = SIZEOF(str); + tvi.cchTextMax = _countof(str); while (tvi.hItem) { TreeView_GetItem(hwndTree, &tvi); diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index a8f269635f..2bbda488f6 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -222,7 +222,7 @@ static unsigned __stdcall PopupThread(void *) err = GetLastError(); if (!g_wndClass.cPopupThreadManagerWnd) { TCHAR msg[1024]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); MSGERROR(msg); } diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index f1183f6dd4..f31013e2e6 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -65,7 +65,7 @@ bool LoadPopupWnd2() if (!g_wndClass.cPopupWnd2) { res = false; TCHAR msg[1024]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); MessageBox(NULL, msg, _T(MODULNAME_LONG), MB_ICONSTOP | MB_OK); } @@ -80,7 +80,7 @@ bool LoadPopupWnd2() err = GetLastError(); if (!g_wndClass.cPopupEditBox) { TCHAR msg[2048]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"), + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"), wclw.cbSize, // UINT cbSize; wclw.style, // UINT style; wclw.lpfnWndProc, // WNDPROC lpfnWndProc; @@ -116,7 +116,7 @@ bool LoadPopupWnd2() if (!g_wndClass.cPopupMenuHostWnd) { res = false; TCHAR msg[1024]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); MSGERROR(msg); } @@ -350,7 +350,7 @@ void PopupWnd2::show() if (*PopupOptions.Effect) { char vfxService[128]; - mir_snprintf(vfxService, SIZEOF(vfxService), "Popup/Vfx/%S", PopupOptions.Effect); + mir_snprintf(vfxService, _countof(vfxService), "Popup/Vfx/%S", PopupOptions.Effect); if (ServiceExists(vfxService)) if (effect = (IPopupPlusEffect *)CallService(vfxService, 0, 0)) { effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1 - dwTime0); @@ -437,7 +437,7 @@ void PopupWnd2::hide() if (*PopupOptions.Effect) { char vfxService[128]; - mir_snprintf(vfxService, SIZEOF(vfxService), "Popup/Vfx/%S", PopupOptions.Effect); + mir_snprintf(vfxService, _countof(vfxService), "Popup/Vfx/%S", PopupOptions.Effect); if (ServiceExists(vfxService)) if (effect = (IPopupPlusEffect *)CallService(vfxService, 0, 0)) { effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1 - dwTime0); @@ -712,7 +712,7 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) m_PluginWindowProc = ppd->PluginWindowProc; if (m_options->DisplayTime) - GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time)); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, _countof(m_time)); else m_time[0] = 0; fixDefaults(); @@ -752,9 +752,9 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) if (m_options->DisplayTime) { if (ppd->dwTimestamp) - TimeZone_ToStringT(ppd->dwTimestamp, _T("t"), m_time, SIZEOF(m_time)); + TimeZone_ToStringT(ppd->dwTimestamp, _T("t"), m_time, _countof(m_time)); else - GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time)); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, _countof(m_time)); } else m_time[0] = 0; @@ -847,7 +847,7 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM switch (wParam) { case VK_RETURN: TCHAR msg[2048]; - GetWindowText(hwnd, msg, SIZEOF(msg)); + GetWindowText(hwnd, msg, _countof(msg)); if (mir_wstrlen(msg) == 0) { DestroyWindow(hwnd); return 0; diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index b77c87a75a..94d87996b9 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -146,7 +146,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) if (proto) { char prefix[128]; - mir_snprintf(prefix, SIZEOF(prefix), LPGEN("Protocol Status") "/%s", GetContactProto(ppd->lchContact)); + mir_snprintf(prefix, _countof(prefix), LPGEN("Protocol Status") "/%s", GetContactProto(ppd->lchContact)); if (db_get_dw(NULL, MODULNAME, prefix, 0) & Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0))) return -1; if (((disableWhen >> 16) & 0xFFFF0000) & Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0))) @@ -381,15 +381,15 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/); FontIDT fid = { 0 }; fid.cbSize = sizeof(FontIDT); - mir_sntprintf(fid.group, SIZEOF(fid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName); - mir_strncpy(fid.dbSettingsGroup, PU_MODULCLASS, SIZEOF(fid.dbSettingsGroup) - 1); + mir_sntprintf(fid.group, _countof(fid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName); + mir_strncpy(fid.dbSettingsGroup, PU_MODULCLASS, _countof(fid.dbSettingsGroup) - 1); fid.flags = FIDF_DEFAULTVALID; fid.deffontsettings.charset = DEFAULT_CHARSET; fid.deffontsettings.size = -11; - mir_tstrncpy(fid.deffontsettings.szFace, _T("Verdana"), SIZEOF(fid.deffontsettings.szFace) - 1); - mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name) - 1); - mir_strncpy(fid.prefix, setting, SIZEOF(fid.prefix)); - mir_snprintf(fid.prefix, SIZEOF(fid.prefix), "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol" + mir_tstrncpy(fid.deffontsettings.szFace, _T("Verdana"), _countof(fid.deffontsettings.szFace) - 1); + mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), _countof(fid.name) - 1); + mir_strncpy(fid.prefix, setting, _countof(fid.prefix)); + mir_snprintf(fid.prefix, _countof(fid.prefix), "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol" fid.deffontsettings.style = 0; fid.deffontsettings.colour = fonts.clText; FontRegisterT(&fid); @@ -399,10 +399,10 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/); ColourIDT cid = { 0 }; cid.cbSize = sizeof(ColourIDT); - mir_sntprintf(cid.group, SIZEOF(cid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName); - mir_strncpy(cid.dbSettingsGroup, PU_MODULCLASS, SIZEOF(fid.dbSettingsGroup)); - mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name)); - mir_snprintf(cid.setting, SIZEOF(cid.setting), "%s/BgCol", ptd->pupClass.pszName); + mir_sntprintf(cid.group, _countof(cid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName); + mir_strncpy(cid.dbSettingsGroup, PU_MODULCLASS, _countof(fid.dbSettingsGroup)); + mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name)); + mir_snprintf(cid.setting, _countof(cid.setting), "%s/BgCol", ptd->pupClass.pszName); cid.defcolour = fonts.clBack; ColourRegisterT(&cid); diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 1a6a14bdf7..423fb25ea3 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -1095,11 +1095,11 @@ bool Skins::load() TCHAR dir[1024] = { '\0' }; if (ServiceExists(MS_FOLDERS_GET_PATH)) { - if (FoldersGetCustomPathT(folderId, dir, SIZEOF(dir), NULL) != 0) + if (FoldersGetCustomPathT(folderId, dir, _countof(dir), NULL) != 0) return false; } else { - mir_tstrncpy(dir, VARST(_T("%miranda_path%\\skins\\popup")), SIZEOF(dir)); + mir_tstrncpy(dir, VARST(_T("%miranda_path%\\skins\\popup")), _countof(dir)); DWORD fa = GetFileAttributes(dir); if ((fa == INVALID_FILE_ATTRIBUTES) || !(fa&FILE_ATTRIBUTE_DIRECTORY)) return false; -- cgit v1.2.3