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

Unified Diff: webrtc/base/ipaddress.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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
« no previous file with comments | « webrtc/base/ipaddress.h ('k') | webrtc/base/logging.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/ipaddress.cc
diff --git a/webrtc/base/ipaddress.cc b/webrtc/base/ipaddress.cc
index 3dd856a64abc817ac8de32d22e04a85ccaa74cab..316207fe498c145c3ef489dc2622264f96784391 100644
--- a/webrtc/base/ipaddress.cc
+++ b/webrtc/base/ipaddress.cc
@@ -43,10 +43,10 @@ static const in6_addr k6BonePrefix = {{{0x3f, 0xfe, 0}}};
bool IPAddress::strip_sensitive_ = false;
-static bool IsPrivateV4(uint32 ip);
+static bool IsPrivateV4(uint32_t ip);
static in_addr ExtractMappedAddress(const in6_addr& addr);
-uint32 IPAddress::v4AddressAsHostOrderInteger() const {
+uint32_t IPAddress::v4AddressAsHostOrderInteger() const {
if (family_ == AF_INET) {
return NetworkToHost32(u_.ip4.s_addr);
} else {
@@ -215,7 +215,7 @@ std::ostream& operator<<(std::ostream& os, const InterfaceAddress& ip) {
return os;
}
-bool IsPrivateV4(uint32 ip_in_host_order) {
+bool IsPrivateV4(uint32_t ip_in_host_order) {
return ((ip_in_host_order >> 24) == 127) ||
((ip_in_host_order >> 24) == 10) ||
((ip_in_host_order >> 20) == ((172 << 4) | 1)) ||
@@ -321,8 +321,8 @@ size_t HashIP(const IPAddress& ip) {
}
case AF_INET6: {
in6_addr v6addr = ip.ipv6_address();
- const uint32* v6_as_ints =
- reinterpret_cast<const uint32*>(&v6addr.s6_addr);
+ const uint32_t* v6_as_ints =
+ reinterpret_cast<const uint32_t*>(&v6addr.s6_addr);
return v6_as_ints[0] ^ v6_as_ints[1] ^ v6_as_ints[2] ^ v6_as_ints[3];
}
}
@@ -341,7 +341,7 @@ IPAddress TruncateIP(const IPAddress& ip, int length) {
return IPAddress(INADDR_ANY);
}
int mask = (0xFFFFFFFF << (32 - length));
- uint32 host_order_ip = NetworkToHost32(ip.ipv4_address().s_addr);
+ uint32_t host_order_ip = NetworkToHost32(ip.ipv4_address().s_addr);
in_addr masked;
masked.s_addr = HostToNetwork32(host_order_ip & mask);
return IPAddress(masked);
@@ -356,12 +356,11 @@ IPAddress TruncateIP(const IPAddress& ip, int length) {
int position = length / 32;
int inner_length = 32 - (length - (position * 32));
// Note: 64bit mask constant needed to allow possible 32-bit left shift.
- uint32 inner_mask = 0xFFFFFFFFLL << inner_length;
- uint32* v6_as_ints =
- reinterpret_cast<uint32*>(&v6addr.s6_addr);
+ uint32_t inner_mask = 0xFFFFFFFFLL << inner_length;
+ uint32_t* v6_as_ints = reinterpret_cast<uint32_t*>(&v6addr.s6_addr);
for (int i = 0; i < 4; ++i) {
if (i == position) {
- uint32 host_order_inner = NetworkToHost32(v6_as_ints[i]);
+ uint32_t host_order_inner = NetworkToHost32(v6_as_ints[i]);
v6_as_ints[i] = HostToNetwork32(host_order_inner & inner_mask);
} else if (i > position) {
v6_as_ints[i] = 0;
@@ -373,7 +372,7 @@ IPAddress TruncateIP(const IPAddress& ip, int length) {
}
int CountIPMaskBits(IPAddress mask) {
- uint32 word_to_count = 0;
+ uint32_t word_to_count = 0;
int bits = 0;
switch (mask.family()) {
case AF_INET: {
@@ -382,8 +381,8 @@ int CountIPMaskBits(IPAddress mask) {
}
case AF_INET6: {
in6_addr v6addr = mask.ipv6_address();
- const uint32* v6_as_ints =
- reinterpret_cast<const uint32*>(&v6addr.s6_addr);
+ const uint32_t* v6_as_ints =
+ reinterpret_cast<const uint32_t*>(&v6addr.s6_addr);
int i = 0;
for (; i < 4; ++i) {
if (v6_as_ints[i] != 0xFFFFFFFF) {
@@ -408,7 +407,7 @@ int CountIPMaskBits(IPAddress mask) {
// http://graphics.stanford.edu/~seander/bithacks.html
// Counts the trailing 0s in the word.
unsigned int zeroes = 32;
- word_to_count &= -static_cast<int32>(word_to_count);
+ word_to_count &= -static_cast<int32_t>(word_to_count);
if (word_to_count) zeroes--;
if (word_to_count & 0x0000FFFF) zeroes -= 16;
if (word_to_count & 0x00FF00FF) zeroes -= 8;
« no previous file with comments | « webrtc/base/ipaddress.h ('k') | webrtc/base/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698