X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_util.c;h=58bd12dd26f38f9502ca5a0925b55f051c650765;hb=8c2707773b3621fb8bbda9021d23944f5be34aab;hp=b337d27ab71125882ba4e89c553c5279c1c854a4;hpb=89b3485dadef47a30264a5bf150b96522183376b;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_util.c b/src/xcb_util.c index b337d27..58bd12d 100644 --- a/src/xcb_util.c +++ b/src/xcb_util.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -59,6 +59,16 @@ int xcb_popcount(uint32_t mask) return ((y + (y >> 3)) & 030707070707) % 077; } +int xcb_sumof(uint8_t *list, int len) +{ + int i, s = 0; + for(i=0; i= 0 || (errno != ENOENT && errno != ECONNREFUSED)) + { + free(file); return fd; + } #endif - return _xcb_open_unix(protocol, file); + fd = _xcb_open_unix(protocol, file); + free(file); + + return fd; } static int _xcb_socket(int family, int type, int proto) @@ -257,7 +279,7 @@ static int _xcb_open_decnet(const char *host, const char *protocol, const unsign } #endif -static int _xcb_open_tcp(char *host, char *protocol, const unsigned short port) +static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port) { int fd = -1; struct addrinfo hints; @@ -265,8 +287,15 @@ static int _xcb_open_tcp(char *host, char *protocol, const unsigned short port) struct addrinfo *results, *addr; char *bracket; - if (protocol && strcmp("tcp",protocol)) + if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol) +#ifdef AF_INET6 + && strcmp("inet6",protocol) +#endif + ) return -1; + + if (*host == '\0') + host = "localhost"; memset(&hints, 0, sizeof(hints)); #ifdef AI_ADDRCONFIG