X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_util.c;h=bd9f2b5aa118b9d7006c831e70b25c7db2009554;hb=608058ec80edb041ca012d530b42d97474f80320;hp=ef8300ffda882ceca550ba59b13bb511e08bcd1b;hpb=4a928de402a6e69886921fe428bbffb909c6405e;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_util.c b/src/xcb_util.c index ef8300f..bd9f2b5 100644 --- a/src/xcb_util.c +++ b/src/xcb_util.c @@ -49,7 +49,7 @@ static const int error_connection = 1; int xcb_popcount(uint32_t mask) { - unsigned long y; + uint32_t y; y = (mask >> 1) & 033333333333; y = mask - y - ((y >> 1) & 033333333333); return ((y + (y >> 3)) & 030707070707) % 077; @@ -238,10 +238,14 @@ xcb_connection_t *xcb_connect(const char *displayname, int *screenp) if(fd == -1) return (xcb_connection_t *) &error_connection; - _xcb_get_auth_info(fd, &auth); - c = xcb_connect_to_fd(fd, &auth); - free(auth.name); - free(auth.data); + if(_xcb_get_auth_info(fd, &auth, display)) + { + c = xcb_connect_to_fd(fd, &auth); + free(auth.name); + free(auth.data); + } + else + c = xcb_connect_to_fd(fd, 0); return c; }