X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_in.c;h=4998cdda31d2f1e0ae74a0a968ffb4d8c140d2c1;hb=ea71d7d7e3f5d8189b80747678e9ca9a417b1d37;hp=e075a40472f006d62f99c0979db5ebe09068dbdb;hpb=5ceeaaa4294201b3f613c07f9ec610c0e5f673c7;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_in.c b/src/xcb_in.c index e075a40..4998cdd 100644 --- a/src/xcb_in.c +++ b/src/xcb_in.c @@ -51,11 +51,6 @@ #define XCB_REPLY 1 #define XCB_XGE_EVENT 35 -/* required for compiling for Win32 using MinGW */ -#ifndef MSG_WAITALL -#define MSG_WAITALL 0 -#endif - struct event_list { xcb_generic_event_t *event; struct event_list *next; @@ -174,7 +169,7 @@ static int read_packet(xcb_connection_t *c) (genrep.response_type == XCB_REPLY ? 0 : sizeof(uint32_t))); if(!buf) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); return 0; } @@ -210,7 +205,7 @@ static int read_packet(xcb_connection_t *c) struct reply_list *cur = malloc(sizeof(struct reply_list)); if(!cur) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); free(buf); return 0; } @@ -227,7 +222,7 @@ static int read_packet(xcb_connection_t *c) event = malloc(sizeof(struct event_list)); if(!event) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); free(buf); return 0; } @@ -269,7 +264,7 @@ static int read_block(const int fd, void *buf, const ssize_t len) int done = 0; while(done < len) { - int ret = recv(fd, ((char *) buf) + done, len - done,MSG_WAITALL); + int ret = recv(fd, ((char *) buf) + done, len - done, 0); if(ret > 0) done += ret; #ifndef _WIN32 @@ -433,7 +428,7 @@ static void insert_pending_discard(xcb_connection_t *c, pending_reply **prev_nex pend = malloc(sizeof(*pend)); if(!pend) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); return; } @@ -633,7 +628,7 @@ int _xcb_in_expect_reply(xcb_connection_t *c, uint64_t request, enum workarounds assert(workaround != WORKAROUND_NONE || flags != 0); if(!pend) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); return 0; } pend->first_request = pend->last_request = request; @@ -661,7 +656,7 @@ void _xcb_in_replies_done(xcb_connection_t *c) int _xcb_in_read(xcb_connection_t *c) { - int n = recv(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len,MSG_WAITALL); + int n = recv(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len, 0); if(n > 0) c->in.queue_len += n; while(read_packet(c)) @@ -672,7 +667,7 @@ int _xcb_in_read(xcb_connection_t *c) if((n > 0) || (n < 0 && WSAGetLastError() == WSAEWOULDBLOCK)) #endif /* !_WIN32 */ return 1; - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_ERROR); return 0; } @@ -691,7 +686,7 @@ int _xcb_in_read_block(xcb_connection_t *c, void *buf, int len) int ret = read_block(c->fd, (char *) buf + done, len - done); if(ret <= 0) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_ERROR); return ret; } }