Skip to content

Commit 072c3e4

Browse files
Fix casting on DragonFly
1 parent 1f39b65 commit 072c3e4

File tree

1 file changed

+6
-4
lines changed
  • src/unix/bsd/freebsdlike/dragonfly

1 file changed

+6
-4
lines changed

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pub type sem_t = *mut sem;
1919

2020
pub enum sem {}
2121

22+
use dox::mem;
23+
2224
s! {
2325

2426
pub struct exit_status {
@@ -799,25 +801,25 @@ f! {
799801
}
800802

801803
pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
802-
_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize
804+
(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize) as u32
803805
}
804806

805807
pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
806808
-> *mut ::cmsghdr
807809
{
808-
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)
810+
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
809811
+ _CMSG_ALIGN(mem::size_of::<::cmsghdr>());
810812
let max = (*mhdr).msg_control as usize
811813
+ (*mhdr).msg_controllen as usize;
812814
if next <= max {
813-
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)) as *mut ::cmsghdr
815+
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut ::cmsghdr
814816
} else {
815817
0 as *mut ::cmsghdr
816818
}
817819
}
818820

819821
pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
820-
_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)
822+
(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)) as u32
821823
}
822824
}
823825

0 commit comments

Comments
 (0)