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 Windows build #2

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Changes from all commits
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
13 changes: 10 additions & 3 deletions zenoh-plugin-ros2dds/src/dds_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ impl DDSRawSample {

fn data_as_slice(&self) -> &[u8] {
unsafe {
slice::from_raw_parts(self.data.iov_base as *const u8, self.data.iov_len as usize)
slice::from_raw_parts(
self.data.iov_base as *const u8,
self.data.iov_len.try_into().unwrap(),
)
}
}

Expand All @@ -200,7 +203,10 @@ impl DDSRawSample {
return iox_chunk.as_slice();
}
}
&slice::from_raw_parts(self.data.iov_base as *const u8, self.data.iov_len as usize)[4..]
&slice::from_raw_parts(
self.data.iov_base as *const u8,
self.data.iov_len.try_into().unwrap(),
)[4..]
}
}

Expand All @@ -223,7 +229,8 @@ impl DDSRawSample {
pub fn len(&self) -> usize {
#[cfg(feature = "dds_shm")]
{
self.data.iov_len + self.iox_chunk.as_ref().map(IoxChunk::len).unwrap_or(0)
TryInto::<usize>::try_into(self.data.iov_len).unwrap()
+ self.iox_chunk.as_ref().map(IoxChunk::len).unwrap_or(0)
}

#[cfg(not(feature = "dds_shm"))]
Expand Down
Loading