Skip to content

Commit c32c80c

Browse files
Fix casting on DragonFly
1 parent 9a9e2e0 commit c32c80c

File tree

1 file changed

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

1 file changed

+8
-6
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -804,26 +804,28 @@ f! {
804804
}
805805

806806
pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
807-
_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize
807+
(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize) as u32
808808
}
809809

810810
pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
811811
-> *mut ::cmsghdr
812812
{
813-
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)
814-
+ _CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
813+
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
814+
+ _CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
815815
let max = (*mhdr).msg_control as usize
816816
+ (*mhdr).msg_controllen as usize;
817817
if next <= max {
818-
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)) as *mut ::cmsghdr
818+
(
819+
cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
820+
) as *mut ::cmsghdr
819821
} else {
820822
0 as *mut ::cmsghdr
821823
}
822824
}
823825

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

0 commit comments

Comments
 (0)