X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_util.c;h=eeee1dd3023c78b5857787c429b0dcc0e532b7cd;hb=3abd41625c7d6db6d01f3167d6bac2b7481965cf;hp=587cb3a81ebd8ef5b6d6791e68897e8ff6d66dcd;hpb=48776ce233bf77fbaddbe972d2356bca69094239;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_util.c b/src/xcb_util.c index 587cb3a..eeee1dd 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; @@ -176,8 +176,14 @@ static int _xcb_open_decnet(const char *host, const unsigned short port) static int _xcb_open_tcp(char *host, const unsigned short port) { int fd = -1; - struct addrinfo hints = { AI_ADDRCONFIG | AI_NUMERICSERV, AF_UNSPEC, - SOCK_STREAM }; + struct addrinfo hints = { 0 +#ifdef AI_ADDRCONFIG + | AI_ADDRCONFIG +#endif +#ifdef AI_NUMERICSERV + | AI_NUMERICSERV +#endif + , AF_UNSPEC, SOCK_STREAM }; char service[6]; /* "65535" with the trailing '\0' */ struct addrinfo *results, *addr; char *bracket; @@ -235,10 +241,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; }