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

Unified Diff: net/dns/address_sorter_posix.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: net/dns/address_sorter_posix.cc
diff --git a/net/dns/address_sorter_posix.cc b/net/dns/address_sorter_posix.cc
index 5e2fe943264520d4bea0fcb1e53923b9b040d6c9..35d8cec90fff1ea4557afa41ab3cc25217c27076 100644
--- a/net/dns/address_sorter_posix.cc
+++ b/net/dns/address_sorter_posix.cc
@@ -82,8 +82,7 @@ bool IsIPv6Loopback(const IPAddressNumber& address) {
DCHECK_EQ(kIPv6AddressSize, address.size());
// IN6_IS_ADDR_LOOPBACK
unsigned char kLoopback[kIPv6AddressSize] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
};
return address == IPAddressNumber(kLoopback, kLoopback + kIPv6AddressSize);
}
@@ -124,54 +123,64 @@ AddressSorterPosix::AddressScope GetScope(
// Default policy table. RFC 3484, Section 2.1.
AddressSorterPosix::PolicyEntry kDefaultPrecedenceTable[] = {
- // ::1/128 -- loopback
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, 128, 50 },
- // ::/0 -- any
- { { }, 0, 40 },
- // ::ffff:0:0/96 -- IPv4 mapped
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF }, 96, 35 },
- // 2002::/16 -- 6to4
- { { 0x20, 0x02, }, 16, 30 },
- // 2001::/32 -- Teredo
- { { 0x20, 0x01, 0, 0 }, 32, 5 },
- // fc00::/7 -- unique local address
- { { 0xFC }, 7, 3 },
- // ::/96 -- IPv4 compatible
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 96, 1 },
- // fec0::/10 -- site-local expanded scope
- { { 0xFE, 0xC0 }, 10, 1 },
- // 3ffe::/16 -- 6bone
- { { 0x3F, 0xFE }, 16, 1 },
+ // ::1/128 -- loopback
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, 128, 50},
+ // ::/0 -- any
+ {{}, 0, 40},
+ // ::ffff:0:0/96 -- IPv4 mapped
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF}, 96, 35},
+ // 2002::/16 -- 6to4
+ {{
+ 0x20, 0x02,
+ },
+ 16,
+ 30},
+ // 2001::/32 -- Teredo
+ {{0x20, 0x01, 0, 0}, 32, 5},
+ // fc00::/7 -- unique local address
+ {{0xFC}, 7, 3},
+ // ::/96 -- IPv4 compatible
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 96, 1},
+ // fec0::/10 -- site-local expanded scope
+ {{0xFE, 0xC0}, 10, 1},
+ // 3ffe::/16 -- 6bone
+ {{0x3F, 0xFE}, 16, 1},
};
AddressSorterPosix::PolicyEntry kDefaultLabelTable[] = {
- // ::1/128 -- loopback
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, 128, 0 },
- // ::/0 -- any
- { { }, 0, 1 },
- // ::ffff:0:0/96 -- IPv4 mapped
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF }, 96, 4 },
- // 2002::/16 -- 6to4
- { { 0x20, 0x02, }, 16, 2 },
- // 2001::/32 -- Teredo
- { { 0x20, 0x01, 0, 0 }, 32, 5 },
- // fc00::/7 -- unique local address
- { { 0xFC }, 7, 13 },
- // ::/96 -- IPv4 compatible
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 96, 3 },
- // fec0::/10 -- site-local expanded scope
- { { 0xFE, 0xC0 }, 10, 11 },
- // 3ffe::/16 -- 6bone
- { { 0x3F, 0xFE }, 16, 12 },
+ // ::1/128 -- loopback
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, 128, 0},
+ // ::/0 -- any
+ {{}, 0, 1},
+ // ::ffff:0:0/96 -- IPv4 mapped
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF}, 96, 4},
+ // 2002::/16 -- 6to4
+ {{
+ 0x20, 0x02,
+ },
+ 16,
+ 2},
+ // 2001::/32 -- Teredo
+ {{0x20, 0x01, 0, 0}, 32, 5},
+ // fc00::/7 -- unique local address
+ {{0xFC}, 7, 13},
+ // ::/96 -- IPv4 compatible
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 96, 3},
+ // fec0::/10 -- site-local expanded scope
+ {{0xFE, 0xC0}, 10, 11},
+ // 3ffe::/16 -- 6bone
+ {{0x3F, 0xFE}, 16, 12},
};
// Default mapping of IPv4 addresses to scope.
AddressSorterPosix::PolicyEntry kDefaultIPv4ScopeTable[] = {
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0x7F }, 104,
- AddressSorterPosix::SCOPE_LINKLOCAL },
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0xA9, 0xFE }, 112,
- AddressSorterPosix::SCOPE_LINKLOCAL },
- { { }, 0, AddressSorterPosix::SCOPE_GLOBAL },
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0x7F},
+ 104,
+ AddressSorterPosix::SCOPE_LINKLOCAL},
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0xA9, 0xFE},
+ 112,
+ AddressSorterPosix::SCOPE_LINKLOCAL},
+ {{}, 0, AddressSorterPosix::SCOPE_GLOBAL},
};
struct DestinationInfo {
@@ -241,10 +250,10 @@ AddressSorterPosix::AddressSorterPosix(ClientSocketFactory* socket_factory)
: socket_factory_(socket_factory),
precedence_table_(LoadPolicy(kDefaultPrecedenceTable,
arraysize(kDefaultPrecedenceTable))),
- label_table_(LoadPolicy(kDefaultLabelTable,
- arraysize(kDefaultLabelTable))),
+ label_table_(
+ LoadPolicy(kDefaultLabelTable, arraysize(kDefaultLabelTable))),
ipv4_scope_table_(LoadPolicy(kDefaultIPv4ScopeTable,
- arraysize(kDefaultIPv4ScopeTable))) {
+ arraysize(kDefaultIPv4ScopeTable))) {
NetworkChangeNotifier::AddIPAddressObserver(this);
OnIPAddressChanged();
}
@@ -299,9 +308,9 @@ void AddressSorterPosix::Sort(const AddressList& list,
info->src = &src_info;
if (info->address.size() == src.address().size()) {
- info->common_prefix_length = std::min(
- CommonPrefixLength(info->address, src.address()),
- info->src->prefix_length);
+ info->common_prefix_length =
+ std::min(CommonPrefixLength(info->address, src.address()),
+ info->src->prefix_length);
}
sort_list.push_back(info.release());
}
@@ -398,4 +407,3 @@ scoped_ptr<AddressSorter> AddressSorter::CreateAddressSorter() {
}
} // namespace net
-

Powered by Google App Engine
This is Rietveld 408576698