Skip to content

Commit

Permalink
Fix Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Sep 29, 2023
1 parent 81a3672 commit c621b65
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 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,7 @@ 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 +200,7 @@ 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 +223,7 @@ 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(0usize)
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

0 comments on commit c621b65

Please sign in to comment.