Rob Shearman : winhttp: Fix compilation with MinGW/MSVC.

Alexandre Julliard julliard at winehq.org
Wed Oct 1 14:09:41 CDT 2008


Module: wine
Branch: master
Commit: a14d34b2f632f7d489e14a936078c6a5636bfc2a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a14d34b2f632f7d489e14a936078c6a5636bfc2a

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Wed Oct  1 11:20:31 2008 +0100

winhttp: Fix compilation with MinGW/MSVC.

---

 dlls/winhttp/net.c             |   10 ++++++----
 dlls/winhttp/winhttp_private.h |    6 ++++++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c
index 450366b..b343050 100644
--- a/dlls/winhttp/net.c
+++ b/dlls/winhttp/net.c
@@ -50,12 +50,12 @@
 #include "winhttp.h"
 #include "wincrypt.h"
 
+#include "winhttp_private.h"
+
 /* to avoid conflicts with the Unix socket headers */
 #define USE_WS_PREFIX
 #include "winsock2.h"
 
-#include "winhttp_private.h"
-
 WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
 
 #define DEFAULT_SEND_TIMEOUT        30
@@ -115,6 +115,7 @@ MAKE_FUNCPTR( ERR_error_string );
 /* translate a unix error code into a winsock error code */
 static int sock_get_error( int err )
 {
+#if !defined(__MINGW32__) && !defined (_MSC_VER)
     switch (err)
     {
         case EINTR:             return WSAEINTR;
@@ -174,6 +175,7 @@ static int sock_get_error( int err )
 #endif
     default: errno = err; perror( "sock_set_error" ); return WSAEFAULT;
     }
+#endif
     return err;
 }
 
@@ -282,7 +284,7 @@ BOOL netconn_close( netconn_t *conn )
         conn->secure = FALSE;
     }
 #endif
-    res = close( conn->socket );
+    res = closesocket( conn->socket );
     conn->socket = -1;
     if (res == -1)
     {
@@ -464,7 +466,7 @@ BOOL netconn_query_data_available( netconn_t *conn, DWORD *available )
         return TRUE;
     }
 #ifdef FIONREAD
-    if (!(ret = ioctl( conn->socket, FIONREAD, &unread ))) *available = unread;
+    if (!(ret = ioctlsocket( conn->socket, FIONREAD, &unread ))) *available = unread;
 #endif
     return TRUE;
 }
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index 8f5e17c..b564d4f 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -34,6 +34,12 @@
 #endif
 #if defined(__MINGW32__) || defined (_MSC_VER)
 # include <ws2tcpip.h>
+# ifndef MSG_WAITALL
+#  define MSG_WAITALL 0
+# endif
+#else
+# define closesocket close
+# define ioctlsocket ioctl
 #endif
 
 static const WCHAR getW[]    = {'G','E','T',0};




More information about the wine-cvs mailing list