From: Uli Schlachter Date: Wed, 24 Aug 2011 10:47:16 +0000 (+0200) Subject: Compute alignment correctly X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa02096b8e7f94ad3c998a8d5af54963ee860b13;hp=aa02096b8e7f94ad3c998a8d5af54963ee860b13;p=free-sw%2Fxcb%2Flibxcb Compute alignment correctly The code previously assumed that everything has to be aligned to a 4 byte boundary. This assumption is wrong as e.g. the STR struct from xproto shows. Instead, each type has to be aligned to its natural alignment. So a char doesn't need any alignment, a INT16 gets aligned to a 2-byte-boundary and a INT32 gets the old 4 byte alignment. I'm not 100% sure that this commit is correct, but some quick tests with awesome and cairo-xcb went well. This commit causes lots of dead assignments to xcb_align_to since only the last field's alignment is actually used, but this simplified this patch a lot. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34037 Signed-off-by: Uli Schlachter Signed-off-by: Peter Harris ---