Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix z_view_string_t to std::string conversion #45

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading