Skip to content

Commit

Permalink
iox-#64 Use 'cast' instead of 'as *const'
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Sep 17, 2023
1 parent 794a1a8 commit 7aaa01d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion iceoryx-sys/src/chunk_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl ChunkHeader {
!chunk_header.is_null(),
"The ChunkHeader ptr should always be non-null when the payload ptr was non-null!"
);
&*(chunk_header as *const Self)
&*(chunk_header.cast::<Self>())
}
}

Expand Down
4 changes: 2 additions & 2 deletions iceoryx-sys/src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<T: ?Sized> RawSample<T> {
#[inline]
pub fn chunk_header(&self) -> &ChunkHeader {
// SAFTEY: `self.as_payload_ptr` returns a non-null ptr
unsafe { ChunkHeader::from_user_payload_unchecked(self.as_payload_ptr() as *const c_void) }
unsafe { ChunkHeader::from_user_payload_unchecked(self.as_payload_ptr().cast::<c_void>()) }
}
}

Expand Down Expand Up @@ -169,7 +169,7 @@ impl<T: ?Sized> RawSampleMut<T> {
#[inline]
pub fn chunk_header(&self) -> &ChunkHeader {
// SAFTEY: `self.as_payload_ptr` returns a non-null ptr
unsafe { ChunkHeader::from_user_payload_unchecked(self.as_payload_ptr() as *const c_void) }
unsafe { ChunkHeader::from_user_payload_unchecked(self.as_payload_ptr().cast::<c_void>()) }
}
}

Expand Down

0 comments on commit 7aaa01d

Please sign in to comment.