From 81a3672751b274d0e7eedad1a702522fb0e66898 Mon Sep 17 00:00:00 2001 From: Julien Enoch Date: Fri, 29 Sep 2023 17:55:45 +0200 Subject: [PATCH 1/3] Fix Windows build --- zenoh-plugin-ros2dds/src/dds_discovery.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenoh-plugin-ros2dds/src/dds_discovery.rs b/zenoh-plugin-ros2dds/src/dds_discovery.rs index b37fef8..9077b9d 100644 --- a/zenoh-plugin-ros2dds/src/dds_discovery.rs +++ b/zenoh-plugin-ros2dds/src/dds_discovery.rs @@ -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(0) + self.data.iov_len + self.iox_chunk.as_ref().map(IoxChunk::len).unwrap_or(0usize) } #[cfg(not(feature = "dds_shm"))] From c621b6575a20bc72ddad990a4462d310d3df7f5d Mon Sep 17 00:00:00 2001 From: Julien Enoch Date: Fri, 29 Sep 2023 18:17:01 +0200 Subject: [PATCH 2/3] Fix Windows build --- zenoh-plugin-ros2dds/src/dds_discovery.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zenoh-plugin-ros2dds/src/dds_discovery.rs b/zenoh-plugin-ros2dds/src/dds_discovery.rs index 9077b9d..40a7a2b 100644 --- a/zenoh-plugin-ros2dds/src/dds_discovery.rs +++ b/zenoh-plugin-ros2dds/src/dds_discovery.rs @@ -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()) } } @@ -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..] } } @@ -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::::try_into(self.data.iov_len).unwrap() + self.iox_chunk.as_ref().map(IoxChunk::len).unwrap_or(0) } #[cfg(not(feature = "dds_shm"))] From 36b364fa79f77b08b0c88cec94d47faa21483fdf Mon Sep 17 00:00:00 2001 From: Julien Enoch Date: Fri, 29 Sep 2023 18:17:59 +0200 Subject: [PATCH 3/3] Fix Windows build --- zenoh-plugin-ros2dds/src/dds_discovery.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/zenoh-plugin-ros2dds/src/dds_discovery.rs b/zenoh-plugin-ros2dds/src/dds_discovery.rs index 40a7a2b..19abd76 100644 --- a/zenoh-plugin-ros2dds/src/dds_discovery.rs +++ b/zenoh-plugin-ros2dds/src/dds_discovery.rs @@ -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.try_into().unwrap()) + slice::from_raw_parts( + self.data.iov_base as *const u8, + self.data.iov_len.try_into().unwrap(), + ) } } @@ -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.try_into().unwrap())[4..] + &slice::from_raw_parts( + self.data.iov_base as *const u8, + self.data.iov_len.try_into().unwrap(), + )[4..] } } @@ -223,7 +229,8 @@ impl DDSRawSample { pub fn len(&self) -> usize { #[cfg(feature = "dds_shm")] { - TryInto::::try_into(self.data.iov_len).unwrap() + self.iox_chunk.as_ref().map(IoxChunk::len).unwrap_or(0) + TryInto::::try_into(self.data.iov_len).unwrap() + + self.iox_chunk.as_ref().map(IoxChunk::len).unwrap_or(0) } #[cfg(not(feature = "dds_shm"))]