Skip to content

Commit

Permalink
use reinterpret_cast + z_bytes_from_buf to preserve length
Browse files Browse the repository at this point in the history
  • Loading branch information
connoranderson committed Dec 19, 2024
1 parent aa9b20d commit 078ca54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/zenoh/api/bytes.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ class Bytes : public Owned<::z_owned_bytes_t> {
using Dval = std::remove_reference_t<D>;
using DroppableType = typename detail::closures::Droppable<Dval>;
auto drop = DroppableType::into_context(std::forward<D>(d));
::z_bytes_from_str(interop::as_owned_c_ptr(*this), const_cast<char*>(ptr->c_str()),
::z_bytes_from_buf(interop::as_owned_c_ptr(*this),
reinterpret_cast<uint8_t*>(ptr->data()),
ptr->size(),
detail::closures::_zenoh_drop_with_context, drop);
}

Expand Down

0 comments on commit 078ca54

Please sign in to comment.