winex11.drv: Avoid ARRAY_SIZE-like macros.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-07 23:39:08 +02:00 committed by Alexandre Julliard
parent 1e469c95e6
commit 3e9ce1c26f
2 changed files with 7 additions and 8 deletions

View File

@ -187,7 +187,6 @@ static const struct
static struct list format_list = LIST_INIT( format_list );
#define NB_BUILTIN_FORMATS (sizeof(builtin_formats) / sizeof(builtin_formats[0]))
#define GET_ATOM(prop) (((prop) < FIRST_XATOM) ? (Atom)(prop) : X11DRV_Atoms[(prop) - FIRST_XATOM])
static DWORD clipboard_thread_id;
@ -295,9 +294,9 @@ static void register_builtin_formats(void)
struct clipboard_format *formats;
unsigned int i;
if (!(formats = HeapAlloc( GetProcessHeap(), 0, NB_BUILTIN_FORMATS * sizeof(*formats)))) return;
if (!(formats = HeapAlloc( GetProcessHeap(), 0, ARRAY_SIZE(builtin_formats) * sizeof(*formats)))) return;
for (i = 0; i < NB_BUILTIN_FORMATS; i++)
for (i = 0; i < ARRAY_SIZE(builtin_formats); i++)
{
if (builtin_formats[i].name)
formats[i].id = RegisterClipboardFormatW( builtin_formats[i].name );
@ -983,7 +982,7 @@ static HANDLE import_targets( Atom type, const void *data, size_t size )
register_x11_formats( properties, count );
/* the builtin formats contain duplicates, so allocate some extra space */
if (!(formats = HeapAlloc( GetProcessHeap(), 0, (count + NB_BUILTIN_FORMATS) * sizeof(*formats ))))
if (!(formats = HeapAlloc( GetProcessHeap(), 0, (count + ARRAY_SIZE(builtin_formats)) * sizeof(*formats ))))
return 0;
pos = 0;
@ -1454,7 +1453,8 @@ static BOOL export_targets( Display *display, Window win, Atom prop, Atom target
if (!(formats = get_clipboard_formats( &count ))) return FALSE;
/* the builtin formats contain duplicates, so allocate some extra space */
if (!(targets = HeapAlloc( GetProcessHeap(), 0, (count + NB_BUILTIN_FORMATS) * sizeof(*targets) )))
if (!(targets = HeapAlloc( GetProcessHeap(), 0,
(count + ARRAY_SIZE(builtin_formats)) * sizeof(*targets) )))
{
HeapFree( GetProcessHeap(), 0, formats );
return FALSE;

View File

@ -73,7 +73,6 @@ static struct screen_size {
{1920, 1200},
{2560, 1600}
};
#define NUM_DESKTOP_MODES (sizeof(screen_sizes) / sizeof(struct screen_size))
#define _NET_WM_STATE_REMOVE 0
#define _NET_WM_STATE_ADD 1
@ -88,7 +87,7 @@ static void make_modes(void)
/* original specified desktop size */
X11DRV_Settings_AddOneMode(screen_width, screen_height, 0, 60);
for (i=0; i<NUM_DESKTOP_MODES; i++)
for (i=0; i<ARRAY_SIZE(screen_sizes); i++)
{
if ( (screen_sizes[i].width <= max_width) && (screen_sizes[i].height <= max_height) )
{
@ -160,7 +159,7 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height )
dd_modes = X11DRV_Settings_SetHandlers("desktop",
X11DRV_desktop_GetCurrentMode,
X11DRV_desktop_SetCurrentMode,
NUM_DESKTOP_MODES+2, 1);
ARRAY_SIZE(screen_sizes)+2, 1);
make_modes();
X11DRV_Settings_AddDepthModes();
dd_mode_count = X11DRV_Settings_GetModeCount();