winhlp32: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-08-10 12:27:55 +02:00 committed by Alexandre Julliard
parent c33c75fc77
commit 038d9e8ab9
3 changed files with 8 additions and 8 deletions

View file

@ -154,7 +154,7 @@ void CALLBACK MACRO_About(void)
WCHAR name[256];
HICON icon = LoadImageW( Globals.hInstance, MAKEINTRESOURCEW(IDI_WINHELP),
IMAGE_ICON, 48, 48, LR_SHARED );
LoadStringW( Globals.hInstance, STID_WINE_HELP, name, sizeof(name)/sizeof(WCHAR) );
LoadStringW( Globals.hInstance, STID_WINE_HELP, name, ARRAY_SIZE( name ));
ShellAboutW( MACRO_CurrentWindow()->hMainWnd, name, NULL, icon );
}

View file

@ -75,7 +75,7 @@ struct lexret yylval;
/* opening a new one */
if (lex_data->quote_stk_idx == 0)
{
assert(lex_data->cache_used < sizeof(lex_data->cache_string) / sizeof(lex_data->cache_string[0]));
assert(lex_data->cache_used < ARRAY_SIZE(lex_data->cache_string));
lex_data->strptr = lex_data->cache_string[lex_data->cache_used] = HeapAlloc(GetProcessHeap(), 0, strlen(lex_data->macroptr) + 1);
yylval.string = lex_data->strptr;
lex_data->cache_used++;
@ -83,7 +83,7 @@ struct lexret yylval;
}
else *lex_data->strptr++ = yytext[0];
lex_data->quote_stack[lex_data->quote_stk_idx++] = yytext[0];
assert(lex_data->quote_stk_idx < sizeof(lex_data->quote_stack) / sizeof(lex_data->quote_stack[0]));
assert(lex_data->quote_stk_idx < ARRAY_SIZE(lex_data->quote_stack));
}
else
{
@ -222,7 +222,7 @@ CheckArgs_end:
static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret)
{
void* pa[2];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
int idx = MACRO_CheckArgs(pa, ARRAY_SIZE(pa), args);
if (idx < 0) return 0;
if (!fn) return 1;
@ -257,7 +257,7 @@ static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret)
static int MACRO_CallVoidFunc(void *fn, const char* args)
{
void* pa[6];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
int idx = MACRO_CheckArgs(pa, ARRAY_SIZE(pa), args);
if (idx < 0) return 0;
if (!fn) return 1;

View file

@ -595,7 +595,7 @@ static void WINHELP_RememberPage(WINHELP_WINDOW* win, WINHELP_WNDPAGE* wpage)
if (!Globals.history.index || Globals.history.set[0].page != wpage->page)
{
num = sizeof(Globals.history.set) / sizeof(Globals.history.set[0]);
num = ARRAY_SIZE(Globals.history.set);
/* we're full, remove latest entry */
if (Globals.history.index == num)
{
@ -610,7 +610,7 @@ static void WINHELP_RememberPage(WINHELP_WINDOW* win, WINHELP_WNDPAGE* wpage)
}
if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE);
num = sizeof(win->back.set) / sizeof(win->back.set[0]);
num = ARRAY_SIZE(win->back.set);
if (win->back.index == num)
{
/* we're full, remove latest entry */
@ -1136,7 +1136,7 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
GetWindowRect(hWnd, &r);
r.right = r.left + 30 * tm.tmAveCharWidth;
r.bottom = r.top + (sizeof(Globals.history.set) / sizeof(Globals.history.set[0])) * tm.tmHeight;
r.bottom = r.top + ARRAY_SIZE(Globals.history.set) * tm.tmHeight;
AdjustWindowRect(&r, GetWindowLongW(hWnd, GWL_STYLE), FALSE);
if (r.left < 0) {r.right -= r.left; r.left = 0;}
if (r.top < 0) {r.bottom -= r.top; r.top = 0;}