diff --git a/include/zenoh/api/bytes.hxx b/include/zenoh/api/bytes.hxx index 278ac6b..0219fc1 100644 --- a/include/zenoh/api/bytes.hxx +++ b/include/zenoh/api/bytes.hxx @@ -94,7 +94,9 @@ class Bytes : public Owned<::z_owned_bytes_t> { using Dval = std::remove_reference_t; using DroppableType = typename detail::closures::Droppable; auto drop = DroppableType::into_context(std::forward(d)); - ::z_bytes_from_str(interop::as_owned_c_ptr(*this), const_cast(ptr->c_str()), + ::z_bytes_from_buf(interop::as_owned_c_ptr(*this), + reinterpret_cast(ptr->data()), + ptr->size(), detail::closures::_zenoh_drop_with_context, drop); }