Missing swapl() in Xext/saver.c?

Keith Packard keithp at keithp.com
Mon Mar 12 04:13:06 UTC 2018


Mihai Moldovan <ionic at ionic.de> writes:

> Hi
>
>
> In
> https://cgit.freedesktop.org/xorg/xserver/commit/?id=9edcae78c46286baff42e74bfe26f6ae4d00fe01
> the swapl() call for stuff->suspend was removed. That sounds like a bad idea to me?
>
> xScreenSaverSuspendReq to this day defines it as a Bool, which is typedef'd to
> int everywhere and includes the (ignored) B32 width specifier, so using swapl()
> on the member sounds like a good idea. Definitely isn't a CARD8 object, despite
> its name.

Oh. This is pretty bad. 'Bool' is not a valid type in protocol headers,
it should have been BOOL. And, BOOL is a single byte. But, it is Bool,
and I guess that is generally 4 bytes on most architectures.

The XCB headers define this field as a byte and have three pad bytes
afterwards, so we actually have incompatible protocol definitions for
xcb and xlib/xserver.

I'm not entirely sure what we should do at this point; I suspect that
treating it as a 32-bit value, fixing the protocol to use CARD32
everywhere instead of Bool and BOOL, and then adding swapl would cause
the least fuss.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20180311/dcbbd3d3/attachment.sig>


More information about the xorg-devel mailing list