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

Unified Diff: net/quic/crypto/strike_register.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/quic/crypto/strike_register.cc
diff --git a/net/quic/crypto/strike_register.cc b/net/quic/crypto/strike_register.cc
index 9aec6ffb8120dbe7888bb099577179a5cda86c28..fda4c9b39b17d022d61a8fd193e5a42d6b0f7644 100644
--- a/net/quic/crypto/strike_register.cc
+++ b/net/quic/crypto/strike_register.cc
@@ -92,7 +92,9 @@ StrikeRegister::StrikeRegister(unsigned max_entries,
Reset();
}
-StrikeRegister::~StrikeRegister() { delete[] internal_nodes_; }
+StrikeRegister::~StrikeRegister() {
+ delete[] internal_nodes_;
+}
void StrikeRegister::Reset() {
// Thread a free list through all of the internal nodes.
@@ -270,18 +272,20 @@ void StrikeRegister::Validate() {
if (internal_node_head_ != kNil &&
((internal_node_head_ >> 8) & kExternalFlag) == 0) {
vector<pair<unsigned, bool> > bits;
- ValidateTree(internal_node_head_ >> 8, -1, bits, free_internal_nodes,
- free_external_nodes, &used_internal_nodes,
+ ValidateTree(internal_node_head_ >> 8,
+ -1,
+ bits,
+ free_internal_nodes,
+ free_external_nodes,
+ &used_internal_nodes,
&used_external_nodes);
}
}
// static
uint32 StrikeRegister::TimeFromBytes(const uint8 d[4]) {
- return static_cast<uint32>(d[0]) << 24 |
- static_cast<uint32>(d[1]) << 16 |
- static_cast<uint32>(d[2]) << 8 |
- static_cast<uint32>(d[3]);
+ return static_cast<uint32>(d[0]) << 24 | static_cast<uint32>(d[1]) << 16 |
+ static_cast<uint32>(d[2]) << 8 | static_cast<uint32>(d[3]);
}
uint32 StrikeRegister::ExternalTimeToInternal(uint32 external_time) {
@@ -385,37 +389,36 @@ void StrikeRegister::FreeInternalNode(uint32 index) {
internal_node_free_head_ = index;
}
-void StrikeRegister::ValidateTree(
- uint32 internal_node,
- int last_bit,
- const vector<pair<unsigned, bool> >& bits,
- const set<uint32>& free_internal_nodes,
- const set<uint32>& free_external_nodes,
- set<uint32>* used_internal_nodes,
- set<uint32>* used_external_nodes) {
+void StrikeRegister::ValidateTree(uint32 internal_node,
+ int last_bit,
+ const vector<pair<unsigned, bool> >& bits,
+ const set<uint32>& free_internal_nodes,
+ const set<uint32>& free_external_nodes,
+ set<uint32>* used_internal_nodes,
+ set<uint32>* used_external_nodes) {
CHECK_LT(internal_node, max_entries_);
const InternalNode* i = &internal_nodes_[internal_node];
unsigned bit = 0;
switch (i->otherbits()) {
- case 0xff & ~(1 << 7):
+ case 0xff & ~(1 << 7) :
bit = 0;
break;
- case 0xff & ~(1 << 6):
+ case 0xff & ~(1 << 6) :
bit = 1;
break;
- case 0xff & ~(1 << 5):
+ case 0xff & ~(1 << 5) :
bit = 2;
break;
- case 0xff & ~(1 << 4):
+ case 0xff & ~(1 << 4) :
bit = 3;
break;
- case 0xff & ~(1 << 3):
+ case 0xff & ~(1 << 3) :
bit = 4;
break;
- case 0xff & ~(1 << 2):
+ case 0xff & ~(1 << 2) :
bit = 5;
break;
- case 0xff & ~(1 << 1):
+ case 0xff & ~(1 << 1) :
bit = 6;
break;
case 0xff & ~1:
@@ -440,12 +443,13 @@ void StrikeRegister::ValidateTree(
used_external_nodes->insert(ext);
const uint8* bytes = external_node(ext);
for (vector<pair<unsigned, bool> >::const_iterator i = bits.begin();
- i != bits.end(); i++) {
+ i != bits.end();
+ i++) {
unsigned byte = i->first / 8;
DCHECK_LE(byte, 0xffu);
unsigned bit = i->first % 8;
- static const uint8 kMasks[8] =
- {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
+ static const uint8 kMasks[8] = {0x80, 0x40, 0x20, 0x10,
+ 0x08, 0x04, 0x02, 0x01};
CHECK_EQ((bytes[byte] & kMasks[bit]) != 0, i->second);
}
} else {
@@ -455,8 +459,13 @@ void StrikeRegister::ValidateTree(
CHECK_EQ(free_internal_nodes.count(inter), 0u);
CHECK_EQ(used_internal_nodes->count(inter), 0u);
used_internal_nodes->insert(inter);
- ValidateTree(inter, bit, bits, free_internal_nodes, free_external_nodes,
- used_internal_nodes, used_external_nodes);
+ ValidateTree(inter,
+ bit,
+ bits,
+ free_internal_nodes,
+ free_external_nodes,
+ used_internal_nodes,
+ used_external_nodes);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698