Fix clang 5.0 compiler warnings

This commit is contained in:
Sebastian Messmer 2017-09-16 17:45:15 +01:00
parent e4acf4e9a8
commit f7c089ba47
7 changed files with 8 additions and 8 deletions

View File

@ -108,7 +108,7 @@ void BlobOnBlocks::read(void *target, uint64_t offset, uint64_t count) const {
uint64_t BlobOnBlocks::tryRead(void *target, uint64_t offset, uint64_t count) const {
//TODO Quite inefficient to call size() here, because that has to traverse the tree
uint64_t realCount = std::max(UINT64_C(0), std::min(count, size()-offset));
uint64_t realCount = std::max(INT64_C(0), std::min(static_cast<int64_t>(count), static_cast<int64_t>(size())-static_cast<int64_t>(offset)));
_read(target, offset, realCount);
return realCount;
}

View File

@ -73,7 +73,6 @@ unique_ref<DataNode> DataNodeStore::createNewNodeAsCopyFrom(const DataNode &sour
unique_ref<DataNode> DataNodeStore::overwriteNodeWith(unique_ref<DataNode> target, const DataNode &source) {
ASSERT(target->node().layout().blocksizeBytes() == _layout.blocksizeBytes(), "Target node has wrong layout. Is it from the same DataNodeStore?");
ASSERT(source.node().layout().blocksizeBytes() == _layout.blocksizeBytes(), "Source node has wrong layout. Is it from the same DataNodeStore?");
Key key = target->key();
auto targetBlock = target->node().releaseBlock();
cpputils::destruct(std::move(target)); // Call destructor
blockstore::utils::copyTo(targetBlock.get(), source.node().block());

View File

@ -54,7 +54,7 @@ namespace cpputils {
inline size_t ThreadsafeRandomDataBuffer::_get(void *target, size_t numBytes) {
boost::unique_lock<boost::mutex> lock(_mutex);
_dataAddedCv.wait(lock, [this, numBytes] {
_dataAddedCv.wait(lock, [this] {
return _buffer.size() > 0;
});
size_t gettableBytes = std::min(_buffer.size(), numBytes);

View File

@ -9,7 +9,7 @@ class FsppDeviceTest_Timestamps: public FsppNodeTest<ConcreteFileSystemTestFixtu
public:
void Test_Load_While_Loaded() {
auto node = this->CreateNode("/mynode");
auto operation = [this, &node] () {
auto operation = [this] () {
this->device->Load("/mynode");
};
this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS("/mynode", operation, {this->ExpectDoesntUpdateAnyTimestamps});

View File

@ -410,7 +410,7 @@ TEST_F(DataTreeTest_TraverseLeaves, LastLeafIsAlreadyResizedInCallback) {
} else {
EXPECT_TRUE(false) << "only two nodes";
}
}, [this] (uint32_t /*nodeIndex*/) -> Data {
}, [] (uint32_t /*nodeIndex*/) -> Data {
return Data(1);
});
}
@ -421,7 +421,7 @@ TEST_F(DataTreeTest_TraverseLeaves, LastLeafIsAlreadyResizedInCallback_TwoLevel)
auto tree = treeStore.load(root->key()).value();
tree->traverseLeaves(0, nodeStore->layout().maxChildrenPerInnerNode()+1, [this] (uint32_t /*leafIndex*/, bool /*isRightBorderNode*/, LeafHandle leaf) {
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf(), leaf.node()->numBytes());
}, [this] (uint32_t /*nodeIndex*/) -> Data {
}, [] (uint32_t /*nodeIndex*/) -> Data {
return Data(1);
});
}

View File

@ -47,7 +47,6 @@ TEST_F(SCryptTest, DifferentPasswordResultsInDifferentKey) {
TEST_F(SCryptTest, UsesCorrectSettings) {
auto scrypt = SCrypt::forNewKey(SCrypt::TestSettings);
auto derivedKey = scrypt->deriveKey<16>("mypassword");
SCryptParameters parameters = kdfParameters(*scrypt);
EXPECT_EQ(SCrypt::TestSettings.SALT_LEN, parameters.salt().size());
EXPECT_EQ(SCrypt::TestSettings.N, parameters.N());
@ -57,7 +56,6 @@ TEST_F(SCryptTest, UsesCorrectSettings) {
TEST_F(SCryptTest, UsesCorrectDefaultSettings) {
auto scrypt = SCrypt::forNewKey(SCrypt::DefaultSettings);
auto derivedKey = scrypt->deriveKey<16>("mypassword");
SCryptParameters parameters = kdfParameters(*scrypt);
EXPECT_EQ(SCrypt::DefaultSettings.SALT_LEN, parameters.salt().size());
EXPECT_EQ(SCrypt::DefaultSettings.N, parameters.N());

View File

@ -143,6 +143,7 @@ TEST_P(FixedSizeDataTestWithParam, Drop_One) {
TEST_P(FixedSizeDataTestWithParam, Take_Nothing) {
FixedSizeData<SIZE> source(GetParam());
FixedSizeData<0> taken = source.take<0>();
(void)taken; // silence unused variable warning
}
TEST_P(FixedSizeDataTestWithParam, Drop_Nothing) {
@ -160,12 +161,14 @@ TEST_P(FixedSizeDataTestWithParam, Take_All) {
TEST_P(FixedSizeDataTestWithParam, Drop_All) {
FixedSizeData<SIZE> source(GetParam());
FixedSizeData<0> taken = source.drop<SIZE>();
(void)taken; // silence unused variable warning
}
TEST_F(FixedSizeDataTest, CopyConstructorDoesntChangeSource) {
FixedSizeData<SIZE> data1 = FixedSizeData<SIZE>::FromString(DATA1_AS_STRING);
FixedSizeData<SIZE> data2(data1);
EXPECT_EQ(DATA1_AS_STRING, data1.ToString());
(void)data2; // silence unused variable warning
}
TEST_P(FixedSizeDataTestWithParam, IsEqualAfterAssignment1) {