Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/winex11.drv/brush.c | 2 +- dlls/winex11.drv/clipboard.c | 4 ++-- dlls/winex11.drv/event.c | 2 +- dlls/winex11.drv/graphics.c | 6 +++--- dlls/winex11.drv/mouse.c | 6 +++--- dlls/winex11.drv/opengl.c | 2 +- dlls/winex11.drv/pen.c | 10 +++++----- dlls/winex11.drv/systray.c | 6 +++--- dlls/winex11.drv/window.c | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/dlls/winex11.drv/brush.c b/dlls/winex11.drv/brush.c index 46bd2dd814..e3e5668b5a 100644 --- a/dlls/winex11.drv/brush.c +++ b/dlls/winex11.drv/brush.c @@ -169,7 +169,7 @@ static Pixmap BRUSH_DitherMono( COLORREF color ) { 0x1, 0x3 }, /* LTGRAY */ }; int gray = (30 * GetRValue(color) + 59 * GetGValue(color) + 11 * GetBValue(color)) / 100; - int idx = gray * (sizeof gray_dither/sizeof gray_dither[0] + 1)/256 - 1; + int idx = gray * (ARRAY_SIZE( gray_dither ) + 1)/256 - 1;
TRACE("color=%06x -> gray=%x\n", color, gray); return XCreateBitmapFromData( gdi_display, root_window, gray_dither[idx], 2, 2 ); diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 296c00c3a5..a37530fdbf 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -1933,12 +1933,12 @@ static LRESULT CALLBACK clipboard_wndproc( HWND hwnd, UINT msg, WPARAM wp, LPARA static BOOL wait_clipboard_mutex(void) { static const WCHAR prefix[] = {'_','_','w','i','n','e','_','c','l','i','p','b','o','a','r','d','_'}; - WCHAR buffer[MAX_PATH + sizeof(prefix) / sizeof(WCHAR)]; + WCHAR buffer[MAX_PATH + ARRAY_SIZE( prefix )]; HANDLE mutex;
memcpy( buffer, prefix, sizeof(prefix) ); if (!GetUserObjectInformationW( GetProcessWindowStation(), UOI_NAME, - buffer + sizeof(prefix) / sizeof(WCHAR), + buffer + ARRAY_SIZE( prefix ), sizeof(buffer) - sizeof(prefix), NULL )) { ERR( "failed to get winstation name\n" ); diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index b36ce6f267..6054f645c4 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1739,7 +1739,7 @@ static BOOL X11DRV_ClientMessage( HWND hwnd, XEvent *xev ) return FALSE; }
- for (i = 0; i < sizeof(client_messages)/sizeof(client_messages[0]); i++) + for (i = 0; i < ARRAY_SIZE( client_messages ); i++) { if (event->message_type == X11DRV_Atoms[client_messages[i].atom - FIRST_XATOM]) { diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c index e8c59f9baf..2209053617 100644 --- a/dlls/winex11.drv/graphics.c +++ b/dlls/winex11.drv/graphics.c @@ -1644,7 +1644,7 @@ BOOL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename ) 'P','r','o','f','i','l','e','.','i','c','m',0}; HKEY hkey; DWORD required, len; - WCHAR profile[MAX_PATH], fullname[2*MAX_PATH + sizeof(color_path)/sizeof(WCHAR)]; + WCHAR profile[MAX_PATH], fullname[2*MAX_PATH + ARRAY_SIZE( color_path )]; unsigned char *buffer; unsigned long buflen;
@@ -1653,7 +1653,7 @@ BOOL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename ) GetSystemDirectoryW( fullname, MAX_PATH ); strcatW( fullname, color_path );
- len = sizeof(profile)/sizeof(WCHAR); + len = ARRAY_SIZE( profile ); if (!RegCreateKeyExW( HKEY_LOCAL_MACHINE, mntr_key, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL ) && !RegEnumValueW( hkey, 0, profile, &len, NULL, NULL, NULL, NULL )) /* FIXME handle multiple values */ { @@ -1726,7 +1726,7 @@ INT X11DRV_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW proc, LPARAM lparam ) return -1;
len_sysdir = GetSystemDirectoryW( sysdir, MAX_PATH ); - len_path = len_sysdir + sizeof(color_path) / sizeof(color_path[0]) - 1; + len_path = len_sysdir + ARRAY_SIZE( color_path ) - 1; len = 64; for (;;) { diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 10985c1472..d6787068a9 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -986,7 +986,7 @@ static int find_fallback_shape( const char *name ) { struct cursor_font_fallback *fallback;
- if ((fallback = bsearch( name, fallbacks, sizeof(fallbacks) / sizeof(fallbacks[0]), + if ((fallback = bsearch( name, fallbacks, ARRAY_SIZE( fallbacks ), sizeof(*fallback), fallback_cmp ))) return fallback->shape; return -1; @@ -1038,9 +1038,9 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) if (info->szResName[0]) goto done; /* only integer resources are supported here */ if (!(module = GetModuleHandleW( info->szModName ))) goto done;
- for (i = 0; i < sizeof(module_cursors)/sizeof(module_cursors[0]); i++) + for (i = 0; i < ARRAY_SIZE( module_cursors ); i++) if (GetModuleHandleW( module_cursors[i].name ) == module) break; - if (i == sizeof(module_cursors)/sizeof(module_cursors[0])) goto done; + if (i == ARRAY_SIZE( module_cursors )) goto done;
cursors = module_cursors[i].cursors; for (i = 0; cursors[i].id; i++) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 0b0fd5179a..13a1da32ea 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -555,7 +555,7 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context ) return TRUE; }
- for (i = 0; i < sizeof(opengl_func_names)/sizeof(opengl_func_names[0]); i++) + for (i = 0; i < ARRAY_SIZE( opengl_func_names ); i++) { if (!(((void **)&opengl_funcs.gl)[i] = wine_dlsym( opengl_handle, opengl_func_names[i], NULL, 0 ))) { diff --git a/dlls/winex11.drv/pen.c b/dlls/winex11.drv/pen.c index c6a15daabf..6df26597b9 100644 --- a/dlls/winex11.drv/pen.c +++ b/dlls/winex11.drv/pen.c @@ -108,27 +108,27 @@ HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *patte switch(logpen.lopnStyle & PS_STYLE_MASK) { case PS_DASH: - physDev->pen.dash_len = sizeof(PEN_dash)/sizeof(*PEN_dash); + physDev->pen.dash_len = ARRAY_SIZE( PEN_dash ); memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dash : PEN_dash, physDev->pen.dash_len); break; case PS_DOT: - physDev->pen.dash_len = sizeof(PEN_dot)/sizeof(*PEN_dot); + physDev->pen.dash_len = ARRAY_SIZE( PEN_dot ); memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dot : PEN_dot, physDev->pen.dash_len); break; case PS_DASHDOT: - physDev->pen.dash_len = sizeof(PEN_dashdot)/sizeof(*PEN_dashdot); + physDev->pen.dash_len = ARRAY_SIZE( PEN_dashdot ); memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dashdot : PEN_dashdot, physDev->pen.dash_len); break; case PS_DASHDOTDOT: - physDev->pen.dash_len = sizeof(PEN_dashdotdot)/sizeof(*PEN_dashdotdot); + physDev->pen.dash_len = ARRAY_SIZE( PEN_dashdotdot ); memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dashdotdot : PEN_dashdotdot, physDev->pen.dash_len); break; case PS_ALTERNATE: - physDev->pen.dash_len = sizeof(PEN_alternate)/sizeof(*PEN_alternate); + physDev->pen.dash_len = ARRAY_SIZE( PEN_alternate ); memcpy(physDev->pen.dashes, PEN_alternate, physDev->pen.dash_len); break; case PS_USERSTYLE: diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index da322e0436..d4262c43cf 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -772,13 +772,13 @@ static BOOL modify_icon( struct tray_icon *icon, NOTIFYICONDATAW *nid ) } if (nid->uFlags & NIF_TIP) { - lstrcpynW(icon->tiptext, nid->szTip, sizeof(icon->tiptext)/sizeof(WCHAR)); + lstrcpynW(icon->tiptext, nid->szTip, ARRAY_SIZE( icon->tiptext )); if (icon->tooltip) update_tooltip_text(icon); } if (nid->uFlags & NIF_INFO && nid->cbSize >= NOTIFYICONDATAA_V2_SIZE) { - lstrcpynW( icon->info_text, nid->szInfo, sizeof(icon->info_text)/sizeof(WCHAR) ); - lstrcpynW( icon->info_title, nid->szInfoTitle, sizeof(icon->info_title)/sizeof(WCHAR) ); + lstrcpynW( icon->info_text, nid->szInfo, ARRAY_SIZE( icon->info_text )); + lstrcpynW( icon->info_title, nid->szInfoTitle, ARRAY_SIZE( icon->info_title )); icon->info_flags = nid->dwInfoFlags; icon->info_timeout = max(min(nid->u.uTimeout, BALLOON_SHOW_MAX_TIMEOUT), BALLOON_SHOW_MIN_TIMEOUT); icon->info_icon = nid->hBalloonIcon; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 0a4f118c34..7a3b340e19 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1530,7 +1530,7 @@ static void create_whole_window( struct x11drv_win_data *data ) SetPropA( data->hwnd, whole_window_prop, (HANDLE)data->whole_window );
/* set the window text */ - if (!InternalGetWindowText( data->hwnd, text, sizeof(text)/sizeof(WCHAR) )) text[0] = 0; + if (!InternalGetWindowText( data->hwnd, text, ARRAY_SIZE( text ))) text[0] = 0; sync_window_text( data->display, data->whole_window, text );
/* set the window region */