Skip to content

Commit

Permalink
fix: cppcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushi421 committed Jan 24, 2025
1 parent cb0097c commit 6e71ee0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/agnocastlib/include/agnocast_subscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class Subscription : public SubscriptionBase
auto node_base = node->get_node_base_interface();
rclcpp::CallbackGroup::SharedPtr callback_group = get_valid_callback_group(node_base, options);
uint32_t local_topic_id = agnocast::register_callback(

Check failure on line 81 in src/agnocastlib/include/agnocast_subscription.hpp

View workflow job for this annotation

GitHub Actions / cppcheck-differential

Variable 'local_topic_id' is assigned a value that is never used. [unreadVariable]
callback, topic_name_, static_cast<uint32_t>(qos.depth()), mq, callback_group);
callback, topic_name_, static_cast<uint32_t>(qos.depth()), mq,
callback_group); // cppcheck-suppress unreadVariable

#ifdef TRACETOOLS_LTTNG_ENABLED
uint64_t pid_ltid = (static_cast<uint64_t>(subscriber_pid_) << 32) | local_topic_id;
Expand Down
2 changes: 1 addition & 1 deletion src/agnocastlib/src/agnocast_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ bool AgnocastExecutor::get_next_agnocast_executables(
exit(EXIT_FAILURE);
}

uint64_t pid_ltid = (static_cast<uint64_t>(my_pid_) << 32) | topic_local_id;
for (int32_t i = static_cast<int32_t>(receive_args.ret_len) - 1; i >= 0;
i--) { // older messages first
const auto callable = agnocast::create_callable(
reinterpret_cast<void *>(receive_args.ret_last_msg_addrs[i]),
receive_args.ret_publisher_pids[i], receive_args.ret_timestamps[i], topic_local_id);

#ifdef TRACETOOLS_LTTNG_ENABLED
uint64_t pid_ltid = (static_cast<uint64_t>(my_pid_) << 32) | topic_local_id;
TRACEPOINT(
agnocast_create_callable, static_cast<const void *>(callable.get()),
reinterpret_cast<void *>(receive_args.ret_last_msg_addrs[i]), receive_args.ret_timestamps[i],
Expand Down

0 comments on commit 6e71ee0

Please sign in to comment.