Problem with XID size on 64 bit systems ?

Carsten Haitzler (The Rasterman) raster at rasterman.com
Mon Aug 14 20:19:40 PDT 2006


On Tue, 15 Aug 2006 12:34:23 +1000 Graeme Gill <graeme2 at argyllcms.com> babbled:

xlib knows about this and works on 64bit - yes i find this a pain in the arse
too but its historical. it works. it isnt a bug - its just not as nice as some
might like

> 
> I notice in X.h that care is taken to declare XID's to be
> 32 bit size on the server, but not on the client.
> 
> /*
>   * _XSERVER64 must ONLY be defined when compiling X server sources on
>   * systems where unsigned long is not 32 bits, must NOT be used in
>   * client or library code.
>   */
> #ifndef _XSERVER64
> #  ifndef _XTYPEDEF_XID
> #    define _XTYPEDEF_XID
> typedef unsigned long XID;
> #  endif
> ....
> #else
> #  include <X11/Xmd.h>
> #  ifndef _XTYPEDEF_XID
> #    define _XTYPEDEF_XID
> typedef CARD32 XID;
> #  endif
> ....
> #endif
> 
> 
> This seems to create a problem with the following idiom in
> client code:
> 
>             XChangeProperty(
>                 mydisplay, mywindow,
>                 XA_WM_TRANSIENT_FOR,        /* Property */
>                 XA_WINDOW,                  /* Type */
>                 sizeof(Window) * 8,         /* format */
>                 PropModeReplace,            /* Change mode */
>                 (char *)(&window),          /* Window XID */
>                 1                           /* Number of elements of data */
>             );
> a format value of 64 not being legal.
> 
> If the format is hard coded to be 32, then this will (presumably)
> work on little endian systems, and break on big endian systems.
> 
> Has this issue been covered and resolved previously ?
> 
> What is the reason for leaving client size XID 64 bit on 64 bit
> systems ?
> 
> Graeme Gill.
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster at rasterman.com
裸好多
Tokyo, Japan (東京 日本)



More information about the xorg mailing list