diff --git a/src/blobstore/implementations/onblocks/BlobOnBlocks.cpp b/src/blobstore/implementations/onblocks/BlobOnBlocks.cpp index 304e37ca..50681ff9 100644 --- a/src/blobstore/implementations/onblocks/BlobOnBlocks.cpp +++ b/src/blobstore/implementations/onblocks/BlobOnBlocks.cpp @@ -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(count), static_cast(size())-static_cast(offset))); _read(target, offset, realCount); return realCount; } diff --git a/src/blobstore/implementations/onblocks/datanodestore/DataNodeStore.cpp b/src/blobstore/implementations/onblocks/datanodestore/DataNodeStore.cpp index 42ab53c9..841a15ed 100644 --- a/src/blobstore/implementations/onblocks/datanodestore/DataNodeStore.cpp +++ b/src/blobstore/implementations/onblocks/datanodestore/DataNodeStore.cpp @@ -73,7 +73,6 @@ unique_ref DataNodeStore::createNewNodeAsCopyFrom(const DataNode &sour unique_ref DataNodeStore::overwriteNodeWith(unique_ref 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()); diff --git a/src/cpp-utils/random/ThreadsafeRandomDataBuffer.h b/src/cpp-utils/random/ThreadsafeRandomDataBuffer.h index a1047aa7..c9ee6938 100644 --- a/src/cpp-utils/random/ThreadsafeRandomDataBuffer.h +++ b/src/cpp-utils/random/ThreadsafeRandomDataBuffer.h @@ -54,7 +54,7 @@ namespace cpputils { inline size_t ThreadsafeRandomDataBuffer::_get(void *target, size_t numBytes) { boost::unique_lock lock(_mutex); - _dataAddedCv.wait(lock, [this, numBytes] { + _dataAddedCv.wait(lock, [this] { return _buffer.size() > 0; }); size_t gettableBytes = std::min(_buffer.size(), numBytes); diff --git a/src/fspp/fstest/FsppDeviceTest_Timestamps.h b/src/fspp/fstest/FsppDeviceTest_Timestamps.h index 09a397e5..244e3c15 100644 --- a/src/fspp/fstest/FsppDeviceTest_Timestamps.h +++ b/src/fspp/fstest/FsppDeviceTest_Timestamps.h @@ -9,7 +9,7 @@ class FsppDeviceTest_Timestamps: public FsppNodeTestCreateNode("/mynode"); - auto operation = [this, &node] () { + auto operation = [this] () { this->device->Load("/mynode"); }; this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS("/mynode", operation, {this->ExpectDoesntUpdateAnyTimestamps}); diff --git a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_TraverseLeaves.cpp b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_TraverseLeaves.cpp index f58b74e4..d725090f 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_TraverseLeaves.cpp +++ b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_TraverseLeaves.cpp @@ -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); }); } diff --git a/test/cpp-utils/crypto/kdf/SCryptTest.cpp b/test/cpp-utils/crypto/kdf/SCryptTest.cpp index 275c1967..8bb273f7 100644 --- a/test/cpp-utils/crypto/kdf/SCryptTest.cpp +++ b/test/cpp-utils/crypto/kdf/SCryptTest.cpp @@ -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()); diff --git a/test/cpp-utils/data/FixedSizeDataTest.cpp b/test/cpp-utils/data/FixedSizeDataTest.cpp index dbbb554f..024cb4de 100644 --- a/test/cpp-utils/data/FixedSizeDataTest.cpp +++ b/test/cpp-utils/data/FixedSizeDataTest.cpp @@ -143,6 +143,7 @@ TEST_P(FixedSizeDataTestWithParam, Drop_One) { TEST_P(FixedSizeDataTestWithParam, Take_Nothing) { FixedSizeData 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 source(GetParam()); FixedSizeData<0> taken = source.drop(); + (void)taken; // silence unused variable warning } TEST_F(FixedSizeDataTest, CopyConstructorDoesntChangeSource) { FixedSizeData data1 = FixedSizeData::FromString(DATA1_AS_STRING); FixedSizeData data2(data1); EXPECT_EQ(DATA1_AS_STRING, data1.ToString()); + (void)data2; // silence unused variable warning } TEST_P(FixedSizeDataTestWithParam, IsEqualAfterAssignment1) {