From fc702f1537da62b6802730123c6a4187373c0a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Mon, 25 Nov 2024 15:18:35 +0100 Subject: [PATCH] make linters happy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- rmw_zenoh_cpp/src/detail/rmw_client_data.cpp | 24 ++++++++++--------- .../src/detail/rmw_context_impl_s.cpp | 8 +++---- .../src/detail/rmw_publisher_data.cpp | 8 ++++--- rmw_zenoh_cpp/src/detail/rmw_service_data.cpp | 10 ++++---- .../src/detail/rmw_subscription_data.cpp | 19 +++++++++------ rmw_zenoh_cpp/src/zenohd/main.cpp | 8 +++---- 6 files changed, 44 insertions(+), 33 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp index 28490b59..5e3b7cfc 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp @@ -295,15 +295,17 @@ rmw_ret_t ClientData::take_response( RMW_SET_ERROR_MSG("Failed to get source_timestamp from client call attachment"); return RMW_RET_ERROR; } - memcpy(request_header->request_id.writer_guid, attachment.source_gid.data(), - RMW_GID_STORAGE_SIZE); + memcpy( + request_header->request_id.writer_guid, + attachment.source_gid.data(), + RMW_GID_STORAGE_SIZE); request_header->received_timestamp = latest_reply->get_received_timestamp(); *taken = true; } else { RMW_ZENOH_LOG_DEBUG_NAMED( - "rmw_zenoh_cpp", - "ClientData not able to get slice data"); + "rmw_zenoh_cpp", + "ClientData not able to get slice data"); return RMW_RET_ERROR; } @@ -391,9 +393,9 @@ rmw_ret_t ClientData::send_request( [client_data](const zenoh::Reply & reply) { if (!reply.is_ok()) { RMW_ZENOH_LOG_ERROR_NAMED( - "rmw_zenoh_cpp", - "z_reply_is_ok returned False Reason: %s", - reply.get_err().get_payload().as_string()) + "rmw_zenoh_cpp", + "z_reply_is_ok returned False Reason: %s", + reply.get_err().get_payload().as_string()) return; } const zenoh::Sample & sample = reply.get_ok(); @@ -401,9 +403,9 @@ rmw_ret_t ClientData::send_request( auto sub_data = client_data.lock(); if (sub_data == nullptr) { RMW_ZENOH_LOG_ERROR_NAMED( - "rmw_zenoh_cpp", - "Unable to obtain ClientData from data for %s.", - std::string(sample.get_keyexpr().as_string_view())); + "rmw_zenoh_cpp", + "Unable to obtain ClientData from data for %s.", + std::string(sample.get_keyexpr().as_string_view())); return; } @@ -415,7 +417,7 @@ rmw_ret_t ClientData::send_request( std::chrono::system_clock::now().time_since_epoch().count(); sub_data->add_new_reply( - std::make_unique(reply, received_timestamp)); + std::make_unique(reply, received_timestamp)); }, zenoh::closures::none, std::move(opts), diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp index 03fd9d7d..98e637a3 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -76,7 +76,7 @@ class rmw_context_impl_s::Data final { // Initialize the zenoh configuration. std::optional config = rmw_zenoh_cpp::get_z_config( - rmw_zenoh_cpp::ConfigurableEntity::Session); + rmw_zenoh_cpp::ConfigurableEntity::Session); if (!config.has_value()) { throw std::runtime_error("Error configuring Zenoh session."); @@ -95,9 +95,9 @@ class rmw_context_impl_s::Data final // Initialize the zenoh session. session_ = std::make_shared( - std::move(config.value()), - zenoh::Session::SessionOptions::create_default(), - &result); + std::move(config.value()), + zenoh::Session::SessionOptions::create_default(), + &result); if(result != Z_OK) { throw std::runtime_error("Error setting up zenoh session. "); } diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp index 1634743a..83e37a9e 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp @@ -269,7 +269,9 @@ rmw_ret_t PublisherData::publish( entity_->copy_gid(local_gid); zenoh::ZResult err; auto options = zenoh::Publisher::PutOptions::create_default(); - options.attachment = create_map_and_set_sequence_num(sequence_number_++, local_gid); + options.attachment = create_map_and_set_sequence_num( + sequence_number_++, + local_gid); // TODO(ahcorde): shmbuf std::vector raw_image( @@ -398,8 +400,8 @@ rmw_ret_t PublisherData::shutdown() std::move(pub_).undeclare(&err); if (err != Z_OK) { RMW_ZENOH_LOG_ERROR_NAMED( - "rmw_zenoh_cpp", - "Unable to undeclare publisher"); + "rmw_zenoh_cpp", + "Unable to undeclare publisher"); return RMW_RET_ERROR; } diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp index 508178c2..82caae80 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp @@ -148,8 +148,8 @@ std::shared_ptr ServiceData::make( auto sub_data = data_wp.lock(); if (sub_data == nullptr) { RMW_ZENOH_LOG_ERROR_NAMED( - "rmw_zenoh_cpp", - "Unable to obtain ServiceData from data for %s.", + "rmw_zenoh_cpp", + "Unable to obtain ServiceData from data for %s.", std::string(query.get_keyexpr().as_string_view())); return; } @@ -310,8 +310,10 @@ rmw_ret_t ServiceData::take_request( return RMW_RET_ERROR; } - memcpy(request_header->request_id.writer_guid, attachment.source_gid.data(), - RMW_GID_STORAGE_SIZE); + memcpy( + request_header->request_id.writer_guid, + attachment.source_gid.data(), + RMW_GID_STORAGE_SIZE); request_header->source_timestamp = attachment.source_timestamp; if (request_header->source_timestamp < 0) { diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp index 848eeb94..5ed6dfb4 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp @@ -269,9 +269,10 @@ bool SubscriptionData::init() zenoh::ZResult err; std::get>( - sub_data->sub_.value()).get(zenoh::KeyExpr(selector), - std::move(opts), - &err); + sub_data->sub_.value()).get( + zenoh::KeyExpr(selector), + std::move(opts), + &err); if (err != Z_OK) { RMW_SET_ERROR_MSG("unable to get querying subscriber."); @@ -508,8 +509,10 @@ rmw_ret_t SubscriptionData::take_one_message( // TODO(clalancette): fill in reception_sequence_number message_info->reception_sequence_number = 0; message_info->publisher_gid.implementation_identifier = rmw_zenoh_cpp::rmw_zenoh_identifier; - memcpy(message_info->publisher_gid.data, msg_data->attachment.source_gid.data(), - RMW_GID_STORAGE_SIZE); + memcpy( + message_info->publisher_gid.data, + msg_data->attachment.source_gid.data(), + RMW_GID_STORAGE_SIZE); message_info->from_intra_process = false; } *taken = true; @@ -563,8 +566,10 @@ rmw_ret_t SubscriptionData::take_serialized_message( // TODO(clalancette): fill in reception_sequence_number message_info->reception_sequence_number = 0; message_info->publisher_gid.implementation_identifier = rmw_zenoh_cpp::rmw_zenoh_identifier; - memcpy(message_info->publisher_gid.data, msg_data->attachment.source_gid.data(), - RMW_GID_STORAGE_SIZE); + memcpy( + message_info->publisher_gid.data, + msg_data->attachment.source_gid.data(), + RMW_GID_STORAGE_SIZE); message_info->from_intra_process = false; } } else { diff --git a/rmw_zenoh_cpp/src/zenohd/main.cpp b/rmw_zenoh_cpp/src/zenohd/main.cpp index b32eca79..ea0b4fbe 100644 --- a/rmw_zenoh_cpp/src/zenohd/main.cpp +++ b/rmw_zenoh_cpp/src/zenohd/main.cpp @@ -67,7 +67,7 @@ int main(int argc, char ** argv) zenoh::try_init_log_from_env(); std::optional config = rmw_zenoh_cpp::get_z_config( - rmw_zenoh_cpp::ConfigurableEntity::Router); + rmw_zenoh_cpp::ConfigurableEntity::Router); if (!config.has_value()) { RMW_SET_ERROR_MSG("Error configuring Zenoh router."); @@ -76,9 +76,9 @@ int main(int argc, char ** argv) zenoh::ZResult result; auto session = zenoh::Session::open( - std::move(config.value()), - zenoh::Session::SessionOptions::create_default(), - &result); + std::move(config.value()), + zenoh::Session::SessionOptions::create_default(), + &result); if(result != Z_OK) { std::cout << "Error opening Session!" << "\\n"; return 1;