fix: clang warnings. (#508)

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2022-11-22 13:58:00 +02:00 committed by GitHub
parent da03cd8344
commit 77ed4a22dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 8 deletions

View file

@ -67,7 +67,7 @@ uint8_t GetByteAt(std::string_view s, std::size_t at) {
// For XOR, OR, AND operations on a collection of bytes
template <typename BitOp, typename SkipOp>
std::string BitOpString(BitOp operation_f, SkipOp skip_f, const BitsStrVec& values,
std::string&& new_value) {
std::string new_value) {
// at this point, values are not empty
std::size_t max_size = new_value.size();
@ -441,7 +441,7 @@ OpResult<std::string> RunBitOpOnShard(std::string_view op, const OpArgs& op_args
for (auto& key : keys) {
OpResult<PrimeIterator> find_res = es->db_slice().Find(op_args.db_cntx, key, OBJ_STRING);
if (find_res) {
values.emplace_back(std::move(GetString(find_res.value()->second, es)));
values.emplace_back(GetString(find_res.value()->second, es));
} else {
if (find_res.status() == OpStatus::KEY_NOTFOUND) {
continue; // this is allowed, just return empty string per Redis

View file

@ -948,7 +948,7 @@ void GenericFamily::Sort(CmdArgList args, ConnectionContext* cntx) {
if (!entries.ok())
return (*cntx)->SendEmptyArray();
auto sort_call = [cntx, bounds, reversed, key](auto& entries) {
auto sort_call = [cntx, bounds, reversed](auto& entries) {
if (bounds) {
auto sort_it = entries.begin() + std::min(bounds->first + bounds->second, entries.size());
std::partial_sort(entries.begin(), sort_it, entries.end(),

View file

@ -1800,7 +1800,6 @@ void RdbLoader::FlushShardAsync(ShardId sid) {
}
std::error_code RdbLoaderBase::Visit(const Item& item, CompactObj* pv) {
std::string_view key{item.key};
OpaqueObjLoader visitor(item.val.rdb_type, pv);
std::visit(visitor, item.val.obj);
return visitor.ec();

View file

@ -428,7 +428,7 @@ error_code Replica::InitiateDflySync() {
auto partition = Partition(num_df_flows_);
shard_set->pool()->AwaitFiberOnAll([&](unsigned index, auto*) {
for (auto id : partition[index]) {
if (ec = shard_flows_[id]->StartFullSyncFlow(&sb))
if ((ec = shard_flows_[id]->StartFullSyncFlow(&sb)))
break;
}
});
@ -610,7 +610,7 @@ void Replica::FullSyncDflyFb(SyncBlock* sb, string eof_token) {
io::PrefixSource ps{leftover_buf_->InputBuffer(), &ss};
RdbLoader loader(NULL);
loader.SetFullSyncCutCb([this, sb, ran = false]() mutable {
loader.SetFullSyncCutCb([sb, ran = false]() mutable {
if (!ran) {
std::unique_lock lk(sb->mu_);
sb->flows_left--;

View file

@ -871,7 +871,7 @@ error_code ServerFamily::DoSave(bool new_version, Transaction* trans, string* er
const auto scripts = script_mgr_->GetLuaScripts();
auto& summary_snapshot = snapshots[shard_set->size()];
summary_snapshot.reset(new RdbSnapshot(fq_threadpool_.get()));
if (ec = DoPartialSave(filename, path, start, scripts, summary_snapshot.get(), nullptr)) {
if ((ec = DoPartialSave(filename, path, start, scripts, summary_snapshot.get(), nullptr))) {
summary_snapshot.reset();
}
}
@ -880,7 +880,7 @@ error_code ServerFamily::DoSave(bool new_version, Transaction* trans, string* er
auto cb = [&](Transaction* t, EngineShard* shard) {
auto& snapshot = snapshots[shard->shard_id()];
snapshot.reset(new RdbSnapshot(fq_threadpool_.get()));
if (ec = DoPartialSave(filename, path, start, {}, snapshot.get(), shard)) {
if ((ec = DoPartialSave(filename, path, start, {}, snapshot.get(), shard))) {
snapshot.reset();
}
return OpStatus::OK;