Fix detected by PVS-Studio (#167)

* Fix PVS-Studio
V591 	Non-void function should return a value.
V519 	The 'new_item' variable is assigned values twice successively.
This commit is contained in:
Pavel Pimenov
2019-02-21 05:30:48 +03:00
committed by Matias Fontanini
parent 4a887607b3
commit 5bfc047263
2 changed files with 6 additions and 4 deletions

View File

@@ -78,6 +78,7 @@ public:
header_list_ = other.header_list_;
header_ = make_header(other.header_);
index_ = other.index_;
return *this;
}
HeaderIterator(HeaderIterator&&) = default;
HeaderIterator& operator=(HeaderIterator&&) = default;

View File

@@ -45,10 +45,11 @@ TopicPartitionsListPtr convert(const TopicPartitionList& topic_partitions) {
TopicPartitionsListPtr handle(rd_kafka_topic_partition_list_new(topic_partitions.size()),
&rd_kafka_topic_partition_list_destroy);
for (const auto& item : topic_partitions) {
rd_kafka_topic_partition_t* new_item = nullptr;
new_item = rd_kafka_topic_partition_list_add(handle.get(),
item.get_topic().data(),
item.get_partition());
rd_kafka_topic_partition_t* new_item = rd_kafka_topic_partition_list_add(
handle.get(),
item.get_topic().data(),
item.get_partition()
);
new_item->offset = item.get_offset();
}
return handle;