[Xcb] [PATCH 2/2] Fix strict-aliasing warning when getting generic event length.
Peter Hutterer
peter.hutterer at who-t.net
Mon Mar 29 05:40:19 PDT 2010
On Sun, Mar 28, 2010 at 10:58:17AM -0700, Jamey Sharp wrote:
> xcb_ge_event_t has its length field in the same place that
> xcb_generic_reply_t does, so there's no need to cast the generic reply.
>
> Signed-off-by: Jamey Sharp <jamey at minilop.net>
> Cc: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>
> I don't know how to test generic events. Does this look right?
xinput --test-xi2 should do the job, but the patch looks good to me.
Cheers,
Peter
> src/xcb_in.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/src/xcb_in.c b/src/xcb_in.c
> index 80f5523..a2f7312 100644
> --- a/src/xcb_in.c
> +++ b/src/xcb_in.c
> @@ -154,9 +154,7 @@ static int read_packet(xcb_connection_t *c)
>
> /* XGE events may have sizes > 32 */
> if (genrep.response_type == XCB_XGE_EVENT)
> - {
> - eventlength = ((xcb_ge_event_t*)&genrep)->length * 4;
> - }
> + eventlength = genrep.length * 4;
>
> buf = malloc(length + eventlength +
> (genrep.response_type == XCB_REPLY ? 0 : sizeof(uint32_t)));
> --
> 1.7.0
>
More information about the Xcb
mailing list