ws2_32: Reimplement inet_addr() on top of inet_pton().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-08-02 19:37:42 -05:00 committed by Alexandre Julliard
parent b159f6e256
commit 671cf16f77
2 changed files with 7 additions and 4 deletions

View file

@ -2025,10 +2025,13 @@ int WINAPI WSAAddressToStringW( struct WS_sockaddr *addr, DWORD addr_len,
/*********************************************************************** /***********************************************************************
* inet_addr (ws2_32.11) * inet_addr (ws2_32.11)
*/ */
WS_u_long WINAPI WS_inet_addr( const char *cp ) WS_u_long WINAPI WS_inet_addr( const char *str )
{ {
if (!cp) return INADDR_NONE; WS_u_long addr;
return inet_addr( cp );
if (WS_inet_pton( WS_AF_INET, str, &addr ) == 1)
return addr;
return WS_INADDR_NONE;
} }

View file

@ -945,7 +945,7 @@ static void test_inet_pton(void)
WSASetLastError(0xdeadbeef); WSASetLastError(0xdeadbeef);
ret = inet_addr(NULL); ret = inet_addr(NULL);
ok(ret == INADDR_NONE, "got %#x\n", ret); ok(ret == INADDR_NONE, "got %#x\n", ret);
todo_wine ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError());
for (i = 0; i < ARRAY_SIZE(ipv4_tests); ++i) for (i = 0; i < ARRAY_SIZE(ipv4_tests); ++i)
{ {