mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Separate headers into cpp source files
This commit is contained in:
@@ -315,3 +315,18 @@ pub unsafe extern "C" fn idevice_string_free(string: *mut c_char) {
|
||||
let _ = unsafe { CString::from_raw(string) };
|
||||
}
|
||||
}
|
||||
|
||||
/// Frees data allocated by this library
|
||||
///
|
||||
/// # Arguments
|
||||
/// * [`data`] - The data to free
|
||||
///
|
||||
/// # Safety
|
||||
/// `data` must be a valid pointer to data that was allocated by this library,
|
||||
/// or NULL (in which case this function does nothing)
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn idevice_data_free(data: *mut u8, len: usize) {
|
||||
if !data.is_null() {
|
||||
let _ = unsafe { std::slice::from_raw_parts(data, len) };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::{
|
||||
|
||||
pub struct LockdowndClientHandle(pub LockdownClient);
|
||||
|
||||
/// Connects to lockdownd service using TCP provider
|
||||
/// Connects to lockdownd service using provider
|
||||
///
|
||||
/// # Arguments
|
||||
/// * [`provider`] - An IdeviceProvider
|
||||
|
||||
@@ -428,6 +428,26 @@ pub unsafe extern "C" fn idevice_usbmuxd_unix_addr_new(
|
||||
null_mut()
|
||||
}
|
||||
|
||||
/// Creates a default UsbmuxdAddr struct for the platform
|
||||
///
|
||||
/// # Arguments
|
||||
/// * [`usbmuxd_addr`] - On success, will be set to point to a newly allocated UsbmuxdAddr handle
|
||||
///
|
||||
/// # Returns
|
||||
/// An IdeviceFfiError on error, null on success
|
||||
///
|
||||
/// # Safety
|
||||
/// `usbmuxd_addr` must be a valid, non-null pointer to a location where the handle will be stored
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn idevice_usbmuxd_default_addr_new(
|
||||
usbmuxd_addr: *mut *mut UsbmuxdAddrHandle,
|
||||
) -> *mut IdeviceFfiError {
|
||||
let addr = UsbmuxdAddr::default();
|
||||
let boxed = Box::new(UsbmuxdAddrHandle(addr));
|
||||
unsafe { *usbmuxd_addr = Box::into_raw(boxed) };
|
||||
null_mut()
|
||||
}
|
||||
|
||||
/// Frees a UsbmuxdAddr handle
|
||||
///
|
||||
/// # Arguments
|
||||
|
||||
Reference in New Issue
Block a user