[Xcb] Question about XML spec, and QueryExtension

Julien Danjou julien at danjou.info
Thu Aug 28 09:14:20 PDT 2008


Peter,

At 1219910434 time_t, Julien Danjou wrote:
> I'll prepare another bunch of patches for that ASAP.

Working on these, I wonder if the -Wpadded stuff is enough.
It's generating warnings I can easily track for structure that are not
aligned.

But some are properly aligned (sizeof(struct) % 4 = 0) so I don't get
any warning. But comparing these against Xlib header files show that the
Xlib struct has a lot of padding.

Example:

XCB:
typedef struct xcb_shm_get_image_reply_t { 
    uint8_t        response_type; /**<  */ 
    uint8_t        depth; /**<  */ 
    uint16_t       sequence; /**<  */ 
    uint32_t       length; /**<  */ 
    xcb_visualid_t visual; /**<  */ 
    uint32_t       size; /**<  */ 
} xcb_shm_get_image_reply_t; 

sizeof(xcb_shm_get_image_reply_t) = 16

Xlib:
typedef struct _ShmGetImageReply { 
    BYTE        type;  /* X_Reply */ 
    CARD8       depth; 
    CARD16      sequenceNumber B16; 
    CARD32      length B32; 
    VisualID    visual B32; 
    CARD32      size B32; 
    CARD32      pad0 B32; 
    CARD32      pad1 B32; 
    CARD32      pad2 B32; 
    CARD32      pad3 B32; 
} xShmGetImageReply; 
#define sz_xShmGetImageReply    32 

So I don't get any warning and this can be fixed without comparing each
file. But I'm neither sure it's a big problem.

Cheers,
-- 
Julien Danjou
// ᐰ <julien at danjou.info>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20080828/6eff6242/attachment.pgp 


More information about the Xcb mailing list