Replaced read() in read_block and _xcb_in_read() with recv for all
platforms. MSG_WAITALL is undefined in MinGW so it's been explicitly defined in xcb_in.c
This commit is contained in:
parent
56962e42a5
commit
2dcf8b025b
19
src/xcb_in.c
19
src/xcb_in.c
|
@ -39,6 +39,7 @@
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#elif !defined _WIN32
|
#elif !defined _WIN32
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -49,6 +50,11 @@
|
||||||
#define XCB_REPLY 1
|
#define XCB_REPLY 1
|
||||||
#define XCB_XGE_EVENT 35
|
#define XCB_XGE_EVENT 35
|
||||||
|
|
||||||
|
/* required for compiling for Win32 using MinGW */
|
||||||
|
#ifndef MSG_WAITALL
|
||||||
|
#define MSG_WAITALL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
struct event_list {
|
struct event_list {
|
||||||
xcb_generic_event_t *event;
|
xcb_generic_event_t *event;
|
||||||
struct event_list *next;
|
struct event_list *next;
|
||||||
|
@ -271,12 +277,7 @@ static int read_block(const int fd, void *buf, const ssize_t len)
|
||||||
int done = 0;
|
int done = 0;
|
||||||
while(done < len)
|
while(done < len)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
int ret = recv(fd, ((char *) buf) + done, len - done,MSG_WAITALL);
|
||||||
int ret = read(fd, ((char *) buf) + done, len - done);
|
|
||||||
#else
|
|
||||||
int ret = recv(fd, ((char *) buf) + done, len - done,0);
|
|
||||||
#endif /* !_WIN32 */
|
|
||||||
|
|
||||||
if(ret > 0)
|
if(ret > 0)
|
||||||
done += ret;
|
done += ret;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -681,11 +682,7 @@ void _xcb_in_replies_done(xcb_connection_t *c)
|
||||||
|
|
||||||
int _xcb_in_read(xcb_connection_t *c)
|
int _xcb_in_read(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
int n = recv(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len,MSG_WAITALL);
|
||||||
int n = read(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len);
|
|
||||||
#else
|
|
||||||
int n = recv(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len,0);
|
|
||||||
#endif /* !_WIN32 */
|
|
||||||
if(n > 0)
|
if(n > 0)
|
||||||
c->in.queue_len += n;
|
c->in.queue_len += n;
|
||||||
while(read_packet(c))
|
while(read_packet(c))
|
||||||
|
|
Loading…
Reference in New Issue