Skip to content

Commit

Permalink
Fix z_view_string_t to std::string conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Nov 25, 2024
1 parent b485a93 commit 9d57305
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions rmw_zenoh_cpp/src/detail/rmw_service_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ void service_data_handler(z_loaned_query_t * query, void * data)
RMW_ZENOH_LOG_ERROR_NAMED(
"rmw_zenoh_cpp",
"Unable to obtain ServiceData from data for "
"service for %s",
z_loan(keystr)
"service for %.*s",
static_cast<int>(z_string_len(z_loan(keystr))),
z_string_data(z_loan(keystr))
);
return;
}
Expand Down
4 changes: 3 additions & 1 deletion rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ void sub_data_handler(z_loaned_sample_t * sample, void * data)
z_owned_slice_t slice;
z_bytes_to_slice(payload, &slice);

std::string topic_name(z_string_data(z_loan(keystr)), z_string_len(z_loan(keystr)));

sub_data->add_new_message(
std::make_unique<SubscriptionData::Message>(
slice,
z_timestamp_ntp64_time(z_sample_timestamp(sample)),
std::move(attachment)),
z_string_data(z_loan(keystr)));
&topic_name);
}
} // namespace

Expand Down

0 comments on commit 9d57305

Please sign in to comment.