From ad1c243949b4e5e8622d3f1cbe680d96ff5606a9 Mon Sep 17 00:00:00 2001 From: "Zach N." Date: Thu, 25 Jan 2024 14:51:25 -0800 Subject: [PATCH 1/2] Fix functions which didn't have 'unsafe' keyword --- src/dynamic_win_raw.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dynamic_win_raw.rs b/src/dynamic_win_raw.rs index 679bdb26..cd0a26b3 100644 --- a/src/dynamic_win_raw.rs +++ b/src/dynamic_win_raw.rs @@ -316,7 +316,7 @@ pub unsafe fn pcap_get_selectable_fd(arg1: *mut pcap_t) -> c_int { } #[cfg(libpcap_1_2_1)] -pub fn pcap_set_tstamp_type(arg1: *mut pcap_t, arg2: c_int) -> c_int { +pub unsafe fn pcap_set_tstamp_type(arg1: *mut pcap_t, arg2: c_int) -> c_int { let func = LIBRARY .get::(b"pcap_set_tstamp_type\0") .unwrap(); @@ -324,7 +324,7 @@ pub fn pcap_set_tstamp_type(arg1: *mut pcap_t, arg2: c_int) -> c_int { } #[cfg(libpcap_1_5_0)] -pub fn pcap_fopen_offline_with_tstamp_precision( +pub unsafe fn pcap_fopen_offline_with_tstamp_precision( arg1: *mut FILE, arg2: c_uint, arg3: *mut c_char, @@ -335,14 +335,14 @@ pub fn pcap_fopen_offline_with_tstamp_precision( func(arg1, arg2, arg3) } #[cfg(libpcap_1_5_0)] -pub fn pcap_open_dead_with_tstamp_precision(arg1: c_int, arg2: c_int, arg3: c_uint) -> *mut pcap_t { +pub unsafe fn pcap_open_dead_with_tstamp_precision(arg1: c_int, arg2: c_int, arg3: c_uint) -> *mut pcap_t { let func = LIBRARY .get::(b"pcap_open_dead_with_tstamp_precision\0") .unwrap(); func(arg1, arg2, arg3) } #[cfg(libpcap_1_5_0)] -pub fn pcap_open_offline_with_tstamp_precision( +pub unsafe fn pcap_open_offline_with_tstamp_precision( arg1: *const c_char, arg2: c_uint, arg3: *mut c_char, @@ -353,14 +353,14 @@ pub fn pcap_open_offline_with_tstamp_precision( func(arg1, arg2, arg3) } #[cfg(libpcap_1_5_0)] -pub fn pcap_set_immediate_mode(arg1: *mut pcap_t, arg2: c_int) -> c_int { +pub unsafe fn pcap_set_immediate_mode(arg1: *mut pcap_t, arg2: c_int) -> c_int { let func = LIBRARY .get::(b"pcap_set_immediate_mode\0") .unwrap(); func(arg1, arg2) } #[cfg(libpcap_1_5_0)] -pub fn pcap_set_tstamp_precision(arg1: *mut pcap_t, arg2: c_int) -> c_int { +pub unsafe fn pcap_set_tstamp_precision(arg1: *mut pcap_t, arg2: c_int) -> c_int { let func = LIBRARY .get::(b"pcap_set_tstamp_precision\0") .unwrap(); @@ -368,7 +368,7 @@ pub fn pcap_set_tstamp_precision(arg1: *mut pcap_t, arg2: c_int) -> c_int { } #[cfg(libpcap_1_7_2)] -pub fn pcap_dump_open_append(arg1: *mut pcap_t, arg2: *const c_char) -> *mut pcap_dumper_t { +pub unsafe fn pcap_dump_open_append(arg1: *mut pcap_t, arg2: *const c_char) -> *mut pcap_dumper_t { let func = LIBRARY .get::(b"pcap_dump_open_append\0") .unwrap(); From ef62b9c677e152c3e248d636a3ef9f2bc12719b7 Mon Sep 17 00:00:00 2001 From: "Zach N." Date: Thu, 25 Jan 2024 14:56:58 -0800 Subject: [PATCH 2/2] formatting --- src/dynamic_win_raw.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dynamic_win_raw.rs b/src/dynamic_win_raw.rs index cd0a26b3..e676f94c 100644 --- a/src/dynamic_win_raw.rs +++ b/src/dynamic_win_raw.rs @@ -335,7 +335,11 @@ pub unsafe fn pcap_fopen_offline_with_tstamp_precision( func(arg1, arg2, arg3) } #[cfg(libpcap_1_5_0)] -pub unsafe fn pcap_open_dead_with_tstamp_precision(arg1: c_int, arg2: c_int, arg3: c_uint) -> *mut pcap_t { +pub unsafe fn pcap_open_dead_with_tstamp_precision( + arg1: c_int, + arg2: c_int, + arg3: c_uint, +) -> *mut pcap_t { let func = LIBRARY .get::(b"pcap_open_dead_with_tstamp_precision\0") .unwrap();