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

Update core-foundation-sys version #1379

Merged
merged 1 commit into from
Nov 10, 2024
Merged
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
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