whitespace fix in xcb_take_socket

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
c_client.py: Handle multiple expr. in a bitcase

Adopt a change from xcbgen. With that modification the expression in a
bitcase became a list of expressions to support multiple <enumref> in a
<bitcase>.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
integer overflow in read_packet() [CVE-2013-2064]

Ensure that when calculating the size of the incoming response from the
Xserver, we don't overflow the integer used in the calculations when we
multiply the int32_t length by 4 and add it to the default response size.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
fix deadlock with xcb_take_socket/return_socket v3

To prevent different threads from stealing the socket from each other the
caller of "xcb_take_socket" must hold a lock that is also acquired in
"return_socket". Unfortunately xcb tries to prevent calling return_socket
from multiple threads and this can lead to a deadlock situation.

A simple example:
- X11 has taken the socket
- Thread A has locked the display.
- Thread B does xcb_no_operation() and thus ends up in libX11's return_socket(),
  waiting for the display lock.
- Thread A calls e.g. xcb_no_operation(), too, ends up in return_socket() and
  because socket_moving == 1, ends up waiting for thread B
=> Deadlock

This patch allows calling return_socket from different threads at the same time
an so resolves the deadlock situation.

Partially fixes: https://bugs.freedesktop.org/show_bug.cgi?id=20708

v2: fixes additional pthread_cond_wait dependencies,
    rework comments and patch description

v3: separate pthread_cond_wait dependencies and unrelated whitespace
    change into their own patch, use unsigned for socket_seq

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Update Makefile.am for newer automake

Debian Bug #710344

Reviewed-by: Daniel Martin <consume.noise@gmail.com>
Fix "indention" typos in xcb-examples.3 man page

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
c_client.py: Inject full_sequence into GE events

The generic event structure xcb_ge_event_t has the full_sequence field
at the 32byte boundary. That's why we've to inject this field into GE
events while generating the structure for them. Otherwise we would read
garbage (the internal full_sequence) when accessing normal event fields
there.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
c_client.py: Always initialize xcb_align_to

to get rid of:
    warning: 'xcb_align_to' may be used uninitialized in this function
c_client.py: Do not create pointers in unions

Do not create pointers in unions for fields of variadic length.
Make xsltproc optional

Fix Bug 23863 - xcb still checks for xsltproc:
    https://bugs.freedesktop.org/show_bug.cgi?id=23863

xsltproc is used to generate the optional html page for `check` results,
only. So, it's not a hard build dependency.
xcb_util: Add xcb_popcount_len()

Add xcb_popcount_len(uint32_t *masks, int len) to be able to get a
popcount on a list of uint32_t (masks) with the specified length (len).
c_client.py: Add support for <popcount> on a list

In general, we handle the <popcount> on a list like a <sumof> until we
write out the code and choose a different function (xcb_popcount_len()).