Jeff Latimer : ws2_32: Make inet_ntop conform to msdn definition.

Alexandre Julliard julliard at winehq.org
Mon Apr 27 08:04:10 CDT 2009


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

Author: Jeff Latimer <lats at yless4u.com.au>
Date:   Sat Apr 25 00:30:22 2009 +1000

ws2_32: Make inet_ntop conform to msdn definition.

---

 dlls/ws2_32/socket.c     |   12 +++++++-----
 dlls/ws2_32/tests/sock.c |    6 +++---
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 42bab60..01ebd7c 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -4698,16 +4698,18 @@ int WINAPI WSARemoveServiceClass(LPGUID info)
 PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, size_t len )
 {
 #ifdef HAVE_INET_NTOP
-    union generic_unix_sockaddr unix_addr;
+    struct WS_in6_addr *in6;
+    struct WS_in_addr  *in;
 
+    TRACE("family %d, addr (%p), buffer (%p), len %d\n", family, addr, buffer, len);
     switch (family)
     {
     case WS_AF_INET:
-        ws_sockaddr_ws2u( addr, sizeof(struct WS_sockaddr_in), &unix_addr );
-        return inet_ntop( AF_INET, &unix_addr, buffer, len );
+        in = addr;
+        return inet_ntop( AF_INET, &in->WS_s_addr, buffer, len );
     case WS_AF_INET6:
-        ws_sockaddr_ws2u( addr, sizeof(struct WS_sockaddr_in6), &unix_addr );
-        return inet_ntop( AF_INET6, &unix_addr, buffer, len );
+        in6 = addr;
+        return inet_ntop( AF_INET6, in6->WS_s6_addr, buffer, len );
     }
 #else
     FIXME( "not supported on this platform\n" );
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 7bc3ee8..8316982 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -2040,7 +2040,7 @@ static void test_addr_to_print(void)
 
     pdst = pInetNtop(AF_INET,(void*)&in.s_addr, dst, sizeof(dst));
     ok(pdst != NULL, "InetNtop failed %s\n", dst);
-    todo_wine ok(!strcmp(pdst, addr1_Str),"Address %s != %s\n", pdst, addr1_Str);
+    ok(!strcmp(pdst, addr1_Str),"Address %s != %s\n", pdst, addr1_Str);
 
     /* Test invalid parm conditions */
     pdst = pInetNtop(1, (void*)&in.s_addr, dst, sizeof(dst));
@@ -2051,13 +2051,13 @@ static void test_addr_to_print(void)
     memcpy(in6.u.Byte, addr2_Num, sizeof(addr2_Num));
     pdst = pInetNtop(AF_INET6,(void*)&in6.s6_addr, dst6, sizeof(dst6));
     ok(pdst != NULL, "InetNtop failed %s\n", dst6);
-    todo_wine ok(!strcmp(pdst, addr2_Str),"Address %s != %s\n", pdst, addr2_Str);
+    ok(!strcmp(pdst, addr2_Str),"Address %s != %s\n", pdst, addr2_Str);
 
     /* Test an zero suffixed IPV6 address */
     memcpy(in6.s6_addr, addr3_Num, sizeof(addr3_Num));
     pdst = pInetNtop(AF_INET6,(void*)&in6.s6_addr, dst6, sizeof(dst6));
     ok(pdst != NULL, "InetNtop failed %s\n", dst6);
-    todo_wine ok(!strcmp(pdst, addr3_Str),"Address %s != %s\n", pdst, addr3_Str);
+    ok(!strcmp(pdst, addr3_Str),"Address %s != %s\n", pdst, addr3_Str);
 }
 
 static void test_ioctlsocket(void)




More information about the wine-cvs mailing list