[PATCH] dix: Fix endianess detection
ofourdan at redhat.com
Fri Apr 10 00:46:09 PDT 2015
On 09/04/15 18:54, Adam Jackson wrote:
> On Thu, 2015-04-09 at 15:33 +0200, Olivier Fourdan wrote:
>> Make sure X_BIG_ENDIAN/X_LITTLE_ENDIAN are defined before actually using
>> Otherwise, byte order could be wrong even though endianess detection is
>> Reported-by: Tim Waugh <twaugh at redhat.com>
>> Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
> I'm a little wary of this. Xarch.h doesn't have ifdef guards arounds
> its definition of those, might be better to just include that after the
> #undef X_BYTE_ORDER.
Right. I was unsure how the pre-processor would handle something like:
#define X_BYTE_ORDER X_LITTLE_ENDIAN
#define X_LITTLE_ENDIAN 1234
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
I was over cautious and clearly mistaken because it works, both
X_BYTE_ORDER and X_LITTLE_ENDIAN end up with the same value even if
X_LITTLE_ENDIAN is defined after X_BYTE_ORDER.
So, best would be to simply add the #include <X11/Xarch.h> in
include/servermd.h where it is actually used to determine
IMAGE_BYTE_ORDER and BITMAP_BIT_ORDER.
X11/Xarch.h comes with xproto and servermd.h already includes
X11/Xfuncproto.h so we are not adding any new dependency here.
Will send an updated patch.
More information about the xorg-devel