Commit 3e9ce1c2 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

winex11.drv: Avoid ARRAY_SIZE-like macros.

parent 1e469c95
......@@ -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;
......
......@@ -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();
......
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