Commit 2d3b1c12 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

iphlpapi: Use RtlIpv4AddressToStringA instead of inet_ntoa.

parent be8729c9
......@@ -35,14 +35,6 @@
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
......@@ -1106,15 +1098,3 @@ ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_ad
}
#endif
char *toIPAddressString(unsigned int addr, char string[16])
{
if (string) {
struct in_addr iAddr;
iAddr.s_addr = addr;
/* extra-anal, just to make auditors happy */
lstrcpynA(string, inet_ntoa(iAddr), 16);
}
return string;
}
......@@ -109,11 +109,6 @@ DWORD getIPAddrTable(PMIB_IPADDRTABLE *ppIpAddrTable, HANDLE heap, DWORD flags)
ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_addrs,
SOCKET_ADDRESS **masks) DECLSPEC_HIDDEN;
/* Converts the network-order bytes in addr to a printable string. Returns
* string.
*/
char *toIPAddressString(unsigned int addr, char string[16]) DECLSPEC_HIDDEN;
DWORD getInterfaceMtuByName(const char *name, PDWORD mtu) DECLSPEC_HIDDEN;
DWORD getInterfaceStatusByName(const char *name, INTERNAL_IF_OPER_STATUS *status) DECLSPEC_HIDDEN;
......
......@@ -717,18 +717,18 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
for (i = 0; i < ipAddrTable->dwNumEntries; i++) {
if (ipAddrTable->table[i].dwIndex == ptr->Index) {
if (firstIPAddr) {
toIPAddressString(ipAddrTable->table[i].dwAddr,
RtlIpv4AddressToStringA((IN_ADDR *)&ipAddrTable->table[i].dwAddr,
ptr->IpAddressList.IpAddress.String);
toIPAddressString(ipAddrTable->table[i].dwMask,
RtlIpv4AddressToStringA((IN_ADDR *)&ipAddrTable->table[i].dwMask,
ptr->IpAddressList.IpMask.String);
firstIPAddr = FALSE;
}
else {
currentIPAddr->Next = nextIPAddr;
currentIPAddr = nextIPAddr;
toIPAddressString(ipAddrTable->table[i].dwAddr,
RtlIpv4AddressToStringA((IN_ADDR *)&ipAddrTable->table[i].dwAddr,
currentIPAddr->IpAddress.String);
toIPAddressString(ipAddrTable->table[i].dwMask,
RtlIpv4AddressToStringA((IN_ADDR *)&ipAddrTable->table[i].dwMask,
currentIPAddr->IpMask.String);
nextIPAddr++;
}
......@@ -749,9 +749,9 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
&& routeTable->table[i].u1.ForwardType ==
MIB_IPROUTE_TYPE_INDIRECT)
{
toIPAddressString(routeTable->table[i].dwForwardNextHop,
RtlIpv4AddressToStringA((IN_ADDR *)&routeTable->table[i].dwForwardNextHop,
ptr->GatewayList.IpAddress.String);
toIPAddressString(routeTable->table[i].dwForwardMask,
RtlIpv4AddressToStringA((IN_ADDR *)&routeTable->table[i].dwForwardMask,
ptr->GatewayList.IpMask.String);
}
if (winsEnabled) {
......@@ -2224,7 +2224,7 @@ static DWORD get_dns_server_list(PIP_ADDR_STRING list,
get_dns_servers( addr, num, TRUE );
for (i = 0, ptr = list; i < num; i++, ptr = ptr->Next) {
toIPAddressString(((struct sockaddr_in *)(addr + i))->sin_addr.s_addr,
RtlIpv4AddressToStringA((IN_ADDR *)&((struct sockaddr_in *)(addr + i))->sin_addr.s_addr,
ptr->IpAddress.String);
if (i == num - 1)
ptr->Next = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment