trivial fix for FD_CLR in winsock.h
Dan Kegel
dank at kegel.com
Mon Mar 7 23:09:52 CST 2005
Thomas Kho <tkho at ucla.edu> found a buglet in winsock.h,
and proposed the fix:
--- include/winsock.h.old Mon Mar 7 21:01:12 2005
+++ include/winsock.h Mon Mar 7 21:01:31 2005
@@ -462,7 +462,7 @@
#endif
#ifndef USE_WS_PREFIX
-#define FD_CLR(fd, set) __WS_FD_CLR((fd),(set), fd_set)
+#define FD_CLR(fd, set) WINE_FD_CLR((fd),(set), fd_set)
#define FD_SET(fd, set) __WS_FD_SET((fd),(set), fd_set)
#define FD_ZERO(set) (((fd_set*)(set))->fd_count=0)
#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set*)(set))
Here's a test case I used to confirm the bug and the fix:
#!/bin/sh
# Demonstrate a wine winsock header problem using
# the select()-based server source from http://tangentsoft.net/wskfaq/examples/basics/
# you can use curl if you don't have wget
wget -c http://tangentsoft.net/wskfaq/examples/basics/ws-util.h
wget -c http://tangentsoft.net/wskfaq/examples/basics/ws-util.cpp
wget -c http://tangentsoft.net/wskfaq/examples/basics/main.cpp
wget -c http://tangentsoft.net/wskfaq/examples/basics/select-server.cpp
# Compile with Microsoft's compiler
# (To run cl on Linux requires some assembly; see http://kegel.com/wine/cl-howto.html)
cl -GX select-server.cpp main.cpp ws-util.cpp wsock32.lib
# Builds fine
# Compile with gcc
wineg++ select-server.cpp main.cpp ws-util.cpp -l wsock32
# Without the patch, fails with
# select-server.cpp: In function `void AcceptConnections(unsigned int)':
# select-server.cpp:281: parse error before `)' token
# select-server.cpp:281: `__WS_FD_CLR' undeclared (first use this function)
# select-server.cpp:281: (Each undeclared identifier is reported only once for
# each function it appears in.)
# select-server.cpp:290: parse error before `)' token
# select-server.cpp:298: parse error before `)' token
This error appears to have been lurking since the big reorg three years ago,
http://cvs.winehq.org/cvsweb/wine/include/winsock.h.diff?r1=1.36&r2=1.37
- Dan
--
Trying to get a job as a c++ developer? See http://kegel.com/academy/getting-hired.html
More information about the wine-patches
mailing list