Commit db2a3b70 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32: Use ARRAY_SIZE() macro.

parent 71627251
......@@ -38,6 +38,8 @@
extern HMODULE COMCTL32_hModule DECLSPEC_HIDDEN;
extern HBRUSH COMCTL32_hPattern55AABrush DECLSPEC_HIDDEN;
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/* Property sheet / Wizard */
#define IDD_PROPSHEET 1006
#define IDD_WIZARD 1020
......
......@@ -107,7 +107,7 @@ static void unregister_versioned_classes(void)
};
int i;
for (i = 0; i < sizeof(classes)/sizeof(classes[0]); i++)
for (i = 0; i < ARRAY_SIZE(classes); i++)
UnregisterClassA(classes[i], NULL);
#undef VERSION
......@@ -287,7 +287,7 @@ MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
if (uMenuID) {
WCHAR szText[256];
if (!LoadStringW (hInst, uMenuID, szText, sizeof(szText)/sizeof(szText[0])))
if (!LoadStringW (hInst, uMenuID, szText, ARRAY_SIZE(szText)))
szText[0] = '\0';
SendMessageW (hwndStatus, SB_SETTEXTW,
......
......@@ -328,7 +328,7 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR format)
format_item = LOCALE_STIMEFORMAT;
else /* DTS_SHORTDATEFORMAT */
format_item = LOCALE_SSHORTDATE;
GetLocaleInfoW(LOCALE_USER_DEFAULT, format_item, format_buf, sizeof(format_buf)/sizeof(format_buf[0]));
GetLocaleInfoW(LOCALE_USER_DEFAULT, format_item, format_buf, ARRAY_SIZE(format_buf));
format = format_buf;
}
......@@ -449,8 +449,7 @@ DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int
wsprintfW (result, fmt__2dW, date.wMonth);
break;
case THREECHARMONTH:
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+date.wMonth -1,
buffer, sizeof(buffer)/sizeof(buffer[0]));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+date.wMonth -1, buffer, ARRAY_SIZE(buffer));
wsprintfW (result, fmt__3sW, buffer);
break;
case FULLMONTH:
......@@ -742,14 +741,14 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
WCHAR txt[80];
DATETIME_ReturnTxt (infoPtr, 0, txt, sizeof(txt)/sizeof(txt[0]));
DATETIME_ReturnTxt (infoPtr, 0, txt, ARRAY_SIZE(txt));
GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
rcDraw->bottom = size.cy + 2;
prevright = infoPtr->checkbox.right = ((infoPtr->dwStyle & DTS_SHOWNONE) ? 18 : 2);
for (i = 0; i < infoPtr->nrFields; i++) {
DATETIME_ReturnTxt (infoPtr, i, txt, sizeof(txt)/sizeof(txt[0]));
DATETIME_ReturnTxt (infoPtr, i, txt, ARRAY_SIZE(txt));
GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
DATETIME_ReturnFieldWidth (infoPtr, hdc, i, &fieldWidth);
field = &infoPtr->fieldRect[i];
......@@ -1530,7 +1529,7 @@ DATETIME_GetText (const DATETIME_INFO *infoPtr, INT count, LPWSTR dst)
dst[0] = 0;
for (i = 0; i < infoPtr->nrFields; i++)
{
DATETIME_ReturnTxt(infoPtr, i, buf, sizeof(buf)/sizeof(buf[0]));
DATETIME_ReturnTxt(infoPtr, i, buf, ARRAY_SIZE(buf));
if ((strlenW(dst) + strlenW(buf)) < count)
strcatW(dst, buf);
else break;
......
......@@ -11872,7 +11872,7 @@ static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lP
SIZE sz;
if (!infoPtr->hwndEdit || !hdc) return 0;
GetWindowTextW(infoPtr->hwndEdit, buffer, sizeof(buffer)/sizeof(buffer[0]));
GetWindowTextW(infoPtr->hwndEdit, buffer, ARRAY_SIZE(buffer));
GetWindowRect(infoPtr->hwndEdit, &rect);
/* Select font to get the right dimension of the string */
......
......@@ -65,8 +65,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
#define MC_CALENDAR_PADDING 6
#define countof(arr) (sizeof(arr)/sizeof(arr[0]))
/* convert from days to 100 nanoseconds unit - used as FILETIME unit */
#define DAYSTO100NSECS(days) (((ULONGLONG)(days))*24*60*60*10000000)
......@@ -886,18 +884,18 @@ static void MONTHCAL_PaintTitle(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRU
SelectObject(hdc, infoPtr->hBoldFont);
/* draw formatted date string */
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_YEARMONTH, st, NULL, strW, countof(strW));
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_YEARMONTH, st, NULL, strW, ARRAY_SIZE(strW));
DrawTextW(hdc, strW, strlenW(strW), title, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SYEARMONTH, fmtW, countof(fmtW));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SYEARMONTH, fmtW, ARRAY_SIZE(fmtW));
wsprintfW(yearW, fmtyearW, st->wYear);
/* month is trickier as it's possible to have different format pictures, we'll
test for M, MM, MMM, and MMMM */
if (strstrW(fmtW, mmmmW))
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+st->wMonth-1, monthW, countof(monthW));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+st->wMonth-1, monthW, ARRAY_SIZE(monthW));
else if (strstrW(fmtW, mmmW))
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1+st->wMonth-1, monthW, countof(monthW));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1+st->wMonth-1, monthW, ARRAY_SIZE(monthW));
else if (strstrW(fmtW, mmW))
wsprintfW(monthW, fmtmmW, st->wMonth);
else
......@@ -975,7 +973,7 @@ static void MONTHCAL_PaintWeeknumbers(const MONTHCAL_INFO *infoPtr, HDC hdc, con
LOCALE_IFIRSTWEEKOFYEAR == 1 (what countries?)
The first week of the year must contain only days of the new year
*/
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, buf, countof(buf));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, buf, ARRAY_SIZE(buf));
weeknum = atoiW(buf);
switch (weeknum)
{
......@@ -1067,15 +1065,14 @@ static void MONTHCAL_PaintTodayTitle(const MONTHCAL_INFO *infoPtr, HDC hdc, cons
if(infoPtr->dwStyle & MCS_NOTODAY) return;
LoadStringW(COMCTL32_hModule, IDM_TODAY, buf_todayW, countof(buf_todayW));
LoadStringW(COMCTL32_hModule, IDM_TODAY, buf_todayW, ARRAY_SIZE(buf_todayW));
col = infoPtr->dwStyle & MCS_NOTODAYCIRCLE ? 0 : 1;
if (infoPtr->dwStyle & MCS_WEEKNUMBERS) col--;
/* label is located below first calendar last row */
MONTHCAL_GetDayRectI(infoPtr, &text_rect, col, 6, infoPtr->dim.cx * infoPtr->dim.cy - infoPtr->dim.cx);
box_rect = text_rect;
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &infoPtr->todaysDate, NULL,
buf_dateW, countof(buf_dateW));
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &infoPtr->todaysDate, NULL, buf_dateW, ARRAY_SIZE(buf_dateW));
old_font = SelectObject(hdc, infoPtr->hBoldFont);
SetTextColor(hdc, infoPtr->colors[MCSC_TEXT]);
......@@ -1207,7 +1204,7 @@ static void MONTHCAL_PaintCalendar(const MONTHCAL_INFO *infoPtr, HDC hdc, const
i = infoPtr->firstDay;
for(j = 0; j < 7; j++) {
get_localized_dayname(infoPtr, (i + j + 6) % 7, buf, countof(buf));
get_localized_dayname(infoPtr, (i + j + 6) % 7, buf, ARRAY_SIZE(buf));
DrawTextW(hdc, buf, strlenW(buf), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
OffsetRect(&r, infoPtr->width_increment, 0);
}
......@@ -1413,7 +1410,7 @@ MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, INT day)
{
WCHAR buf[80];
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, ARRAY_SIZE(buf));
TRACE("%s %d\n", debugstr_w(buf), strlenW(buf));
new_day = atoiW(buf);
......@@ -2043,7 +2040,7 @@ MONTHCAL_RButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam)
WCHAR buf[32];
hMenu = CreatePopupMenu();
LoadStringW(COMCTL32_hModule, IDM_GOTODAY, buf, countof(buf));
LoadStringW(COMCTL32_hModule, IDM_GOTODAY, buf, ARRAY_SIZE(buf));
AppendMenuW(hMenu, MF_STRING|MF_ENABLED, 1, buf);
menupoint.x = (short)LOWORD(lParam);
menupoint.y = (short)HIWORD(lParam);
......@@ -2199,8 +2196,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
for (i = 0; i < 12; i++)
{
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+i, buf, countof(buf));
AppendMenuW(hMenu, MF_STRING|MF_ENABLED, i + 1, buf);
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+i, buf, ARRAY_SIZE(buf));
AppendMenuW(hMenu, MF_STRING|MF_ENABLED, i + 1, buf);
}
menupoint.x = ht.pt.x;
menupoint.y = ht.pt.y;
......@@ -2522,7 +2519,7 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
{
SIZE sz;
if (get_localized_dayname(infoPtr, i, buff, countof(buff)))
if (get_localized_dayname(infoPtr, i, buff, ARRAY_SIZE(buff)))
{
GetTextExtentPoint32W(hdc, buff, lstrlenW(buff), &sz);
if (sz.cx > day_width) day_width = sz.cx;
......@@ -2530,7 +2527,7 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
else /* locale independent fallback on failure */
{
static const WCHAR sunW[] = { 'S','u','n' };
GetTextExtentPoint32W(hdc, sunW, countof(sunW), &sz);
GetTextExtentPoint32W(hdc, sunW, ARRAY_SIZE(sunW), &sz);
day_width = sz.cx;
break;
}
......
......@@ -551,7 +551,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
if (IS_INTRESOURCE( lppsp->pszTitle ))
{
if (LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle, szTitle, sizeof(szTitle)/sizeof(szTitle[0]) ))
if (LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle, szTitle, ARRAY_SIZE(szTitle)))
pTitle = szTitle;
else if (*p)
pTitle = p;
......@@ -2115,8 +2115,7 @@ static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText)
if(!IS_INTRESOURCE(lpszText))
{
WCHAR szTitle[256];
MultiByteToWideChar(CP_ACP, 0, lpszText, -1,
szTitle, sizeof(szTitle)/sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpszText, -1, szTitle, ARRAY_SIZE(szTitle));
PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle);
}
else
......@@ -2135,8 +2134,7 @@ static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText)
TRACE("%s (style %08x)\n", debugstr_w(lpszText), dwStyle);
if (IS_INTRESOURCE(lpszText)) {
if (!LoadStringW(psInfo->ppshheader.hInstance,
LOWORD(lpszText), szTitle, sizeof(szTitle)/sizeof(szTitle[0])))
if (!LoadStringW(psInfo->ppshheader.hInstance, LOWORD(lpszText), szTitle, ARRAY_SIZE(szTitle)))
return;
lpszText = szTitle;
}
......@@ -3684,7 +3682,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND hwndCancel = GetDlgItem(hwnd, IDCANCEL);
EnableWindow(hwndCancel, FALSE);
if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf)/sizeof(buf[0])))
if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, ARRAY_SIZE(buf)))
SetWindowTextW(hwndOK, buf);
return FALSE;
......
......@@ -1042,7 +1042,7 @@ REBAR_MoveChildWindows (const REBAR_INFO *infoPtr, UINT start, UINT endplus)
lpBand->rcChild = rbcz.rcChild; /* *** ??? */
}
GetClassNameW (lpBand->hwndChild, szClassName, sizeof(szClassName)/sizeof(szClassName[0]));
GetClassNameW (lpBand->hwndChild, szClassName, ARRAY_SIZE(szClassName));
if (!lstrcmpW (szClassName, strComboBox) ||
!lstrcmpW (szClassName, WC_COMBOBOXEXW)) {
INT nEditHeight, yPos;
......
......@@ -183,7 +183,7 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
{
if(*current == '<')
{
if(!strncmpiW(current, SL_LINKOPEN, sizeof(SL_LINKOPEN)/sizeof(SL_LINKOPEN[0])) && (CurrentType == slText))
if(!strncmpiW(current, SL_LINKOPEN, ARRAY_SIZE(SL_LINKOPEN)) && (CurrentType == slText))
{
BOOL ValidParam = FALSE, ValidLink = FALSE;
......@@ -211,14 +211,14 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
CheckParameter:
/* compare the current position with all known parameters */
if(!strncmpiW(tmp, SL_HREF, sizeof(SL_HREF)/sizeof(SL_HREF[0])))
if(!strncmpiW(tmp, SL_HREF, ARRAY_SIZE(SL_HREF)))
{
taglen += 6;
ValidParam = TRUE;
CurrentParameter = &lpUrl;
CurrentParameterLen = &lenUrl;
}
else if(!strncmpiW(tmp, SL_ID, sizeof(SL_ID)/sizeof(SL_ID[0])))
else if(!strncmpiW(tmp, SL_ID, ARRAY_SIZE(SL_ID)))
{
taglen += 4;
ValidParam = TRUE;
......@@ -292,7 +292,7 @@ CheckParameter:
}
}
}
else if(!strncmpiW(current, SL_LINKCLOSE, sizeof(SL_LINKCLOSE)/sizeof(SL_LINKCLOSE[0])) && (CurrentType == slLink) && firsttag)
else if(!strncmpiW(current, SL_LINKCLOSE, ARRAY_SIZE(SL_LINKCLOSE)) && (CurrentType == slLink) && firsttag)
{
/* there's a <a...> tag opened, first add the previous text, if present */
if(textstart != NULL && textlen > 0 && firsttag > textstart)
......
......@@ -439,11 +439,11 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
/* Window title */
if (!taskconfig->pszWindowTitle)
titleW = taskdialog_get_exe_name(taskconfig, pathW, sizeof(pathW)/sizeof(pathW[0]));
titleW = taskdialog_get_exe_name(taskconfig, pathW, ARRAY_SIZE(pathW));
else if (IS_INTRESOURCE(taskconfig->pszWindowTitle))
{
if (!LoadStringW(taskconfig->hInstance, LOWORD(taskconfig->pszWindowTitle), (WCHAR *)&titleW, 0))
titleW = taskdialog_get_exe_name(taskconfig, pathW, sizeof(pathW)/sizeof(pathW[0]));
titleW = taskdialog_get_exe_name(taskconfig, pathW, ARRAY_SIZE(pathW));
}
else
titleW = taskconfig->pszWindowTitle;
......
......@@ -114,8 +114,7 @@ LRESULT CALLBACK THEMING_DialogSubclassProc (HWND hWnd, UINT msg,
WCHAR controlClass[32];
RECT rc;
GetClassNameW (controlWnd, controlClass,
sizeof(controlClass) / sizeof(controlClass[0]));
GetClassNameW (controlWnd, controlClass, ARRAY_SIZE(controlClass));
if (lstrcmpiW (controlClass, WC_STATICW) == 0)
{
/* Static control - draw parent background and set text to
......
......@@ -51,7 +51,7 @@ static const struct ThemingSubclass
{WC_SCROLLBARW, THEMING_ScrollbarSubclassProc}
};
#define NUM_SUBCLASSES (sizeof(subclasses)/sizeof(subclasses[0]))
#define NUM_SUBCLASSES (ARRAY_SIZE(subclasses))
static WNDPROC originalProcs[NUM_SUBCLASSES];
static ATOM atRefDataProp;
......
......@@ -4239,7 +4239,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
memset( &tb, 0, sizeof(tb) );
tb.iItem = i;
tb.cchText = sizeof(buf) / sizeof(buf[0]);
tb.cchText = ARRAY_SIZE(buf);
tb.pszText = buf;
/* Use the same struct for both A and W versions since the layout is the same. */
......@@ -6146,7 +6146,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
TRACE("TBN_GETINFOTIPW - got string %s\n", debugstr_w(tbgit.pszText));
len = strlenW(tbgit.pszText);
if (len > sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0])-1)
if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
{
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the
......@@ -6184,7 +6184,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
TRACE("TBN_GETINFOTIPA - got string %s\n", debugstr_a(tbgit.pszText));
len = MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, NULL, 0);
if (len > sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0]))
if (len > ARRAY_SIZE(lpnmtdi->szText))
{
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the
......@@ -6199,8 +6199,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
}
else if (tbgit.pszText && tbgit.pszText[0])
{
MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1,
lpnmtdi->lpszText, sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0]));
MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, lpnmtdi->lpszText, ARRAY_SIZE(lpnmtdi->szText));
return 0;
}
}
......@@ -6215,7 +6214,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
TRACE("using button hidden text %s\n", debugstr_w(pszText));
if (len > sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0])-1)
if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
{
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the
......
......@@ -808,7 +808,7 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
}
}
hrStem = CreatePolygonRgn(pts, sizeof(pts) / sizeof(pts[0]), ALTERNATE);
hrStem = CreatePolygonRgn(pts, ARRAY_SIZE(pts), ALTERNATE);
hRgn = CreateRoundRectRgn(0,
(infoPtr->bToolBelow ? BALLOON_STEMHEIGHT : 0),
......
......@@ -684,7 +684,7 @@ TRACKBAR_FillThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, HBRUSH hbrush)
oldbr = SelectObject(hdc, hbrush);
SetPolyFillMode(hdc, WINDING);
Polygon(hdc, points, sizeof(points) / sizeof(points[0]));
Polygon(hdc, points, ARRAY_SIZE(points));
SelectObject(hdc, oldbr);
return PointDepth;
......
......@@ -3829,7 +3829,7 @@ TREEVIEW_Command(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
infoPtr->bLabelChanged = TRUE;
GetWindowTextW(infoPtr->hwndEdit, buffer, sizeof(buffer)/sizeof(buffer[0]));
GetWindowTextW(infoPtr->hwndEdit, buffer, ARRAY_SIZE(buffer));
/* Select font to get the right dimension of the string */
hFont = (HFONT)SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0);
......@@ -4639,7 +4639,7 @@ static INT TREEVIEW_ProcessLetterKeys(TREEVIEW_INFO *infoPtr, WPARAM charCode, L
/* update the search parameters */
infoPtr->lastKeyPressTimestamp=timestamp;
if (elapsed < KEY_DELAY) {
if (infoPtr->nSearchParamLength < sizeof(infoPtr->szSearchParam) / sizeof(WCHAR)) {
if (infoPtr->nSearchParamLength < ARRAY_SIZE(infoPtr->szSearchParam)) {
infoPtr->szSearchParam[infoPtr->nSearchParamLength++]=charCode;
}
if (infoPtr->charCode != charCode) {
......
......@@ -89,7 +89,6 @@ typedef struct
#define TIMER_AUTOPRESS 3
#define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongPtrW (hwnd,0))
#define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
/* id used for SetWindowSubclass */
#define BUDDY_SUBCLASSID 1
......@@ -275,7 +274,7 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr)
/* we have a regular window, so will get the text */
/* note that a zero-length string is a legitimate value for 'txt',
* and ought to result in a successful conversion to '0'. */
if (GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt)) < 0)
if (GetWindowTextW(infoPtr->Buddy, txt, ARRAY_SIZE(txt)) < 0)
return FALSE;
sep = UPDOWN_GetThousandSep();
......@@ -328,7 +327,7 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr)
/* Do thousands separation if necessary */
if ((infoPtr->Base == 10) && !(infoPtr->dwStyle & UDS_NOTHOUSANDS) && (len > 3)) {
WCHAR tmp[COUNT_OF(txt)], *src = tmp, *dst = txt;
WCHAR tmp[ARRAY_SIZE(txt)], *src = tmp, *dst = txt;
WCHAR sep = UPDOWN_GetThousandSep();
int start = len % 3;
......@@ -344,7 +343,7 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr)
}
/* if nothing changed exit earlier */
GetWindowTextW(infoPtr->Buddy, txt_old, sizeof(txt_old)/sizeof(WCHAR));
GetWindowTextW(infoPtr->Buddy, txt_old, ARRAY_SIZE(txt_old));
if (lstrcmpiW(txt_old, txt) == 0) return FALSE;
return SetWindowTextW(infoPtr->Buddy, txt);
......@@ -642,7 +641,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
if(bud) {
/* Store buddy window class type */
infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN;
if (GetClassNameW(bud, buddyClass, COUNT_OF(buddyClass))) {
if (GetClassNameW(bud, buddyClass, ARRAY_SIZE(buddyClass))) {
if (lstrcmpiW(buddyClass, WC_EDITW) == 0)
infoPtr->BuddyType = BUDDY_TYPE_EDIT;
else if (lstrcmpiW(buddyClass, WC_LISTBOXW) == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment