wininet/tests: Do not compare the return value of socket() with 0. Use INVALID_SOCKET instead.

Michael Stefaniuc mstefani at redhat.de
Mon Nov 26 16:07:34 CST 2007


On Windows socket() returns a SOCKET and not an int like on Linux.
SOCKET boils down to UINT_PTR which is an unsigned type. Thus
if (s<0) would be always false.
---
 dlls/wininet/tests/http.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 4a28db9..ec2df72 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1228,7 +1228,8 @@ struct server_info {
 static DWORD CALLBACK server_thread(LPVOID param)
 {
     struct server_info *si = param;
-    int r, s, c, i, on;
+    int r, c, i, on;
+    SOCKET s;
     struct sockaddr_in sa;
     char buffer[0x100];
     WSADATA wsaData;
@@ -1237,7 +1238,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
     WSAStartup(MAKEWORD(1,1), &wsaData);
 
     s = socket(AF_INET, SOCK_STREAM, 0);
-    if (s<0)
+    if (s == INVALID_SOCKET)
         return 1;
 
     on = 1;
-- 
1.5.3.6



More information about the wine-patches mailing list