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:
Havoc Pennington 2003-09-29 22:17:16 +00:00 committed by Havoc Pennington
parent a889ff3469
commit a4dc0d581a
3 changed files with 48 additions and 6 deletions

View File

@ -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> 2003-09-29 Havoc Pennington <hp@redhat.com>
* src/xprops.c (cvtINT16toInt): fix the 64-bit check not to use * src/xprops.c (cvtINT16toInt): fix the 64-bit check not to use

View File

@ -33,6 +33,9 @@ AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(__int64) AC_CHECK_SIZEOF(__int64)
## byte order
AC_C_BIGENDIAN
#### Warnings #### Warnings
changequote(,)dnl changequote(,)dnl

View File

@ -347,8 +347,9 @@ async_get_property_handler (Display *dpy,
break; break;
case 32: case 32:
nbytes = reply->nItems * sizeof (CARD32); /* NOTE buffer is in longs to match XGetWindowProperty() */
netbytes = reply->nItems << 2; nbytes = reply->nItems * sizeof (long);
netbytes = reply->nItems << 2; /* wire size is always 32 bits though */
if (nbytes + 1 > 0 && if (nbytes + 1 > 0 &&
(task->data = (unsigned char *) Xmalloc ((unsigned)nbytes + 1))) (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", printf ("%s: already read %d bytes using %ld more, eating %ld more\n",
__FUNCTION__, bytes_read, nbytes, netbytes); __FUNCTION__, bytes_read, nbytes, netbytes);
#endif #endif
/* _XRead32 (dpy, (long *) task->data, netbytes); */
_XGetAsyncData (dpy, task->data, buf, len, /* We have to copy the XGetWindowProperty() crackrock
bytes_read, nbytes, * 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); 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; break;