Fix PVS-Studio

This commit is contained in:
Alexey Milovidov 2021-10-11 14:28:46 +03:00
parent 284e547bc3
commit 2370a8d6da
7 changed files with 12 additions and 12 deletions

View File

@ -94,7 +94,7 @@ class JSONMap : public IItem
};
public:
void add(std::string key, ItemPtr value) { values.emplace_back(Pair{.key = std::move(key), .value = std::move(value)}); }
void add(std::string key, ItemPtr value) { values.emplace_back(Pair{.key = std::move(key), .value = std::move(value)}); } //-V1030
void add(std::string key, std::string value) { add(std::move(key), std::make_unique<JSONString>(std::move(value))); }
void add(std::string key, const char * value) { add(std::move(key), std::make_unique<JSONString>(value)); }
void add(std::string key, std::string_view value) { add(std::move(key), std::make_unique<JSONString>(value)); }

View File

@ -254,7 +254,7 @@ void registerDictionarySourceHTTP(DictionarySourceFactory & factory)
.format =config.getString(settings_config_prefix + ".format", ""),
.update_field = config.getString(settings_config_prefix + ".update_field", ""),
.update_lag = config.getUInt64(settings_config_prefix + ".update_lag", 1),
.header_entries = std::move(header_entries)
.header_entries = std::move(header_entries) //-V1030
};
return std::make_unique<HTTPDictionarySource>(dict_struct, configuration, credentials, sample_block, context, created_from_ddl);

View File

@ -50,7 +50,7 @@ struct HexImpl
UInt8 byte = x >> offset;
/// Skip leading zeros
if (byte == 0 && !was_nonzero && offset)
if (byte == 0 && !was_nonzero && offset) //-V560
continue;
was_nonzero = true;
@ -138,7 +138,7 @@ struct BinImpl
UInt8 byte = x >> offset;
/// Skip leading zeros
if (byte == 0 && !was_nonzero && offset)
if (byte == 0 && !was_nonzero && offset) //-V560
continue;
was_nonzero = true;

View File

@ -238,7 +238,7 @@ public:
capture = std::make_shared<Capture>(Capture{
.captured_names = captured_names_,
.captured_types = std::move(captured_types),
.captured_types = std::move(captured_types), //-V1030
.lambda_arguments = lambda_arguments_,
.return_name = expression_return_name_,
.return_type = function_return_type_,

View File

@ -107,11 +107,11 @@ ExternalLoader::LoadablePtr ExternalUserDefinedExecutableFunctionsLoader::create
UserDefinedExecutableFunctionConfiguration function_configuration
{
.type = function_type,
.name = std::move(name),
.script_path = std::move(command),
.format = std::move(format),
.argument_types = std::move(argument_types),
.result_type = std::move(result_type),
.name = std::move(name), //-V1030
.script_path = std::move(command), //-V1030
.format = std::move(format), //-V1030
.argument_types = std::move(argument_types), //-V1030
.result_type = std::move(result_type), //-V1030
.pool_size = pool_size,
.command_termination_timeout = command_termination_timeout,
.max_command_execution_time = max_command_execution_time,

View File

@ -67,7 +67,7 @@ Chunk KafkaSource::generateImpl()
broken = true;
}
if (!buffer || is_finished)
if (is_finished)
return {};
is_finished = true;

View File

@ -983,7 +983,7 @@ RangesInDataParts MergeTreeDataSelectExecutor::filterPartsByPrimaryKeyAndSkipInd
index_stats.emplace_back(ReadFromMergeTree::IndexStat{
.type = ReadFromMergeTree::IndexType::Skip,
.name = index_name,
.description = std::move(description),
.description = std::move(description), //-V1030
.num_parts_after = index_and_condition.total_parts - index_and_condition.parts_dropped,
.num_granules_after = index_and_condition.total_granules - index_and_condition.granules_dropped});
}