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/Clist_nicer/src/CLCButton.cpp | 8 ++-- plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 8 ++-- plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp | 2 +- plugins/Clist_nicer/src/clc.cpp | 4 +- plugins/Clist_nicer/src/clcitems.cpp | 2 +- plugins/Clist_nicer/src/clcopts.cpp | 16 +++---- plugins/Clist_nicer/src/clcpaint.cpp | 4 +- plugins/Clist_nicer/src/clistmod.cpp | 2 +- plugins/Clist_nicer/src/clui.cpp | 36 +++++++-------- plugins/Clist_nicer/src/cluiopts.cpp | 2 +- plugins/Clist_nicer/src/cluiservices.cpp | 8 ++-- plugins/Clist_nicer/src/config.cpp | 10 ++-- plugins/Clist_nicer/src/extBackg.cpp | 56 +++++++++++------------ plugins/Clist_nicer/src/rowheight_funcs.cpp | 4 +- plugins/Clist_nicer/src/statusbar.cpp | 2 +- plugins/Clist_nicer/src/viewmodes.cpp | 20 ++++---- 16 files changed, 92 insertions(+), 92 deletions(-) (limited to 'plugins/Clist_nicer/src') diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index a87419a58c..0bd79d24c2 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -45,7 +45,7 @@ static int g_index = -1; static void InitDefaultButtons() { - for (int i = 0; i < SIZEOF(BTNS); i++) { + for (int i = 0; i < _countof(BTNS); i++) { TTBButton tbb = { sizeof(tbb) }; g_index = i; @@ -72,7 +72,7 @@ static void InitDefaultButtons() void ClcSetButtonState(int ctrlid, int status) { - for (int i = 0; i < SIZEOF(BTNS); i++) + for (int i = 0; i < _countof(BTNS); i++) if (BTNS[i].ctrlid == ctrlid) { CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)BTNS[i].hButton, status ? TTBST_PUSHED : 0); break; @@ -81,7 +81,7 @@ void ClcSetButtonState(int ctrlid, int status) HWND ClcGetButtonWindow(int ctrlid) { - for (int i = 0; i < SIZEOF(BTNS); i++) + for (int i = 0; i < _countof(BTNS); i++) if (BTNS[i].ctrlid == ctrlid) return BTNS[i].hwndButton; @@ -90,7 +90,7 @@ HWND ClcGetButtonWindow(int ctrlid) int ClcGetButtonId(HWND hwnd) { - for (int i = 0; i < SIZEOF(BTNS); i++) + for (int i = 0; i < _countof(BTNS); i++) if (BTNS[i].hwndButton == hwnd) return BTNS[i].ctrlid; diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index dba83c3b88..e4cc7df2c4 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -476,7 +476,7 @@ int LocateStorePosition(int Frameid, int maxstored) for (int i = 0; i < maxstored; i++) { char settingname[255]; - mir_snprintf(settingname, SIZEOF(settingname), "Name%d", i); + mir_snprintf(settingname, _countof(settingname), "Name%d", i); ptrT frmname(db_get_tsa(0, CLUIFrameModule, settingname)); if (frmname == NULL) continue; if (mir_tstrcmpi(frmname, Frames[Frameid].name) == 0) @@ -1772,7 +1772,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { TCHAR ptszClassName[256]; - GetClassName(Frames[nFramescount].hWnd, ptszClassName, SIZEOF(ptszClassName)); + GetClassName(Frames[nFramescount].hWnd, ptszClassName, _countof(ptszClassName)); Frames[nFramescount].name = mir_tstrdup(ptszClassName); } else Frames[nFramescount].name = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name); @@ -2598,7 +2598,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA int pos = id2pos(Frameid); if (pos != -1) { int oldflags; - mir_snprintf(TBcapt, SIZEOF(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d", + mir_snprintf(TBcapt, _countof(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d", Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating, Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y, Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y, @@ -3085,7 +3085,7 @@ TCHAR g_ptszEventName[100]; static int CLUIFrameOnModulesLoad(WPARAM, LPARAM) { - mir_sntprintf(g_ptszEventName, SIZEOF(g_ptszEventName), _T("mf_update_evt_%d"), GetCurrentThreadId()); + mir_sntprintf(g_ptszEventName, _countof(g_ptszEventName), _T("mf_update_evt_%d"), GetCurrentThreadId()); g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName); hThreadMFUpdate = mir_forkthread(MF_UpdateThread, NULL); SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE); diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index 038344b989..c294072ba4 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -227,7 +227,7 @@ IconItemT iconItem[] = { void InitIconLibMenuIcons(void) { - Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, SIZEOF(iconItem)); + Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, _countof(iconItem)); } void InitGroupMenus(void) diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 87136ab986..7e73793bfc 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -418,7 +418,7 @@ LBL_Def: ClcContact *contact; if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; - mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); + mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText)); RTL_DetectAndSet(contact, 0); @@ -503,7 +503,7 @@ LBL_Def: contact->proto = GetContactProto(wParam); CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0); - mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); + mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText)); RTL_DetectAndSet(contact, 0); diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 332632a305..c745bfac31 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -485,7 +485,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str } if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) { if (!cfg::getTString(hContact, "CList", "Group", &dbv)) { - mir_sntprintf(szGroupMask, SIZEOF(szGroupMask), _T("%s|"), &dbv.ptszVal[1]); + mir_sntprintf(szGroupMask, _countof(szGroupMask), _T("%s|"), &dbv.ptszVal[1]); filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0)); mir_free(dbv.ptszVal); } diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index eb8047691e..aa07621ba0 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -156,7 +156,7 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_GROUPALIGN, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Automatic (RTL)")); DWORD exStyle = cfg::getDword("CLC", "ExStyle", pcli->pfnGetDefaultExStyle()); - for (int i = 0; i < SIZEOF(checkBoxToGroupStyleEx); i++) + for (int i = 0; i < _countof(checkBoxToGroupStyleEx); i++) CheckDlgButton(hwndDlg, checkBoxToGroupStyleEx[i].id, (exStyle & checkBoxToGroupStyleEx[i].flag) ^ (checkBoxToGroupStyleEx[i].flag * checkBoxToGroupStyleEx[i].not_t) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_NOGROUPICON, (cfg::dat.dwFlags & CLUI_FRAME_NOGROUPICON) ? BST_CHECKED : BST_UNCHECKED); @@ -195,7 +195,7 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam, if (((LPNMHDR)lParam)->code == PSN_APPLY) { DWORD exStyle = cfg::getDword("CLC", "ExStyle", pcli->pfnGetDefaultExStyle()); - for (int i = 0; i < SIZEOF(checkBoxToGroupStyleEx); i++) { + for (int i = 0; i < _countof(checkBoxToGroupStyleEx); i++) { if ((IsDlgButtonChecked(hwndDlg, checkBoxToGroupStyleEx[i].id) == 0) == checkBoxToGroupStyleEx[i].not_t) exStyle |= checkBoxToGroupStyleEx[i].flag; else @@ -599,10 +599,10 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam DWORD exStyle = cfg::getDword("CLC", "ExStyle", pcli->pfnGetDefaultExStyle()); 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(cfg::getWord("CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0)); - for (int i = 0; i < SIZEOF(checkBoxToStyleEx); i++) + for (int i = 0; i < _countof(checkBoxToStyleEx); i++) CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id, (exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag * checkBoxToStyleEx[i].not_t) ? BST_CHECKED : BST_UNCHECKED); } CheckDlgButton(hwndDlg, IDC_FULLROWSELECT, (cfg::dat.dwFlags & CLUI_FULLROWSELECT) ? BST_CHECKED : BST_UNCHECKED); @@ -744,8 +744,8 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_COMMAND: if (LOWORD(wParam) == IDC_BROWSE) { TCHAR str[MAX_PATH], filter[512]; - GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); - Bitmap_GetFilter(filter, SIZEOF(filter)); + GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str)); + Bitmap_GetFilter(filter, _countof(filter)); OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; @@ -754,7 +754,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ofn.lpstrFilter = filter; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.nMaxFile = SIZEOF(str); + ofn.nMaxFile = _countof(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = _T("bmp"); if (!GetOpenFileName(&ofn)) @@ -787,7 +787,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, cfg::writeByte("CLC", "UseWinColours", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR)); char str[MAX_PATH], strrel[MAX_PATH]; - GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, _countof(str)); if (PathToRelative(str, strrel)) cfg::writeString(NULL, "CLC", "BkBitmap", strrel); else diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 6f8ee502a7..4dd4748b27 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -1110,7 +1110,7 @@ bgskipped: int fHeight = 0; TCHAR szResult[80]; - if (TimeZone_PrintDateTime(cEntry->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) + if (TimeZone_PrintDateTime(cEntry->hTimeZone, _T("t"), szResult, _countof(szResult), 0)) goto nodisplay; COLORREF oldColor = GetTextColor(hdcMem); @@ -1501,7 +1501,7 @@ bgdone: pts[5].x = pts[2].x + 1; pts[5].y = pts[1].y + 2; pts[6].x = pts[1].x; pts[6].y = pts[5].y; pts[7].x = pts[0].x; pts[7].y = pts[4].y; - HRGN hRgn = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE); + HRGN hRgn = CreatePolygonRgn(pts, _countof(pts), ALTERNATE); HBRUSH hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour); HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBrush); FillRgn(hdcMem, hRgn, hBrush); diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 26be09aaac..bb19f80c8e 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -66,7 +66,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != NULL) { if (szProto) { char szBuf[128]; - mir_snprintf(szBuf, SIZEOF(szBuf), "%s_conn", szProto); + mir_snprintf(szBuf, _countof(szBuf), "%s_conn", szProto); *phIcon = IcoLib_GetIcon(szBuf); } } diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 3561a641f8..94dddfd150 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -247,18 +247,18 @@ static void CacheClientIcons() for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) { char szBuffer[128]; - mir_snprintf(szBuffer, SIZEOF(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE)); + mir_snprintf(szBuffer, _countof(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE)); overlayicons[i - IDI_OVL_OFFLINE] = IcoLib_GetIcon(szBuffer); } } static void InitIcoLib() { - Icon_Register(g_hInst, LPGEN("Contact list")"/"LPGEN("Default"), myIcons, SIZEOF(myIcons)); + Icon_Register(g_hInst, LPGEN("Contact list")"/"LPGEN("Default"), myIcons, _countof(myIcons)); for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) { char szBuffer[128]; - mir_snprintf(szBuffer, SIZEOF(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE)); + mir_snprintf(szBuffer, _countof(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE)); IconItemT icon = { pcli->pfnGetStatusModeDescription(ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE), GSMDF_TCHAR), szBuffer, i }; Icon_RegisterT(g_hInst, LPGENT("Contact list")_T("/")LPGENT("Overlay icons"), &icon, 1); } @@ -271,7 +271,7 @@ static void InitIcoLib() continue; TCHAR szDescr[128]; - mir_sntprintf(szDescr, SIZEOF(szDescr), TranslateT("%s connecting"), accs[k]->tszAccountName); + mir_sntprintf(szDescr, _countof(szDescr), TranslateT("%s connecting"), accs[k]->tszAccountName); IconItemT icon = { szDescr, "conn", IDI_PROTOCONNECTING }; Icon_RegisterT(g_hInst, LPGENT("Contact list")_T("/")LPGENT("Connecting icons"), &icon, 1, accs[k]->szModuleName); } @@ -1424,7 +1424,7 @@ skipbg: if (serviceFailure) { char szError[512]; - mir_snprintf(szError, SIZEOF(szError), Translate("The service %s specified by the %s button definition was not found. You may need to install additional plugins."), item->szService, item->szName); + mir_snprintf(szError, _countof(szError), Translate("The service %s specified by the %s button definition was not found. You may need to install additional plugins."), item->szService, item->szName); MessageBoxA(0, szError, Translate("Service failure"), MB_OK); } break; @@ -1685,7 +1685,7 @@ buttons_done: if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE) { char szBuffer[128]; - mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s_conn", pd->RealName); + mir_snprintf(szBuffer, _countof(szBuffer), "%s_conn", pd->RealName); hIcon = IcoLib_GetIcon(szBuffer); } else if (cfg::dat.bShowXStatusOnSbar && status > ID_STATUS_OFFLINE) { @@ -1733,8 +1733,8 @@ buttons_done: TCHAR szName[64]; PROTOACCOUNT *pa = Proto_GetAccount(szProto); if (pa) { - mir_tstrncpy(szName, pa->tszAccountName, SIZEOF(szName)); - szName[SIZEOF(szName) - 1] = 0; + mir_tstrncpy(szName, pa->tszAccountName, _countof(szName)); + szName[_countof(szName) - 1] = 0; } else szName[0] = 0; @@ -2012,12 +2012,12 @@ static clistFontDescr[] = void FS_RegisterFonts() { FontIDT fid = { sizeof(fid) }; - _tcsncpy(fid.group, LPGENT("Contact list"), SIZEOF(fid.group)); + _tcsncpy(fid.group, LPGENT("Contact list"), _countof(fid.group)); strncpy(fid.dbSettingsGroup, "CLC", 5); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE; HDC hdc = GetDC(NULL); - for (int i = 0; i < SIZEOF(clistFontDescr); i++) { + for (int i = 0; i < _countof(clistFontDescr); i++) { LOGFONT lf; pcli->pfnGetFontSetting(i, &lf, &fid.deffontsettings.colour); lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); @@ -2030,11 +2030,11 @@ void FS_RegisterFonts() fid.flags &= ~FIDF_CLASSMASK; fid.flags |= clistFontDescr[i].iMask; - _tcsncpy(fid.name, clistFontDescr[i].tszName, SIZEOF(fid.name)); + _tcsncpy(fid.name, clistFontDescr[i].tszName, _countof(fid.name)); char idstr[10]; mir_snprintf(idstr, "Font%d", i); - strncpy(fid.prefix, idstr, SIZEOF(fid.prefix)); + strncpy(fid.prefix, idstr, _countof(fid.prefix)); fid.order = i; FontRegisterT(&fid); } @@ -2047,32 +2047,32 @@ void FS_RegisterFonts() strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); - _tcsncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group)); + _tcsncpy(colourid.name, LPGENT("Background"), _countof(colourid.name)); + _tcsncpy(colourid.group, LPGENT("Contact list"), _countof(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; ColourRegisterT(&colourid); strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name)); + _tcsncpy(colourid.name, LPGENT("Selected text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; ColourRegisterT(&colourid); strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name)); + _tcsncpy(colourid.name, LPGENT("Hottrack text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; ColourRegisterT(&colourid); strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name)); + _tcsncpy(colourid.name, LPGENT("Quicksearch text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; ColourRegisterT(&colourid); strncpy(colourid.dbSettingsGroup, "CLUI", sizeof(colourid.dbSettingsGroup)); strncpy(colourid.setting, "clr_frameborder", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Embedded frames border"), SIZEOF(colourid.name)); + _tcsncpy(colourid.name, LPGENT("Embedded frames border"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = RGB(40, 40, 40); ColourRegisterT(&colourid); diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 7fac4e76ba..3bdd48aeb9 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -241,7 +241,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { TCHAR title[256]; - GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title)); + GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title)); cfg::writeTString(NULL, "CList", "TitleText", title); SetWindowText(pcli->hwndContactList, title); } diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 906ebbf6aa..351e4073c4 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -33,7 +33,7 @@ static INT_PTR GetClistVersion(WPARAM, LPARAM lParam) { static char g_szVersionString[256]; - mir_snprintf(g_szVersionString, SIZEOF(g_szVersionString), "%s, %d.%d.%d.%d", pluginInfo.shortName, HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOBYTE(pluginInfo.version))); + mir_snprintf(g_szVersionString, _countof(g_szVersionString), "%s, %d.%d.%d.%d", pluginInfo.shortName, HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOBYTE(pluginInfo.version))); if (!IsBadWritePtr((LPVOID)lParam, 4)) *((DWORD *)lParam) = pluginInfo.version; @@ -133,8 +133,8 @@ void CluiProtocolStatusChanged(int, const char*) if (showOpts & 1) x += 16; if (showOpts & 2) { - mir_tstrncpy(szName, pa->tszAccountName, SIZEOF(szName)); - szName[SIZEOF(szName) - 1] = 0; + mir_tstrncpy(szName, pa->tszAccountName, _countof(szName)); + szName[_countof(szName) - 1] = 0; if ((showOpts & 4) && mir_tstrlen(szName) < sizeof(szName) - 1) mir_tstrcat(szName, _T(" ")); GetTextExtentPoint32(hdc, szName, (int)mir_tstrlen(szName), &textSize); @@ -211,7 +211,7 @@ void CluiProtocolStatusChanged(int, const char*) iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : NULL, (int)wStatus, 0, &hIcon); g_maxStatus = (int)wStatus; if (szMaxProto) - strncpy_s(g_maxProto, SIZEOF(g_maxProto), szMaxProto, _TRUNCATE); + strncpy_s(g_maxProto, _countof(g_maxProto), szMaxProto, _TRUNCATE); } /* diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index b7163ef979..ba013a2202 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -253,13 +253,13 @@ INT_PTR CALLBACK API::Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM) case WM_INITDIALOG: { char szBuffer[2048]; #ifdef _WIN64 - mir_snprintf(szBuffer, SIZEOF(szBuffer), + mir_snprintf(szBuffer, _countof(szBuffer), "Exception %16.16X at address %16.16X occured in %s at line %d.\r\n\r\nEAX=%16.16X EBX=%16.16X ECX=%16.16X\r\nEDX=%16.16X ESI=%16.16X EDI=%16.16X\r\nEBP=%16.16X ESP=%16.16X EIP=%16.16X", exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine, exCtx.Rax, exCtx.Rbx, exCtx.Rcx, exCtx.Rdx, exCtx.Rsi, exCtx.Rdi, exCtx.Rbp, exCtx.Rsp, exCtx.Rip); #else - mir_snprintf(szBuffer, SIZEOF(szBuffer), + mir_snprintf(szBuffer, _countof(szBuffer), "Exception %8.8X at address %8.8X occured in %s at line %d.\r\n\r\nEAX=%8.8X EBX=%8.8X ECX=%8.8X\r\nEDX=%8.8X ESI=%8.8X EDI=%8.8X\r\nEBP=%8.8X ESP=%8.8X EIP=%8.8X", exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine, exCtx.Eax,exCtx.Ebx, exCtx.Ecx, exCtx.Edx, @@ -303,8 +303,8 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, TCH memcpy(&exRecord, ep->ExceptionRecord, sizeof(EXCEPTION_RECORD)); memcpy(&exCtx, ep->ContextRecord, sizeof(CONTEXT)); - mir_snprintf(exSzFile, SIZEOF(exSzFile), "%s%s", szName, szExt); - mir_sntprintf(exReason, SIZEOF(exReason), _T("An application error has occured: %s"), szReason); + mir_snprintf(exSzFile, _countof(exSzFile), "%s%s", szName, szExt); + mir_sntprintf(exReason, _countof(exReason), _T("An application error has occured: %s"), szReason); exLine = line; exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, Ex_DlgProc, 0); exAllowContinue = fAllowContinue; @@ -370,7 +370,7 @@ void CRTException::display() const TCHAR *tszMsg = mir_a2t(what()); TCHAR tszBoxMsg[500]; - mir_sntprintf(tszBoxMsg, SIZEOF(tszBoxMsg), _T("%s\n\n(%s)"), tszMsg, m_szParam); + mir_sntprintf(tszBoxMsg, _countof(tszBoxMsg), _T("%s\n\n(%s)"), tszMsg, m_szParam); ::MessageBox(0, tszBoxMsg, _T("Clist_nicer runtime error"), MB_OK | MB_ICONERROR); mir_free(tszMsg); } diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 4349b1130d..937a550431 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -260,7 +260,7 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto) if (szProto == NULL) return NULL; - for (int i = SIZEOF(_StatusItems); i < arStatusItems.getCount(); i++) { + for (int i = _countof(_StatusItems); i < arStatusItems.getCount(); i++) { StatusItems_t *p = arStatusItems[i]; if (!mir_strcmp(p->szName[0] == '{' ? p->szName+3 : p->szName, szProto)) return p; @@ -272,7 +272,7 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto) void LoadExtBkSettingsFromDB() { int i, n; - for (i = 0; i < SIZEOF(_StatusItems); i++) { + for (i = 0; i < _countof(_StatusItems); i++) { StatusItems_t *p = (StatusItems_t*)mir_alloc(sizeof(StatusItems_t)); *p = _StatusItems[i]; arStatusItems.insert(p); @@ -287,9 +287,9 @@ void LoadExtBkSettingsFromDB() *p = _StatusItems[0]; ID_EXTBK_LAST++; - mir_snprintf(p->szDBname, SIZEOF(p->szDBname), "EXBK_%s", accs[i]->szModuleName); + mir_snprintf(p->szDBname, _countof(p->szDBname), "EXBK_%s", accs[i]->szModuleName); if (i == 0) - mir_snprintf(p->szName, SIZEOF(p->szName), "{-}%s", accs[i]->szModuleName); + mir_snprintf(p->szName, _countof(p->szName), "{-}%s", accs[i]->szModuleName); else strncpy_s(p->szName, accs[i]->szModuleName, _TRUNCATE); p->statusID = ID_EXTBK_LAST; @@ -487,34 +487,34 @@ void extbk_export(char *file) } for (n = 0; n <= FONTID_LAST; n++) { - mir_snprintf(szSection, SIZEOF(szSection), "Font%d", n); + mir_snprintf(szSection, _countof(szSection), "Font%d", n); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dName", n); + mir_snprintf(szKey, _countof(szKey), "Font%dName", n); if (!cfg::getString(NULL, "CLC", szKey, &dbv)) { WritePrivateProfileStringA(szSection, "Name", dbv.pszVal, file); mir_free(dbv.pszVal); } - mir_snprintf(szKey, SIZEOF(szKey), "Font%dSize", n); + mir_snprintf(szKey, _countof(szKey), "Font%dSize", n); data = (DWORD)cfg::getByte("CLC", szKey, 8); WritePrivateProfileStructA(szSection, "Size", &data, 1, file); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dSty", n); + mir_snprintf(szKey, _countof(szKey), "Font%dSty", n); data = (DWORD)cfg::getByte("CLC", szKey, 8); WritePrivateProfileStructA(szSection, "Style", &data, 1, file); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dSet", n); + mir_snprintf(szKey, _countof(szKey), "Font%dSet", n); data = (DWORD)cfg::getByte("CLC", szKey, 8); WritePrivateProfileStructA(szSection, "Set", &data, 1, file); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dCol", n); + mir_snprintf(szKey, _countof(szKey), "Font%dCol", n); data = cfg::getDword("CLC", szKey, 8); WritePrivateProfileStructA(szSection, "Color", &data, 4, file); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dFlags", n); + mir_snprintf(szKey, _countof(szKey), "Font%dFlags", n); data = (DWORD)cfg::getDword("CLC", szKey, 8); WritePrivateProfileStructA(szSection, "Flags", &data, 4, file); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dAs", n); + mir_snprintf(szKey, _countof(szKey), "Font%dAs", n); data = (DWORD)cfg::getWord("CLC", szKey, 8); WritePrivateProfileStructA(szSection, "SameAs", &data, 2, file); } @@ -700,12 +700,12 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file) this_item->ALPHA = min(this_item->ALPHA, 100); clr = RGB(GetBValue(defaults->COLOR), GetGValue(defaults->COLOR), GetRValue(defaults->COLOR)); - mir_snprintf(def_color, SIZEOF(def_color), "%6.6x", clr); + mir_snprintf(def_color, _countof(def_color), "%6.6x", clr); GetPrivateProfileStringA(szItem, "Color1", def_color, buffer, 400, file); this_item->COLOR = HexStringToLong(buffer); clr = RGB(GetBValue(defaults->COLOR2), GetGValue(defaults->COLOR2), GetRValue(defaults->COLOR2)); - mir_snprintf(def_color, SIZEOF(def_color), "%6.6x", clr); + mir_snprintf(def_color, _countof(def_color), "%6.6x", clr); GetPrivateProfileStringA(szItem, "Color2", def_color, buffer, 400, file); this_item->COLOR2 = HexStringToLong(buffer); @@ -777,7 +777,7 @@ done_with_glyph: strncpy(tmpItem.szName, &itemname[1], sizeof(tmpItem.szName)); tmpItem.szName[sizeof(tmpItem.szName) - 1] = 0; _splitpath(szFileName, szDrive, szPath, NULL, NULL); - mir_snprintf(szFinalName, SIZEOF(szFinalName), "%s\\%s\\%s", szDrive, szPath, buffer); + mir_snprintf(szFinalName, _countof(szFinalName), "%s\\%s\\%s", szDrive, szPath, buffer); tmpItem.alpha = GetPrivateProfileIntA(itemname, "Alpha", 100, szFileName); tmpItem.alpha = min(tmpItem.alpha, 100); tmpItem.alpha = (BYTE)((FLOAT)(((FLOAT)tmpItem.alpha) / 100) * 255); @@ -853,7 +853,7 @@ done_with_glyph: goto imgread_done; } for (n = 0;; n++) { - mir_snprintf(szItemNr, SIZEOF(szItemNr), "Item%d", n); + mir_snprintf(szItemNr, _countof(szItemNr), "Item%d", n); GetPrivateProfileStringA(itemname, szItemNr, "None", buffer, 500, szFileName); if (!mir_strcmp(buffer, "None")) break; @@ -1274,7 +1274,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) char UIN[40]; switch (dbv.type) { case DBVT_DWORD: - mir_snprintf(UIN, SIZEOF(UIN), "%d", dbv.dVal); + mir_snprintf(UIN, _countof(UIN), "%d", dbv.dVal); break; case DBVT_ASCIIZ: strncpy_s(UIN, dbv.pszVal, _TRUNCATE); @@ -1363,38 +1363,38 @@ void extbk_import(char *file, HWND hwndDlg) GetPrivateProfileStructA("Global", "Version", &version, 4, file); if (version >= 2) { for (n = 0; n <= FONTID_LAST; n++) { - mir_snprintf(szSection, SIZEOF(szSection), "Font%d", n); + mir_snprintf(szSection, _countof(szSection), "Font%d", n); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dName", n); + mir_snprintf(szKey, _countof(szKey), "Font%dName", n); GetPrivateProfileStringA(szSection, "Name", "Arial", buffer, sizeof(buffer), file); cfg::writeString(NULL, "CLC", szKey, buffer); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dSize", n); + mir_snprintf(szKey, _countof(szKey), "Font%dSize", n); data = 0; GetPrivateProfileStructA(szSection, "Size", &data, 1, file); cfg::writeByte("CLC", szKey, (BYTE)data); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dSty", n); + mir_snprintf(szKey, _countof(szKey), "Font%dSty", n); data = 0; GetPrivateProfileStructA(szSection, "Style", &data, 1, file); cfg::writeByte("CLC", szKey, (BYTE)data); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dSet", n); + mir_snprintf(szKey, _countof(szKey), "Font%dSet", n); data = 0; GetPrivateProfileStructA(szSection, "Set", &data, 1, file); cfg::writeByte("CLC", szKey, (BYTE)data); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dCol", n); + mir_snprintf(szKey, _countof(szKey), "Font%dCol", n); data = 0; GetPrivateProfileStructA(szSection, "Color", &data, 4, file); cfg::writeDword("CLC", szKey, data); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dFlags", n); + mir_snprintf(szKey, _countof(szKey), "Font%dFlags", n); data = 0; GetPrivateProfileStructA(szSection, "Flags", &data, 4, file); cfg::writeDword("CLC", szKey, (WORD)data); - mir_snprintf(szKey, SIZEOF(szKey), "Font%dAs", n); + mir_snprintf(szKey, _countof(szKey), "Font%dAs", n); data = 0; GetPrivateProfileStructA(szSection, "SameAs", &data, 2, file); cfg::writeDword("CLC", szKey, (WORD)data); @@ -1563,7 +1563,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_RELOAD: TCHAR tszFilename[MAX_PATH], tszFinalPath[MAX_PATH]; - GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, SIZEOF(tszFilename)); + GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, _countof(tszFilename)); tszFilename[MAX_PATH - 1] = 0; MY_pathToAbsolute(tszFilename, tszFinalPath); if (PathFileExists(tszFinalPath)) { @@ -1666,7 +1666,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ofn.lpstrFilter = "*.clist"; ofn.lpstrFile = str; ofn.Flags = OFN_HIDEREADONLY; - ofn.nMaxFile = SIZEOF(str); + ofn.nMaxFile = _countof(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "clist"; if (!GetSaveFileNameA(&ofn)) @@ -1684,7 +1684,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ofn.lpstrFilter = "*.clist"; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST; - ofn.nMaxFile = SIZEOF(str); + ofn.nMaxFile = _countof(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = ""; if (!GetOpenFileNameA(&ofn)) diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index aee0daaf58..a7eb1b83cb 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -95,7 +95,7 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd) int other_fonts[] = { FONTID_GROUPS, FONTID_GROUPCOUNTS, FONTID_DIVIDERS }; // Get contact font size - for (i = 0; i < SIZEOF(contact_fonts); i++) + for (i = 0; i < _countof(contact_fonts); i++) if (max_height < dat->fontInfo[contact_fonts[i]].fontHeight) max_height = dat->fontInfo[contact_fonts[i]].fontHeight; @@ -103,7 +103,7 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd) max_height += ROW_SPACE_BEETWEEN_LINES + dat->fontInfo[FONTID_STATUS].fontHeight; // Get other font sizes - for (i = 0; i < SIZEOF(other_fonts); i++) { + for (i = 0; i < _countof(other_fonts); i++) { if (max_height < dat->fontInfo[other_fonts[i]].fontHeight) max_height = dat->fontInfo[other_fonts[i]].fontHeight; } diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index 52a96f8b7d..774e193a8d 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -160,7 +160,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM BYTE isLocked = cfg::getByte(PD->RealName, "LockMainStatus", 0); TCHAR szTipText[256]; - mir_sntprintf(szTipText, SIZEOF(szTipText), _T("%s: %s%s"), + mir_sntprintf(szTipText, _countof(szTipText), _T("%s: %s%s"), PD->RealName, pcli->pfnGetStatusModeDescription(wStatus, 0), isLocked ? _T(" (LOCKED)") : _T("")); CLCINFOTIP ti = { sizeof(ti) }; diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 3a89f5c938..c19d607890 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -342,7 +342,7 @@ void SaveState() if (ListView_GetCheckState(hwndList, i)) { item.mask = LVIF_TEXT; item.pszText = szTemp; - item.cchTextMax = SIZEOF(szTemp); + item.cchTextMax = _countof(szTemp); item.iItem = i; SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item); @@ -364,7 +364,7 @@ void SaveState() if (ListView_GetCheckState(hwndList, i)) { item.mask = LVIF_TEXT; item.pszText = szTemp; - item.cchTextMax = SIZEOF(szTemp); + item.cchTextMax = _countof(szTemp); item.iItem = i; SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item); @@ -475,12 +475,12 @@ void UpdateFilters() item.mask = LVIF_TEXT; item.pszText = szTemp; - item.cchTextMax = SIZEOF(szTemp); + item.cchTextMax = _countof(szTemp); for (i = 0; i < ListView_GetItemCount(hwndList); i++) { item.iItem = i; SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item); - mir_snprintf(szMask, SIZEOF(szMask), "%s|", szTemp); + mir_snprintf(szMask, _countof(szMask), "%s|", szTemp); if (dbv_pf.pszVal && strstr(dbv_pf.pszVal, szMask)) ListView_SetCheckState(hwndList, i, TRUE) else @@ -497,14 +497,14 @@ void UpdateFilters() item.mask = LVIF_TEXT; item.pszText = szTemp; - item.cchTextMax = SIZEOF(szTemp); + item.cchTextMax = _countof(szTemp); ListView_SetCheckState(hwndList, 0, dwFlags & CLVM_INCLUDED_UNGROUPED ? TRUE : FALSE); for (i = 1; i < ListView_GetItemCount(hwndList); i++) { item.iItem = i; SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item); - mir_sntprintf(szMask, SIZEOF(szMask), _T("%s|"), szTemp); + mir_sntprintf(szMask, _countof(szMask), _T("%s|"), szTemp); if (dbv_gf.ptszVal && _tcsstr(dbv_gf.ptszVal, szMask)) ListView_SetCheckState(hwndList, i, TRUE) else @@ -690,7 +690,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP char szBuf[256]; szBuf[0] = 0; - GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, SIZEOF(szBuf)); + GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, _countof(szBuf)); szBuf[255] = 0; if (mir_strlen(szBuf) > 2) { @@ -883,7 +883,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_USER + 100: { bool bSkinned = cfg::getByte("CLCExt", "bskinned", 0) != 0; - for (int i = 0; i < SIZEOF(_buttons); i++) { + for (int i = 0; i < _countof(_buttons); i++) { HWND hwndButton = GetDlgItem(hwnd, _buttons[i].btn_id); SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(_buttons[i].icon)); CustomizeButton(hwndButton, bSkinned, !bSkinned, bSkinned); @@ -1060,8 +1060,8 @@ void ApplyViewMode(const char *name) mir_snprintf(szSetting, "%c%s_GF", 246, name); if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) { if (mir_tstrlen(dbv.ptszVal) >= 2) { - _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, SIZEOF(cfg::dat.groupFilter)); - cfg::dat.groupFilter[SIZEOF(cfg::dat.groupFilter) - 1] = 0; + _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, _countof(cfg::dat.groupFilter)); + cfg::dat.groupFilter[_countof(cfg::dat.groupFilter) - 1] = 0; cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS; } mir_free(dbv.ptszVal); -- cgit v1.2.3