ws2_32: Make sure INVALID_SOCKET is correctly typed.

Francois Gouget fgouget at free.fr
Mon May 26 10:38:53 CDT 2008


---

This is important because SOCKET is an UINT_PTR so it's unsigned and can 
be 64bits. Without the cast I suspect we could get in trouble with sign 
extension and stuff.


 include/winsock.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/winsock.h b/include/winsock.h
index 9187f41..dd202ea 100644
--- a/include/winsock.h
+++ b/include/winsock.h
@@ -395,7 +395,7 @@ typedef UINT_PTR SOCKET;
  * This is used instead of -1, since the
  * SOCKET type is unsigned.
  */
-#define INVALID_SOCKET             (~0)
+#define INVALID_SOCKET             (SOCKET)(~0)
 #define SOCKET_ERROR               (-1)
 
 typedef struct WS(sockaddr)
-- 
1.5.5.1



More information about the wine-patches mailing list