Use core::ffi over std::os::raw and libc::c_* (#692)
`core::ffi` is the preferred way to access these type definitions. Begin removing uses of the versions from `libc`. `libc::c_void` is not exactly the same as `core::ffi::c_void` but some code has tried using them interchangeably (like in io-surface). `libc::size_t` is `usize` on all current platforms.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFComparatorFunction, CFIndex, CFRange, CFTypeID};
|
||||
use crate::string::CFStringRef;
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, CFTypeRef
|
||||
use crate::dictionary::CFDictionaryRef;
|
||||
use crate::string::CFMutableStringRef;
|
||||
use crate::string::CFStringRef;
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CFAttributedString(c_void);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID};
|
||||
use crate::string::CFStringRef;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
// except according to those terms.
|
||||
|
||||
use crate::string::CFStringRef;
|
||||
use core::ffi::{c_int, c_short, c_uchar, c_uint, c_ushort, c_void};
|
||||
use std::cmp::Ordering;
|
||||
use std::os::raw::{c_int, c_short, c_uchar, c_uint, c_ushort, c_void};
|
||||
|
||||
pub type Boolean = u8;
|
||||
pub type mach_port_t = c_uint;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID};
|
||||
use crate::string::CFStringRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UInt32, UInt8};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::array::CFArrayRef;
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -17,7 +17,7 @@ use crate::dictionary::CFDictionaryRef;
|
||||
use crate::error::CFErrorRef;
|
||||
use crate::string::CFStringRef;
|
||||
use crate::url::CFURLRef;
|
||||
use std::os::raw::{c_int, c_uint};
|
||||
use core::ffi::{c_int, c_uint};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CFBundle(c_void);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use core::ffi::{c_char, c_void};
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID};
|
||||
use crate::date::{CFAbsoluteTime, CFTimeInterval};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UTF32Char};
|
||||
use crate::data::CFDataRef;
|
||||
use crate::string::{CFStringRef, UniChar};
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
pub type CFCharacterSetPredefinedSet = CFIndex;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID};
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CFData(c_void);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{CFAllocatorRef, CFComparisonResult, CFTypeID};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef};
|
||||
use crate::date::{CFAbsoluteTime, CFDateRef};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID};
|
||||
use crate::string::CFStringRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{CFAllocatorRef, CFIndex, CFTypeID};
|
||||
use crate::dictionary::CFDictionaryRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
#[cfg(feature = "mac_os_10_8_features")]
|
||||
use crate::base::CFOptionFlags;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::{c_int, c_void};
|
||||
use core::ffi::{c_int, c_void};
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID};
|
||||
use crate::runloop::CFRunLoopSourceRef;
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::base::{CFAllocatorRef, CFIndex, CFTypeID, CFTypeRef, LangCode, Region
|
||||
use crate::dictionary::CFDictionaryRef;
|
||||
use crate::notification_center::CFNotificationName;
|
||||
use crate::string::CFStringRef;
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CFLocale(c_void);
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::base::{mach_port_t, Boolean};
|
||||
pub use crate::base::{CFAllocatorRef, CFIndex, CFTypeID};
|
||||
use crate::runloop::CFRunLoopSourceRef;
|
||||
use crate::string::CFStringRef;
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CFMachPort(c_void);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID, SInt32};
|
||||
use crate::data::CFDataRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFIndex, CFOptionFlags, CFTypeID};
|
||||
use crate::dictionary::CFDictionaryRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::{c_double, c_void};
|
||||
use core::ffi::{c_double, c_void};
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef};
|
||||
use crate::locale::CFLocaleRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::array::CFArrayRef;
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::array::CFArrayRef;
|
||||
use crate::base::{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID};
|
||||
use crate::string::CFStringRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, SInt32, UInt16};
|
||||
use crate::data::CFDataRef;
|
||||
@@ -31,9 +31,9 @@ pub type CFSocketCallBack = extern "C" fn(
|
||||
info: *mut c_void,
|
||||
);
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub type CFSocketNativeHandle = std::os::raw::c_int;
|
||||
pub type CFSocketNativeHandle = core::ffi::c_int;
|
||||
#[cfg(target_os = "windows")]
|
||||
pub type CFSocketNativeHandle = std::os::raw::c_ulong;
|
||||
pub type CFSocketNativeHandle = core::ffi::c_ulong;
|
||||
|
||||
pub const kCFSocketSuccess: CFSocketError = 0;
|
||||
pub const kCFSocketError: CFSocketError = -1;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::{c_int, c_void};
|
||||
use core::ffi::{c_int, c_void};
|
||||
|
||||
use crate::base::{
|
||||
Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, CFTypeRef, SInt32, UInt32, UInt8,
|
||||
|
||||
@@ -16,7 +16,7 @@ use crate::characterset::CFCharacterSetRef;
|
||||
use crate::data::CFDataRef;
|
||||
use crate::dictionary::CFDictionaryRef;
|
||||
use crate::locale::CFLocaleRef;
|
||||
use std::os::raw::{c_char, c_double, c_ulong, c_ushort, c_void};
|
||||
use core::ffi::{c_char, c_double, c_ulong, c_ushort, c_void};
|
||||
|
||||
pub type CFStringCompareFlags = CFOptionFlags;
|
||||
pub const kCFCompareCaseInsensitive: CFStringCompareFlags = 1;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::array::CFMutableArrayRef;
|
||||
use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::array::CFArrayRef;
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{CFAllocatorRef, CFComparatorFunction, CFIndex, CFTypeID};
|
||||
use crate::string::CFStringRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::array::CFArrayRef;
|
||||
use crate::base::{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::array::CFArrayRef;
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, SInt32};
|
||||
use crate::date::CFTimeInterval;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{CFAllocatorRef, CFTypeID};
|
||||
use crate::string::CFStringRef;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use core::ffi::{c_char, c_void};
|
||||
|
||||
use crate::array::CFArrayRef;
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID};
|
||||
use crate::data::CFDataRef;
|
||||
|
||||
Reference in New Issue
Block a user