Skip to content

Commit 5bfc047

Browse files
pavel-pimenovmfontanini
authored andcommitted
Fix detected by PVS-Studio (mfontanini#167)
* Fix PVS-Studio V591 Non-void function should return a value. V519 The 'new_item' variable is assigned values twice successively.
1 parent 4a88760 commit 5bfc047

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

include/cppkafka/header_list_iterator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class HeaderIterator {
7878
header_list_ = other.header_list_;
7979
header_ = make_header(other.header_);
8080
index_ = other.index_;
81+
return *this;
8182
}
8283
HeaderIterator(HeaderIterator&&) = default;
8384
HeaderIterator& operator=(HeaderIterator&&) = default;

src/topic_partition_list.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ TopicPartitionsListPtr convert(const TopicPartitionList& topic_partitions) {
4545
TopicPartitionsListPtr handle(rd_kafka_topic_partition_list_new(topic_partitions.size()),
4646
&rd_kafka_topic_partition_list_destroy);
4747
for (const auto& item : topic_partitions) {
48-
rd_kafka_topic_partition_t* new_item = nullptr;
49-
new_item = rd_kafka_topic_partition_list_add(handle.get(),
50-
item.get_topic().data(),
51-
item.get_partition());
48+
rd_kafka_topic_partition_t* new_item = rd_kafka_topic_partition_list_add(
49+
handle.get(),
50+
item.get_topic().data(),
51+
item.get_partition()
52+
);
5253
new_item->offset = item.get_offset();
5354
}
5455
return handle;

0 commit comments

Comments
 (0)