Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Unified Diff: jingle/glue/utils.cc

Issue 1833523002: Migrate content/*/p2p/* code to net::IPAddress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« jingle/glue/utils.h ('K') | « jingle/glue/utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/glue/utils.cc
diff --git a/jingle/glue/utils.cc b/jingle/glue/utils.cc
index d74c6bc2debe674980f6eb0187687f34b1574c44..1a8413b4ee4d0bdb06308707d4e83064b92a97aa 100644
--- a/jingle/glue/utils.cc
+++ b/jingle/glue/utils.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
+#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "third_party/webrtc/base/byteorder.h"
#include "third_party/webrtc/base/socketaddress.h"
@@ -34,17 +35,16 @@ bool SocketAddressToIPEndPoint(const rtc::SocketAddress& address,
ip_endpoint->FromSockAddr(reinterpret_cast<sockaddr*>(&addr), size);
}
-rtc::IPAddress IPAddressNumberToIPAddress(
- const net::IPAddressNumber& ip_address_number) {
- if (ip_address_number.size() == net::kIPv4AddressSize) {
+rtc::IPAddress NetIPAddressToIPAddress(const net::IPAddress& ip_address) {
+ if (ip_address.IsIPv4()) {
uint32_t address;
- memcpy(&address, &ip_address_number[0], sizeof(uint32_t));
+ memcpy(&address, ip_address.bytes().data(), sizeof(uint32_t));
address = rtc::NetworkToHost32(address);
return rtc::IPAddress(address);
}
- if (ip_address_number.size() == net::kIPv6AddressSize) {
+ if (ip_address.IsIPv6()) {
in6_addr address;
- memcpy(&address, &ip_address_number[0], sizeof(in6_addr));
+ memcpy(&address, ip_address.bytes().data(), sizeof(in6_addr));
return rtc::IPAddress(address);
}
return rtc::IPAddress();
« jingle/glue/utils.h ('K') | « jingle/glue/utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698