Skip to content

Commit

Permalink
Fix build warnings on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmonday committed Jun 1, 2022
1 parent 49768c4 commit c9bb42f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pnet_sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ extern crate libc;

use std::io;
use std::mem;

#[cfg(unix)]
use std::time::Duration;

#[cfg(unix)]
Expand Down
10 changes: 6 additions & 4 deletions pnet_sys/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub mod public {
}

pub fn make_in6_addr(segments: [u16; 8]) -> In6Addr {
let mut val: In6Addr = unsafe { mem::uninitialized() };
unsafe {
let mut val: In6Addr = mem::MaybeUninit::uninit().assume_init();
*val.u.Word_mut() = [
htons(segments[0]),
htons(segments[1]),
Expand All @@ -82,8 +82,9 @@ pub mod public {
htons(segments[6]),
htons(segments[7]),
];

val
}
val
}

pub fn addr_to_sockaddr(addr: SocketAddr, storage: &mut SockAddrStorage) -> SockLen {
Expand Down Expand Up @@ -186,11 +187,12 @@ pub fn ipv4_addr(addr: InAddr) -> u32 {

#[inline(always)]
pub fn mk_inaddr(addr: u32) -> InAddr {
let mut val: InAddr = unsafe { mem::uninitialized() };
unsafe {
let mut val: InAddr = mem::MaybeUninit::uninit().assume_init();
*val.S_un.S_addr_mut() = addr as minwindef::ULONG;

val
}
val
}

pub unsafe fn sendto(
Expand Down

0 comments on commit c9bb42f

Please sign in to comment.