mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Implement clone for RsdHandshake
This commit is contained in:
@@ -10,6 +10,7 @@ use idevice::rsd::RsdHandshake;
|
||||
use crate::{IdeviceFfiError, RUNTIME, ReadWriteOpaque, ffi_err};
|
||||
|
||||
/// Opaque handle to an RsdHandshake
|
||||
#[derive(Clone)]
|
||||
pub struct RsdHandshakeHandle(pub RsdHandshake);
|
||||
|
||||
/// C-compatible representation of an RSD service
|
||||
@@ -370,6 +371,22 @@ pub unsafe extern "C" fn rsd_get_service_info(
|
||||
null_mut()
|
||||
}
|
||||
|
||||
/// Clones an RSD handshake
|
||||
///
|
||||
/// # Safety
|
||||
/// Pass a valid pointer allocated by this library
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn rsd_handshake_clone(
|
||||
handshake: *mut RsdHandshakeHandle,
|
||||
) -> *mut RsdHandshakeHandle {
|
||||
if handshake.is_null() {
|
||||
return null_mut();
|
||||
}
|
||||
let handshake = unsafe { &mut *handshake };
|
||||
let new_handshake = handshake.clone();
|
||||
Box::into_raw(Box::new(new_handshake))
|
||||
}
|
||||
|
||||
/// Frees a string returned by RSD functions
|
||||
///
|
||||
/// # Arguments
|
||||
|
||||
Reference in New Issue
Block a user