Skip to content

Commit

Permalink
Update core-foundation-sys version
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 10, 2024
1 parent 078c819 commit 2e78bd2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ windows = { version = ">=0.54, <=0.57", optional = true }
libc = "^0.2.153"

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
core-foundation-sys = "0.8"
core-foundation-sys = "0.8.7"

[target.'cfg(all(target_os = "linux", not(target_os = "android")))'.dev-dependencies]
tempfile = "3.9"
Expand Down
3 changes: 2 additions & 1 deletion src/unix/apple/macos/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub(crate) unsafe fn get_cpu_frequency() -> u64 {
use crate::sys::ffi;
use crate::sys::macos::utils::IOReleaser;
use crate::sys::utils::CFReleaser;
use core_foundation_sys::string::CFStringCreateWithCStringNoCopy;

let matching = ffi::IOServiceMatching(b"AppleARMIODevice\0".as_ptr() as *const _);
if matching.is_null() {
Expand Down Expand Up @@ -54,7 +55,7 @@ pub(crate) unsafe fn get_cpu_frequency() -> u64 {
}
};

let node_name = match CFReleaser::new(ffi::CFStringCreateWithCStringNoCopy(
let node_name = match CFReleaser::new(CFStringCreateWithCStringNoCopy(
std::ptr::null(),
b"voltage-states5-sram\0".as_ptr() as *const _,
core_foundation_sys::string::kCFStringEncodingUTF8,
Expand Down
16 changes: 3 additions & 13 deletions src/unix/apple/macos/ffi.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

#[cfg(any(feature = "system", feature = "disk"))]
use core_foundation_sys::base::CFAllocatorRef;
#[cfg(any(
feature = "system",
Expand All @@ -15,6 +16,7 @@ use core_foundation_sys::dictionary::CFDictionaryRef;
all(feature = "component", any(target_arch = "x86", target_arch = "x86_64")),
))]
use core_foundation_sys::dictionary::CFMutableDictionaryRef;
#[cfg(any(feature = "system", feature = "disk"))]
use core_foundation_sys::string::CFStringRef;

use libc::c_char;
Expand Down Expand Up @@ -144,17 +146,6 @@ extern "C" {
))]
pub const KIO_RETURN_SUCCESS: i32 = 0;

extern "C" {
// FIXME: to be removed once higher version than core_foundation_sys 0.8.4 is released.
#[allow(dead_code)]
pub fn CFStringCreateWithCStringNoCopy(
alloc: CFAllocatorRef,
cStr: *const c_char,
encoding: core_foundation_sys::string::CFStringEncoding,
contentsDeallocator: CFAllocatorRef,
) -> CFStringRef;
}

#[cfg(all(
not(feature = "apple-sandbox"),
all(
Expand Down Expand Up @@ -262,15 +253,14 @@ pub use io_service::*;
mod io_service {
use std::ptr::null;

use super::CFStringCreateWithCStringNoCopy;
use core_foundation_sys::array::CFArrayRef;
use core_foundation_sys::base::{CFAllocatorRef, CFRelease};
use core_foundation_sys::dictionary::{
kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks, CFDictionaryCreate,
CFDictionaryRef,
};
use core_foundation_sys::number::{kCFNumberSInt32Type, CFNumberCreate};
use core_foundation_sys::string::CFStringRef;
use core_foundation_sys::string::{CFStringCreateWithCStringNoCopy, CFStringRef};

#[repr(C)]
pub struct __IOHIDServiceClient(libc::c_void);
Expand Down

0 comments on commit 2e78bd2

Please sign in to comment.