Rob Shearman : wininet: Fix compile with MinGW.
Alexandre Julliard
julliard at winehq.org
Tue Mar 4 14:31:39 CST 2008
Module: wine
Branch: master
Commit: 0aec3fcf86641f4d45b402d6a01902473022063c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0aec3fcf86641f4d45b402d6a01902473022063c
Author: Rob Shearman <rob at codeweavers.com>
Date: Mon Mar 3 21:46:52 2008 +0000
wininet: Fix compile with MinGW.
---
dlls/wininet/internet.h | 3 ++-
dlls/wininet/netconnection.c | 11 +++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h
index b0e757f..7f13fef 100644
--- a/dlls/wininet/internet.h
+++ b/dlls/wininet/internet.h
@@ -55,12 +55,13 @@
#endif
#if defined(__MINGW32__) || defined (_MSC_VER)
-#include "winsock2.h"
+#include "ws2tcpip.h"
#ifndef MSG_WAITALL
#define MSG_WAITALL 0
#endif
#else
#define closesocket close
+#define ioctlsocket ioctl
#endif /* __MINGW32__ */
/* used for netconnection.c stuff */
diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c
index 8bf3c2a..07fb3de 100644
--- a/dlls/wininet/netconnection.c
+++ b/dlls/wininet/netconnection.c
@@ -49,14 +49,14 @@
#include "winerror.h"
#include "wincrypt.h"
+#include "wine/debug.h"
+#include "internet.h"
+
/* To avoid conflicts with the Unix socket headers. we only need it for
* the error codes anyway. */
#define USE_WS_PREFIX
#include "winsock2.h"
-#include "wine/debug.h"
-#include "internet.h"
-
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
@@ -203,6 +203,7 @@ BOOL NETCON_connected(WININET_NETCONNECTION *connection)
/* translate a unix error code into a winsock one */
static int sock_get_error( int err )
{
+#if !defined(__MINGW32__) && !defined (_MSC_VER)
switch (err)
{
case EINTR: return WSAEINTR;
@@ -262,6 +263,8 @@ static int sock_get_error( int err )
#endif
default: errno=err; perror("sock_set_error"); return WSAEFAULT;
}
+#endif
+ return err;
}
/******************************************************************************
@@ -584,7 +587,7 @@ BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *avail
if (!connection->useSSL)
{
int unread;
- int retval = ioctl(connection->socketFD, FIONREAD, &unread);
+ int retval = ioctlsocket(connection->socketFD, FIONREAD, &unread);
if (!retval)
{
TRACE("%d bytes of queued, but unread data\n", unread);
More information about the wine-cvs
mailing list