Index: net/base/net_util.cc |
diff --git a/net/base/net_util.cc b/net/base/net_util.cc |
index 2ba3b4688f1dc3718c58f0d03aa52ba211edebb3..318e6087801fb135e276d568a638c94d150219ab 100644 |
--- a/net/base/net_util.cc |
+++ b/net/base/net_util.cc |
@@ -76,14 +76,6 @@ |
using base::Time; |
-#if defined(OS_WIN) |
-// Allow htons/ntohs to be called without requiring ws2_32.dll to be loaded, |
-// which isn't available in Chrome's sandbox. See crbug.com/116591. |
-// TODO(wez): Replace these calls with base::htons() etc when available. |
-#define ntohs(x) _byteswap_ushort(x) |
-#define htons(x) _byteswap_ushort(x) |
-#endif // OS_WIN |
- |
namespace net { |
namespace { |
@@ -2335,7 +2327,7 @@ uint16 GetPortFromAddrinfo(const struct addrinfo* info) { |
const uint16* port_field = GetPortFieldFromAddrinfo(info); |
if (!port_field) |
return -1; |
- return ntohs(*port_field); |
+ return base::NetToHost16(*port_field); |
} |
const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, |
@@ -2360,7 +2352,7 @@ int GetPortFromSockaddr(const struct sockaddr* address, socklen_t address_len) { |
const uint16* port_field = GetPortFieldFromSockaddr(address, address_len); |
if (!port_field) |
return -1; |
- return ntohs(*port_field); |
+ return base::NetToHost16(*port_field); |
} |
// Assign |port| to each address in the linked list starting from |head|. |
@@ -2369,7 +2361,7 @@ void SetPortForAllAddrinfos(struct addrinfo* head, uint16 port) { |
for (struct addrinfo* ai = head; ai; ai = ai->ai_next) { |
uint16* port_field = GetPortFieldFromAddrinfo(ai); |
if (port_field) |
- *port_field = htons(port); |
+ *port_field = base::HostToNet16(port); |
} |
} |