From 366dda995182b3d4b199a3df262cdacb6d40cecc Mon Sep 17 00:00:00 2001 From: Daniel Cohen Gindi Date: Fri, 29 Aug 2014 10:59:56 +0300 Subject: Use WIN32 for Windows-specific #ifdef guards To support Microsoft Visual C++, we must not guard Windows-specific code in MinGW-specific #ifdef guards. Happily, even 64-bit MSVC defines the WIN32 constant, therefore we can use that instead. [JES: fixed commit message, reordered commit, split out unrelated changes] Signed-off-by: Johannes Schindelin --- libvncclient/listen.c | 8 +++++--- libvncclient/sockets.c | 4 +++- libvncclient/vncviewer.c | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libvncclient/listen.c b/libvncclient/listen.c index c91ad6e..6d4ad54 100644 --- a/libvncclient/listen.c +++ b/libvncclient/listen.c @@ -27,11 +27,13 @@ #endif #include #include -#ifdef __MINGW32__ +#ifdef WIN32 #define close closesocket #include +#ifdef _MINGW32 #undef max -#else +#endif // #ifdef _MINGW32 +#else // #ifdef WIN32 #include #include #endif @@ -46,7 +48,7 @@ void listenForIncomingConnections(rfbClient* client) { -#ifdef __MINGW32__ +#ifdef WIN32 /* FIXME */ rfbClientErr("listenForIncomingConnections on MinGW32 NOT IMPLEMENTED\n"); return; diff --git a/libvncclient/sockets.c b/libvncclient/sockets.c index 7ddf1b2..e50ef0e 100644 --- a/libvncclient/sockets.c +++ b/libvncclient/sockets.c @@ -38,7 +38,9 @@ #ifdef WIN32 #undef SOCKET #include +#ifdef MINGW32 #define EWOULDBLOCK WSAEWOULDBLOCK +#endif #define close closesocket #define read(sock,buf,len) recv(sock,buf,len,0) #define write(sock,buf,len) send(sock,buf,len,0) @@ -109,7 +111,7 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) diff.tv_sec--; diff.tv_usec+=1000000; } -#ifndef __MINGW32__ +#ifndef WIN32 sleep (diff.tv_sec); usleep (diff.tv_usec); #else diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index 5819c1d..9d657ed 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -45,7 +45,7 @@ static rfbBool DummyPoint(rfbClient* client, int x, int y) { static void DummyRect(rfbClient* client, int x, int y, int w, int h) { } -#ifdef __MINGW32__ +#ifdef WIN32 static char* NoPassword(rfbClient* client) { return strdup(""); } @@ -56,9 +56,9 @@ static char* NoPassword(rfbClient* client) { #endif static char* ReadPassword(rfbClient* client) { -#ifdef __MINGW32__ +#ifdef WIN32 /* FIXME */ - rfbClientErr("ReadPassword on MinGW32 NOT IMPLEMENTED\n"); + rfbClientErr("ReadPassword on Windows NOT IMPLEMENTED\n"); return NoPassword(client); #else int i; -- cgit v1.1