Fix clang 5.0 compiler warnings
This commit is contained in:
parent
e4acf4e9a8
commit
f7c089ba47
@ -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 {
|
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
|
//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);
|
_read(target, offset, realCount);
|
||||||
return realCount;
|
return realCount;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,6 @@ unique_ref<DataNode> DataNodeStore::createNewNodeAsCopyFrom(const DataNode &sour
|
|||||||
unique_ref<DataNode> DataNodeStore::overwriteNodeWith(unique_ref<DataNode> target, const DataNode &source) {
|
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(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?");
|
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();
|
auto targetBlock = target->node().releaseBlock();
|
||||||
cpputils::destruct(std::move(target)); // Call destructor
|
cpputils::destruct(std::move(target)); // Call destructor
|
||||||
blockstore::utils::copyTo(targetBlock.get(), source.node().block());
|
blockstore::utils::copyTo(targetBlock.get(), source.node().block());
|
||||||
|
@ -54,7 +54,7 @@ namespace cpputils {
|
|||||||
|
|
||||||
inline size_t ThreadsafeRandomDataBuffer::_get(void *target, size_t numBytes) {
|
inline size_t ThreadsafeRandomDataBuffer::_get(void *target, size_t numBytes) {
|
||||||
boost::unique_lock<boost::mutex> lock(_mutex);
|
boost::unique_lock<boost::mutex> lock(_mutex);
|
||||||
_dataAddedCv.wait(lock, [this, numBytes] {
|
_dataAddedCv.wait(lock, [this] {
|
||||||
return _buffer.size() > 0;
|
return _buffer.size() > 0;
|
||||||
});
|
});
|
||||||
size_t gettableBytes = std::min(_buffer.size(), numBytes);
|
size_t gettableBytes = std::min(_buffer.size(), numBytes);
|
||||||
|
@ -9,7 +9,7 @@ class FsppDeviceTest_Timestamps: public FsppNodeTest<ConcreteFileSystemTestFixtu
|
|||||||
public:
|
public:
|
||||||
void Test_Load_While_Loaded() {
|
void Test_Load_While_Loaded() {
|
||||||
auto node = this->CreateNode("/mynode");
|
auto node = this->CreateNode("/mynode");
|
||||||
auto operation = [this, &node] () {
|
auto operation = [this] () {
|
||||||
this->device->Load("/mynode");
|
this->device->Load("/mynode");
|
||||||
};
|
};
|
||||||
this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS("/mynode", operation, {this->ExpectDoesntUpdateAnyTimestamps});
|
this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS("/mynode", operation, {this->ExpectDoesntUpdateAnyTimestamps});
|
||||||
|
@ -410,7 +410,7 @@ TEST_F(DataTreeTest_TraverseLeaves, LastLeafIsAlreadyResizedInCallback) {
|
|||||||
} else {
|
} else {
|
||||||
EXPECT_TRUE(false) << "only two nodes";
|
EXPECT_TRUE(false) << "only two nodes";
|
||||||
}
|
}
|
||||||
}, [this] (uint32_t /*nodeIndex*/) -> Data {
|
}, [] (uint32_t /*nodeIndex*/) -> Data {
|
||||||
return Data(1);
|
return Data(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ TEST_F(DataTreeTest_TraverseLeaves, LastLeafIsAlreadyResizedInCallback_TwoLevel)
|
|||||||
auto tree = treeStore.load(root->key()).value();
|
auto tree = treeStore.load(root->key()).value();
|
||||||
tree->traverseLeaves(0, nodeStore->layout().maxChildrenPerInnerNode()+1, [this] (uint32_t /*leafIndex*/, bool /*isRightBorderNode*/, LeafHandle leaf) {
|
tree->traverseLeaves(0, nodeStore->layout().maxChildrenPerInnerNode()+1, [this] (uint32_t /*leafIndex*/, bool /*isRightBorderNode*/, LeafHandle leaf) {
|
||||||
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf(), leaf.node()->numBytes());
|
EXPECT_EQ(nodeStore->layout().maxBytesPerLeaf(), leaf.node()->numBytes());
|
||||||
}, [this] (uint32_t /*nodeIndex*/) -> Data {
|
}, [] (uint32_t /*nodeIndex*/) -> Data {
|
||||||
return Data(1);
|
return Data(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ TEST_F(SCryptTest, DifferentPasswordResultsInDifferentKey) {
|
|||||||
|
|
||||||
TEST_F(SCryptTest, UsesCorrectSettings) {
|
TEST_F(SCryptTest, UsesCorrectSettings) {
|
||||||
auto scrypt = SCrypt::forNewKey(SCrypt::TestSettings);
|
auto scrypt = SCrypt::forNewKey(SCrypt::TestSettings);
|
||||||
auto derivedKey = scrypt->deriveKey<16>("mypassword");
|
|
||||||
SCryptParameters parameters = kdfParameters(*scrypt);
|
SCryptParameters parameters = kdfParameters(*scrypt);
|
||||||
EXPECT_EQ(SCrypt::TestSettings.SALT_LEN, parameters.salt().size());
|
EXPECT_EQ(SCrypt::TestSettings.SALT_LEN, parameters.salt().size());
|
||||||
EXPECT_EQ(SCrypt::TestSettings.N, parameters.N());
|
EXPECT_EQ(SCrypt::TestSettings.N, parameters.N());
|
||||||
@ -57,7 +56,6 @@ TEST_F(SCryptTest, UsesCorrectSettings) {
|
|||||||
|
|
||||||
TEST_F(SCryptTest, UsesCorrectDefaultSettings) {
|
TEST_F(SCryptTest, UsesCorrectDefaultSettings) {
|
||||||
auto scrypt = SCrypt::forNewKey(SCrypt::DefaultSettings);
|
auto scrypt = SCrypt::forNewKey(SCrypt::DefaultSettings);
|
||||||
auto derivedKey = scrypt->deriveKey<16>("mypassword");
|
|
||||||
SCryptParameters parameters = kdfParameters(*scrypt);
|
SCryptParameters parameters = kdfParameters(*scrypt);
|
||||||
EXPECT_EQ(SCrypt::DefaultSettings.SALT_LEN, parameters.salt().size());
|
EXPECT_EQ(SCrypt::DefaultSettings.SALT_LEN, parameters.salt().size());
|
||||||
EXPECT_EQ(SCrypt::DefaultSettings.N, parameters.N());
|
EXPECT_EQ(SCrypt::DefaultSettings.N, parameters.N());
|
||||||
|
@ -143,6 +143,7 @@ TEST_P(FixedSizeDataTestWithParam, Drop_One) {
|
|||||||
TEST_P(FixedSizeDataTestWithParam, Take_Nothing) {
|
TEST_P(FixedSizeDataTestWithParam, Take_Nothing) {
|
||||||
FixedSizeData<SIZE> source(GetParam());
|
FixedSizeData<SIZE> source(GetParam());
|
||||||
FixedSizeData<0> taken = source.take<0>();
|
FixedSizeData<0> taken = source.take<0>();
|
||||||
|
(void)taken; // silence unused variable warning
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(FixedSizeDataTestWithParam, Drop_Nothing) {
|
TEST_P(FixedSizeDataTestWithParam, Drop_Nothing) {
|
||||||
@ -160,12 +161,14 @@ TEST_P(FixedSizeDataTestWithParam, Take_All) {
|
|||||||
TEST_P(FixedSizeDataTestWithParam, Drop_All) {
|
TEST_P(FixedSizeDataTestWithParam, Drop_All) {
|
||||||
FixedSizeData<SIZE> source(GetParam());
|
FixedSizeData<SIZE> source(GetParam());
|
||||||
FixedSizeData<0> taken = source.drop<SIZE>();
|
FixedSizeData<0> taken = source.drop<SIZE>();
|
||||||
|
(void)taken; // silence unused variable warning
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FixedSizeDataTest, CopyConstructorDoesntChangeSource) {
|
TEST_F(FixedSizeDataTest, CopyConstructorDoesntChangeSource) {
|
||||||
FixedSizeData<SIZE> data1 = FixedSizeData<SIZE>::FromString(DATA1_AS_STRING);
|
FixedSizeData<SIZE> data1 = FixedSizeData<SIZE>::FromString(DATA1_AS_STRING);
|
||||||
FixedSizeData<SIZE> data2(data1);
|
FixedSizeData<SIZE> data2(data1);
|
||||||
EXPECT_EQ(DATA1_AS_STRING, data1.ToString());
|
EXPECT_EQ(DATA1_AS_STRING, data1.ToString());
|
||||||
|
(void)data2; // silence unused variable warning
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(FixedSizeDataTestWithParam, IsEqualAfterAssignment1) {
|
TEST_P(FixedSizeDataTestWithParam, IsEqualAfterAssignment1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user