Commit 7d013ed8 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Work around a false positive gcc warning.

parent ec3b7738
...@@ -1850,7 +1850,7 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop, ...@@ -1850,7 +1850,7 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop,
{ {
int aformat; int aformat;
unsigned long pos = 0, nitems, remain, count; unsigned long pos = 0, nitems, remain, count;
unsigned char *val = NULL, *buffer; unsigned char *val = NULL, *new_val, *buffer;
for (;;) for (;;)
{ {
...@@ -1863,15 +1863,13 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop, ...@@ -1863,15 +1863,13 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop,
} }
count = get_property_size( aformat, nitems ); count = get_property_size( aformat, nitems );
*data = realloc( val, pos * sizeof(int) + count + 1 ); if (!(new_val = realloc( val, pos * sizeof(int) + count + 1 )))
if (!*data)
{ {
XFree( buffer ); XFree( buffer );
free( val ); free( val );
return FALSE; return FALSE;
} }
val = *data; val = new_val;
memcpy( (int *)val + pos, buffer, count ); memcpy( (int *)val + pos, buffer, count );
XFree( buffer ); XFree( buffer );
if (!remain) if (!remain)
...@@ -1889,6 +1887,7 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop, ...@@ -1889,6 +1887,7 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop,
/* Delete the property on the window now that we are done /* Delete the property on the window now that we are done
* This will send a PropertyNotify event to the selection owner. */ * This will send a PropertyNotify event to the selection owner. */
XDeleteProperty(display, w, prop); XDeleteProperty(display, w, prop);
*data = val;
return TRUE; return TRUE;
} }
......
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