attempt to fix this to return the data as an array of long even on 64-bit
2003-09-29 Havoc Pennington <hp@redhat.com> * src/async-getprop.c (async_get_property_handler): attempt to fix this to return the data as an array of long even on 64-bit as with XGetWindowProperty() breakage, bug #114035, credit to Gwenole Beauchesne for tracking down.
This commit is contained in:
parent
a889ff3469
commit
a4dc0d581a
3 changed files with 48 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2003-09-29 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* src/async-getprop.c (async_get_property_handler): attempt to fix
|
||||
this to return the data as an array of long even on 64-bit as with
|
||||
XGetWindowProperty() breakage, bug #114035, credit to Gwenole
|
||||
Beauchesne for tracking down.
|
||||
|
||||
2003-09-29 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* src/xprops.c (cvtINT16toInt): fix the 64-bit check not to use
|
||||
|
|
|
@ -33,6 +33,9 @@ AC_CHECK_SIZEOF(void *)
|
|||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_SIZEOF(__int64)
|
||||
|
||||
## byte order
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
#### Warnings
|
||||
|
||||
changequote(,)dnl
|
||||
|
|
|
@ -347,8 +347,9 @@ async_get_property_handler (Display *dpy,
|
|||
break;
|
||||
|
||||
case 32:
|
||||
nbytes = reply->nItems * sizeof (CARD32);
|
||||
netbytes = reply->nItems << 2;
|
||||
/* NOTE buffer is in longs to match XGetWindowProperty() */
|
||||
nbytes = reply->nItems * sizeof (long);
|
||||
netbytes = reply->nItems << 2; /* wire size is always 32 bits though */
|
||||
if (nbytes + 1 > 0 &&
|
||||
(task->data = (unsigned char *) Xmalloc ((unsigned)nbytes + 1)))
|
||||
{
|
||||
|
@ -356,10 +357,41 @@ async_get_property_handler (Display *dpy,
|
|||
printf ("%s: already read %d bytes using %ld more, eating %ld more\n",
|
||||
__FUNCTION__, bytes_read, nbytes, netbytes);
|
||||
#endif
|
||||
/* _XRead32 (dpy, (long *) task->data, netbytes); */
|
||||
_XGetAsyncData (dpy, task->data, buf, len,
|
||||
bytes_read, nbytes,
|
||||
netbytes);
|
||||
|
||||
/* We have to copy the XGetWindowProperty() crackrock
|
||||
* and get format 32 as long even on 64-bit platforms.
|
||||
*/
|
||||
if (sizeof (long) == 8)
|
||||
{
|
||||
unsigned char *netdata;
|
||||
unsigned char *lptr;
|
||||
unsigned char *end_lptr;
|
||||
|
||||
/* Store the 32-bit values in the end of the array */
|
||||
netdata = task->data + nbytes / 2;
|
||||
|
||||
_XGetAsyncData (dpy, netdata, buf, len,
|
||||
bytes_read, netbytes,
|
||||
netbytes);
|
||||
|
||||
/* Now move the 32-bit values to the front */
|
||||
|
||||
lptr = task->data;
|
||||
end_lptr = task->data + nbytes;
|
||||
while (lptr != end_lptr)
|
||||
{
|
||||
*(long*) lptr = *(CARD32*) netdata;
|
||||
lptr += sizeof (long);
|
||||
netdata += sizeof (CARD32);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Here the wire format matches our actual format */
|
||||
_XGetAsyncData (dpy, task->data, buf, len,
|
||||
bytes_read, netbytes,
|
||||
netbytes);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue