From 901eba9f4608de6af231fde34264ede878c4d253 Mon Sep 17 00:00:00 2001 From: Daniel Cohen Gindi Date: Sat, 20 Sep 2014 17:16:52 +0300 Subject: Generally adjusting headers for compiling on windows without the mixing of Winsock 1 and 2. --- libvncserver/httpd.c | 9 ++++++++- libvncserver/rfbserver.c | 2 ++ libvncserver/sockets.c | 5 +++++ rfb/rfbclient.h | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libvncserver/httpd.c b/libvncserver/httpd.c index 5bac9f9..12d71a8 100644 --- a/libvncserver/httpd.c +++ b/libvncserver/httpd.c @@ -43,8 +43,15 @@ #include #ifdef WIN32 -#include +#include +#include +#include #define close closesocket +#if defined(_MSC_VER) +#include /* For the missing ssize_t */ +#define ssize_t SSIZE_T +#define read _read /* Prevent POSIX deprecation warnings */ +#endif #else #ifdef LIBVNCSERVER_HAVE_SYS_TIME_H #include diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index e87fa42..abe2475 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -43,6 +43,8 @@ #endif #ifdef WIN32 +#include +#include #include #define write(sock,buf,len) send(sock,buf,len,0) #else diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index 31dddd6..a7a829a 100644 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -98,6 +98,8 @@ int deny_severity=LOG_WARNING; #endif #if defined(WIN32) +#include +#include #ifndef __MINGW32__ #pragma warning (disable: 4018 4761) #endif @@ -110,6 +112,9 @@ int deny_severity=LOG_WARNING; #endif #ifdef _MSC_VER +#define SHUT_RD 0x00 +#define SHUT_WR 0x01 +#define SHUT_RDWR 0x02 #define snprintf _snprintf /* Missing in MSVC */ #endif diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h index 9ac3c37..aedb4f4 100644 --- a/rfb/rfbclient.h +++ b/rfb/rfbclient.h @@ -31,6 +31,10 @@ * @file rfbclient.h */ +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN /* Prevent loading any Winsock 1.x headers from windows.h */ +#endif + #include #include #include -- cgit v1.1