Skip to content

Commit 2c33181

Browse files
Fix casting on DragonFly
1 parent 70937c8 commit 2c33181

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
@@ -25,6 +25,8 @@ impl ::dox::Clone for sem {
2525
fn clone(&self) -> sem { *self }
2626
}
2727

28+
use dox::mem;
29+
2830
s! {
2931

3032
pub struct exit_status {
@@ -805,25 +807,25 @@ f! {
805807
}
806808

807809
pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
808-
_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize
810+
(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize) as u32
809811
}
810812

811813
pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
812814
-> *mut ::cmsghdr
813815
{
814-
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)
816+
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
815817
+ _CMSG_ALIGN(mem::size_of::<::cmsghdr>());
816818
let max = (*mhdr).msg_control as usize
817819
+ (*mhdr).msg_controllen as usize;
818820
if next <= max {
819-
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)) as *mut ::cmsghdr
821+
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut ::cmsghdr
820822
} else {
821823
0 as *mut ::cmsghdr
822824
}
823825
}
824826

825827
pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
826-
_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)
828+
(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)) as u32
827829
}
828830
}
829831

0 commit comments

Comments
 (0)