Add style warnings

This commit is contained in:
Sebastian Messmer 2015-03-16 18:32:37 +01:00
parent d81dcaf23a
commit a7a87a07dd
7 changed files with 13 additions and 10 deletions

View File

@ -4,6 +4,7 @@ INCLUDE(messmer/cmake/tools)
ADD_BIICODE_TARGETS() ADD_BIICODE_TARGETS()
ACTIVATE_CPP14() ACTIVATE_CPP14()
ENABLE_STYLE_WARNINGS()
# You can safely delete lines from here... # You can safely delete lines from here...

View File

@ -87,7 +87,7 @@ uint64_t DataNodeStore::numNodes() const {
void DataNodeStore::removeSubtree(unique_ptr<DataNode> node) { void DataNodeStore::removeSubtree(unique_ptr<DataNode> node) {
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(node.get()); DataInnerNode *inner = dynamic_cast<DataInnerNode*>(node.get());
if (inner != nullptr) { if (inner != nullptr) {
for (int i = 0; i < inner->numChildren(); ++i) { for (uint32_t i = 0; i < inner->numChildren(); ++i) {
auto child = load(inner->getChild(i)->key()); auto child = load(inner->getChild(i)->key());
removeSubtree(std::move(child)); removeSubtree(std::move(child));
} }

View File

@ -6,7 +6,7 @@ namespace utils {
uint32_t intPow(uint32_t base, uint32_t exponent) { uint32_t intPow(uint32_t base, uint32_t exponent) {
uint32_t result = 1; uint32_t result = 1;
for(int i = 0; i < exponent; ++i) { for(uint32_t i = 0; i < exponent; ++i) {
result *= base; result *= base;
} }
return result; return result;

View File

@ -67,7 +67,7 @@ public:
auto root = nodeStore->load(key); auto root = nodeStore->load(key);
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get()); DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
if (inner != nullptr) { if (inner != nullptr) {
for (int i = 0; i < inner->numChildren()-1; ++i) { for (uint32_t i = 0; i < inner->numChildren()-1; ++i) {
EXPECT_IS_MAXDATA_TREE(inner->getChild(i)->key()); EXPECT_IS_MAXDATA_TREE(inner->getChild(i)->key());
} }
EXPECT_IS_LEFTMAXDATA_TREE(inner->LastChild()->key()); EXPECT_IS_LEFTMAXDATA_TREE(inner->LastChild()->key());
@ -78,7 +78,7 @@ public:
auto root = nodeStore->load(key); auto root = nodeStore->load(key);
DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get()); DataInnerNode *inner = dynamic_cast<DataInnerNode*>(root.get());
if (inner != nullptr) { if (inner != nullptr) {
for (int i = 0; i < inner->numChildren(); ++i) { for (uint32_t i = 0; i < inner->numChildren(); ++i) {
EXPECT_IS_MAXDATA_TREE(inner->getChild(i)->key()); EXPECT_IS_MAXDATA_TREE(inner->getChild(i)->key());
} }
} else { } else {

View File

@ -128,7 +128,7 @@ unique_ptr<DataInnerNode> DataTreeTest::CreateTwoLeafWithSecondLeafSize(uint32_t
unique_ptr<DataInnerNode> DataTreeTest::CreateFullTwoLevelWithLastLeafSize(uint32_t size) { unique_ptr<DataInnerNode> DataTreeTest::CreateFullTwoLevelWithLastLeafSize(uint32_t size) {
auto root = CreateFullTwoLevel(); auto root = CreateFullTwoLevel();
for (int i = 0; i < root->numChildren()-1; ++i) { for (uint32_t i = 0; i < root->numChildren()-1; ++i) {
LoadLeafNode(root->getChild(i)->key())->resize(nodeStore->layout().maxBytesPerLeaf()); LoadLeafNode(root->getChild(i)->key())->resize(nodeStore->layout().maxBytesPerLeaf());
} }
LoadLeafNode(root->LastChild()->key())->resize(size); LoadLeafNode(root->LastChild()->key())->resize(size);
@ -167,9 +167,9 @@ unique_ptr<DataInnerNode> DataTreeTest::CreateThreeLevelWithThreeChildrenAndLast
unique_ptr<DataInnerNode> DataTreeTest::CreateFullThreeLevelWithLastLeafSize(uint32_t size) { unique_ptr<DataInnerNode> DataTreeTest::CreateFullThreeLevelWithLastLeafSize(uint32_t size) {
auto root = CreateFullThreeLevel(); auto root = CreateFullThreeLevel();
for (int i = 0; i < root->numChildren(); ++i) { for (uint32_t i = 0; i < root->numChildren(); ++i) {
auto node = LoadInnerNode(root->getChild(i)->key()); auto node = LoadInnerNode(root->getChild(i)->key());
for (int j = 0; j < node->numChildren(); ++j) { for (uint32_t j = 0; j < node->numChildren(); ++j) {
LoadLeafNode(node->getChild(j)->key())->resize(nodeStore->layout().maxBytesPerLeaf()); LoadLeafNode(node->getChild(j)->key())->resize(nodeStore->layout().maxBytesPerLeaf());
} }
} }
@ -226,7 +226,7 @@ void DataTreeTest::CHECK_DEPTH(int depth, const Key &key) {
} else { } else {
auto node = LoadInnerNode(key); auto node = LoadInnerNode(key);
EXPECT_EQ(depth, node->depth()); EXPECT_EQ(depth, node->depth());
for (int i = 0; i < node->numChildren(); ++i) { for (uint32_t i = 0; i < node->numChildren(); ++i) {
CHECK_DEPTH(depth-1, node->getChild(i)->key()); CHECK_DEPTH(depth-1, node->getChild(i)->key());
} }
} }

View File

@ -23,7 +23,7 @@ public:
EXPECT_EQ(_data.size(), leaf.numBytes()); EXPECT_EQ(_data.size(), leaf.numBytes());
EXPECT_EQ(0, std::memcmp(_data.data(), loadData(leaf).data(), _data.size())); EXPECT_EQ(0, std::memcmp(_data.data(), loadData(leaf).data(), _data.size()));
} else { } else {
EXPECT_LE(onlyCheckNumBytes, leaf.numBytes()); EXPECT_LE(onlyCheckNumBytes, (int)leaf.numBytes());
EXPECT_EQ(0, std::memcmp(_data.data(), loadData(leaf).data(), onlyCheckNumBytes)); EXPECT_EQ(0, std::memcmp(_data.data(), loadData(leaf).data(), onlyCheckNumBytes));
} }
} }

View File

@ -49,7 +49,7 @@ private:
} else { } else {
auto inner = dynamic_cast<blobstore::onblocks::datanodestore::DataInnerNode*>(node); auto inner = dynamic_cast<blobstore::onblocks::datanodestore::DataInnerNode*>(node);
int leafIndex = firstLeafIndex; int leafIndex = firstLeafIndex;
for (int i = 0; i < inner->numChildren(); ++i) { for (uint32_t i = 0; i < inner->numChildren(); ++i) {
auto child = _dataNodeStore->load(inner->getChild(i)->key()); auto child = _dataNodeStore->load(inner->getChild(i)->key());
leafIndex = ForEachLeaf(child.get(), leafIndex, endLeafIndex, action); leafIndex = ForEachLeaf(child.get(), leafIndex, endLeafIndex, action);
} }
@ -69,6 +69,8 @@ private:
return mod(_dataNodeStore->layout().maxBytesPerLeaf() - childIndex, _dataNodeStore->layout().maxBytesPerLeaf()); return mod(_dataNodeStore->layout().maxBytesPerLeaf() - childIndex, _dataNodeStore->layout().maxBytesPerLeaf());
case SizePolicy::Unchanged: case SizePolicy::Unchanged:
return leaf->numBytes(); return leaf->numBytes();
default:
assert(false);
} }
} }