summaryrefslogtreecommitdiff
path: root/src/xcb_in.c
diff options
context:
space:
mode:
authorPeter Harris <pharris@opentext.com>2021-02-01 17:43:52 -0500
committerPeter Harris <pharris@opentext.com>2021-06-04 14:31:13 +0000
commit4b0d9d3868aad8d5f4266821e9eda586e6c2bfa7 (patch)
treed31a073fa5d036d5ec404b539fac44cbc5be18d3 /src/xcb_in.c
parentcd0fba98a2d0867d505ff1a7ca8d7a7c757acfa2 (diff)
Fix build on Windows
Notable changes: Protect include of unistd.h (and other POSIX headers). Use SOCKET (which is larger than int) and closesocket (because close is not compatible) for sockets. Use <stdint.h>'s intptr_t instead of the non-portable ssize_t. Signed-off-by: Peter Harris <pharris@opentext.com>
Diffstat (limited to 'src/xcb_in.c')
-rw-r--r--src/xcb_in.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/xcb_in.c b/src/xcb_in.c
index 796b4e9..7d02e9b 100644
--- a/src/xcb_in.c
+++ b/src/xcb_in.c
@@ -32,7 +32,6 @@
#include <assert.h>
#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
#include <stdio.h>
#include <errno.h>
@@ -40,6 +39,7 @@
#include <poll.h>
#endif
#ifndef _WIN32
+#include <unistd.h>
#include <sys/select.h>
#include <sys/socket.h>
#endif
@@ -365,7 +365,7 @@ static void free_reply_list(struct reply_list *head)
}
}
-static int read_block(const int fd, void *buf, const ssize_t len)
+static int read_block(const int fd, void *buf, const intptr_t len)
{
int done = 0;
while(done < len)