Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support win x86 #56

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions zeroconf/src/bonjour/browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl fmt::Debug for BonjourBrowserContext {
}
}

unsafe extern "C" fn browse_callback(
unsafe extern "system" fn browse_callback(
_sd_ref: DNSServiceRef,
_flags: DNSServiceFlags,
interface_index: u32,
Expand Down Expand Up @@ -160,7 +160,7 @@ unsafe fn handle_browse(
)
}

unsafe extern "C" fn resolve_callback(
unsafe extern "system" fn resolve_callback(
_sd_ref: DNSServiceRef,
_flags: DNSServiceFlags,
interface_index: u32,
Expand Down Expand Up @@ -224,7 +224,7 @@ unsafe fn handle_resolve(
)
}

unsafe extern "C" fn get_address_info_callback(
unsafe extern "system" fn get_address_info_callback(
_sd_ref: DNSServiceRef,
_flags: DNSServiceFlags,
_interface_index: u32,
Expand Down
2 changes: 1 addition & 1 deletion zeroconf/src/bonjour/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl BonjourServiceContext {
}
}

unsafe extern "C" fn register_callback(
unsafe extern "system" fn register_callback(
_sd_ref: DNSServiceRef,
_flags: DNSServiceFlags,
error: DNSServiceErrorType,
Expand Down
13 changes: 2 additions & 11 deletions zeroconf/src/bonjour/service_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::{bonjour::bonjour_util, Result};
use bonjour_sys::{
DNSServiceBrowse, DNSServiceBrowseReply, DNSServiceFlags, DNSServiceGetAddrInfo,
dnssd_sock_t, DNSServiceBrowse, DNSServiceBrowseReply, DNSServiceFlags, DNSServiceGetAddrInfo,
DNSServiceGetAddrInfoReply, DNSServiceProcessResult, DNSServiceProtocol, DNSServiceRef,
DNSServiceRefDeallocate, DNSServiceRefSockFD, DNSServiceRegister, DNSServiceRegisterReply,
DNSServiceResolve, DNSServiceResolveReply,
Expand Down Expand Up @@ -177,16 +177,7 @@ impl ManagedDNSServiceRef {
/// Delegate function for [`DNSServiceRefSockFD`].
///
/// [`DNSServiceRefSockFD`]: https://developer.apple.com/documentation/dnssd/1804698-dnsservicerefsockfd?language=objc
#[cfg(target_vendor = "apple")]
pub fn sock_fd(&self) -> i32 {
unsafe { DNSServiceRefSockFD(self.0) }
}

/// Delegate function for [`DNSServiceRefSockFD`].
///
/// [`DNSServiceRefSockFD`]: https://developer.apple.com/documentation/dnssd/1804698-dnsservicerefsockfd?language=objc
#[cfg(target_vendor = "pc")]
pub fn sock_fd(&self) -> u64 {
pub fn sock_fd(&self) -> dnssd_sock_t {
unsafe { DNSServiceRefSockFD(self.0) }
}
}
Expand Down
4 changes: 2 additions & 2 deletions zeroconf/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub(crate) mod bonjour {
#[cfg(target_vendor = "pc")]
pub(crate) mod bonjour {
use crate::Result;
use bonjour_sys::{fd_set, select, timeval};
use bonjour_sys::{dnssd_sock_t, fd_set, select, timeval};
#[cfg(target_vendor = "apple")]
use std::mem;
use std::ptr;
Expand All @@ -115,7 +115,7 @@ pub(crate) mod bonjour {
///
/// # Safety
/// This function is unsafe because it directly interfaces with C-library system calls.
pub unsafe fn read_select(sock_fd: u64, timeout: Duration) -> Result<u32> {
pub unsafe fn read_select(sock_fd: dnssd_sock_t, timeout: Duration) -> Result<u32> {
if timeout.as_secs() > i32::MAX as u64 {
return Err(
"Invalid timeout duration, as_secs() value exceeds ::libc::c_long. ".into(),
Expand Down
Loading