From dcf185057a4c3d1b927c6bdba10d9add6e334e66 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 4 Jun 2012 07:28:16 -0700 Subject: [PATCH] Whitespace. --- src/SHAMapSync.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/SHAMapSync.cpp b/src/SHAMapSync.cpp index dcc3b74d4f..d0af0c44d4 100644 --- a/src/SHAMapSync.cpp +++ b/src/SHAMapSync.cpp @@ -18,13 +18,13 @@ void SHAMap::getMissingNodes(std::vector& nodeIDs, std::vectorisValid()); - if(root->isFullBelow()) + if (root->isFullBelow()) { clearSynching(); return; } - if(!root->isInner()) + if (!root->isInner()) { Log(lsWARNING) << "synching empty tree"; return; @@ -86,7 +86,7 @@ bool SHAMap::getNodeFat(const SHAMapNode& wanted, std::vector& nodeI SHAMapTreeNode::pointer node = getNode(wanted); if (!node) { - assert(false); // Remove for release, this can happen if we get a bogus request + assert(false); // FIXME Remove for release, this can happen if we get a bogus request return false; } @@ -233,7 +233,7 @@ bool SHAMap::addKnownNode(const SHAMapNode& node, const std::vectorisInner()); - for(int i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) if (!iNode->isEmptyBranch(i)) { SHAMapTreeNode::pointer nextNode = getNode(iNode->getChildNodeID(i), iNode->getChildHash(i), false); @@ -258,7 +258,7 @@ bool SHAMap::deepCompare(SHAMap& other) stack.pop(); SHAMapTreeNode::pointer otherNode; - if(node->isRoot()) otherNode = other.root; + if (node->isRoot()) otherNode = other.root; else otherNode = other.getNode(*node, node->getNodeHash(), false); if (!otherNode) @@ -286,11 +286,11 @@ bool SHAMap::deepCompare(SHAMap& other) { if (!otherNode->isInner()) return false; - for(int i=0; i<16; i++) + for (int i = 0; i < 16; ++i) { - if(node->isEmptyBranch(i)) + if (node->isEmptyBranch(i)) { - if(!otherNode->isEmptyBranch(i)) return false; + if (!otherNode->isEmptyBranch(i)) return false; } else { @@ -314,9 +314,9 @@ bool SHAMap::deepCompare(SHAMap& other) static SHAMapItem::pointer makeRandomAS() { - Serializer s; - for(int d = 0; d < 3; ++d) s.add32(rand()); - return boost::make_shared(s.getRIPEMD160().to256(), s.peekData()); + Serializer s; + for (int d = 0; d < 3; ++d) s.add32(rand()); + return boost::make_shared(s.getRIPEMD160().to256(), s.peekData()); } static bool confuseMap(SHAMap &map, int count) @@ -386,25 +386,24 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test ) SHAMap source, destination; - // add random data to the source map int items = 10000; for (int i = 0; i < items; ++i) source.addItem(*makeRandomAS(), false); Log(lsTRACE) << "Adding items, then removing them"; - if(!confuseMap(source, 500)) BOOST_FAIL("ConfuseMap"); + if (!confuseMap(source, 500)) BOOST_FAIL("ConfuseMap"); source.setImmutable(); Log(lsTRACE) << "SOURCE COMPLETE, SYNCHING"; std::vector nodeIDs, gotNodeIDs; - std::list > gotNodes; + std::list< std::vector > gotNodes; std::vector hashes; std::vector::iterator nodeIDIterator; - std::list >::iterator rawNodeIterator; + std::list< std::vector >::iterator rawNodeIterator; int passes = 0; int nodes = 0; @@ -441,7 +440,7 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test ) // get the list of nodes we know we need destination.getMissingNodes(nodeIDs, hashes, 2048, NULL); - if(nodeIDs.empty()) break; + if (nodeIDs.empty()) break; Log(lsINFO) << nodeIDs.size() << " needed nodes";