Alexandre Julliard : libport: Avoid including winsock2.h.

Alexandre Julliard julliard at winehq.org
Wed Dec 24 13:18:32 CST 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec 24 10:05:19 2008 +0100

libport: Avoid including winsock2.h.

---

 configure           |    2 --
 configure.ac        |    1 -
 include/config.h.in |    3 ---
 libs/port/poll.c    |   23 ++++++++++++++++++++---
 4 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index ab27b58..ac42b9f 100755
--- a/configure
+++ b/configure
@@ -7438,7 +7438,6 @@ done
 
 
 
-
 for ac_header in \
 	AudioUnit/AudioUnit.h \
 	Carbon/Carbon.h \
@@ -7552,7 +7551,6 @@ for ac_header in \
 	termios.h \
 	unistd.h \
 	utime.h \
-	winsock2.h \
 	valgrind/memcheck.h \
 	valgrind/valgrind.h
 
diff --git a/configure.ac b/configure.ac
index be295a4..a84c822 100644
--- a/configure.ac
+++ b/configure.ac
@@ -351,7 +351,6 @@ AC_CHECK_HEADERS(\
 	termios.h \
 	unistd.h \
 	utime.h \
-	winsock2.h \
 	valgrind/memcheck.h \
 	valgrind/valgrind.h
 )
diff --git a/include/config.h.in b/include/config.h.in
index 7f3b888..b72a6bb 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -966,9 +966,6 @@
 /* Define to 1 if you have the `waitpid' function. */
 #undef HAVE_WAITPID
 
-/* Define to 1 if you have the <winsock2.h> header file. */
-#undef HAVE_WINSOCK2_H
-
 /* Define to 1 if you have the <X11/extensions/shape.h> header file. */
 #undef HAVE_X11_EXTENSIONS_SHAPE_H
 
diff --git a/libs/port/poll.c b/libs/port/poll.c
index b633a0d..7ee5852 100644
--- a/libs/port/poll.c
+++ b/libs/port/poll.c
@@ -23,9 +23,6 @@
 
 #ifndef HAVE_POLL
 
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -33,6 +30,26 @@
 #include <unistd.h>
 #endif
 
+/* we can't include winsock2.h here so we have to duplicate the definitions for Windows */
+#if defined(__MINGW32__) || defined(_MSC_VER)
+
+#define FD_SETSIZE 64
+
+typedef struct
+{
+    unsigned int fd_count;
+    int fd_array[FD_SETSIZE];   /* an array of SOCKETs */
+} fd_set;
+
+#define FD_ZERO(set)      ((set)->fd_count = 0)
+#define FD_ISSET(fd, set) __WSAFDIsSet((fd), (set))
+#define FD_SET(fd, set)   do { if ((set)->fd_count < FD_SETSIZE) (set)->fd_array[(set)->fd_count++]=(fd); } while(0)
+
+int __stdcall select(int,fd_set*,fd_set*,fd_set*,const struct timeval*);
+int __stdcall __WSAFDIsSet(int,fd_set*);
+
+#endif
+
 int poll( struct pollfd *fds, unsigned int count, int timeout )
 {
     fd_set read_set, write_set, except_set;




More information about the wine-cvs mailing list