X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_util.c;h=9329b81dd4fb204fa5827d9acd2ecf7f4784541a;hb=87b7bf875e0105924ae306e90ca79512d6c0cf47;hp=fcb11f0429e6673c0148c52abe504314b34e50b2;hpb=163c47bdc0d32785d831e4c93fea9ab7e023446b;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_util.c b/src/xcb_util.c index fcb11f0..9329b81 100644 --- a/src/xcb_util.c +++ b/src/xcb_util.c @@ -34,11 +34,11 @@ #include #include #include -#include #ifdef _WIN32 #include "xcb_windefs.h" #else +#include #include #include #include @@ -424,13 +424,24 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp); if(!parsed) { - c = (xcb_connection_t *) &error_connection; + c = _xcb_conn_ret_error(XCB_CONN_CLOSED_PARSE_ERR); goto out; - } else + } else { +#ifdef _WIN32 + WSADATA wsaData; + if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { + c = (xcb_connection_t *) &error_connection; + goto out; + } +#endif fd = _xcb_open(host, protocol, display); + } if(fd == -1) { - c = (xcb_connection_t *) &error_connection; + c = _xcb_conn_ret_error(XCB_CONN_ERROR); +#ifdef _WIN32 + WSACleanup(); +#endif goto out; }