Fix FFI for EffectParameters to return IdentifiablePointers
This commit is contained in:
parent
aae41b93bb
commit
df47976d97
|
@ -1,4 +1,4 @@
|
||||||
use crate::ffi::{ExternPointer, OwnedPtr};
|
use crate::ffi::{ExternPointer, IdentifiablePointer, OwnedPtr};
|
||||||
use crate::static_data::EffectParameter;
|
use crate::static_data::EffectParameter;
|
||||||
use crate::StringKey;
|
use crate::StringKey;
|
||||||
use std::ffi::{c_char, CStr, CString};
|
use std::ffi::{c_char, CStr, CString};
|
||||||
|
@ -27,27 +27,27 @@ mod statistic_set;
|
||||||
|
|
||||||
/// Instantiates an effect parameter with a boolean.
|
/// Instantiates an effect parameter with a boolean.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn effect_parameter_new_bool(value: u8) -> OwnedPtr<EffectParameter> {
|
extern "C" fn effect_parameter_new_bool(value: u8) -> IdentifiablePointer<EffectParameter> {
|
||||||
Box::into_raw(Box::new((value == 1).into()))
|
Box::<EffectParameter>::new((value == 1).into()).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiates an effect parameter with an integer.
|
/// Instantiates an effect parameter with an integer.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn effect_parameter_new_int(value: i64) -> OwnedPtr<EffectParameter> {
|
extern "C" fn effect_parameter_new_int(value: i64) -> IdentifiablePointer<EffectParameter> {
|
||||||
Box::into_raw(Box::new(value.into()))
|
Box::<EffectParameter>::new(value.into()).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiates an effect parameter with a float.
|
/// Instantiates an effect parameter with a float.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn effect_parameter_new_float(value: f32) -> OwnedPtr<EffectParameter> {
|
extern "C" fn effect_parameter_new_float(value: f32) -> IdentifiablePointer<EffectParameter> {
|
||||||
Box::into_raw(Box::new(value.into()))
|
Box::<EffectParameter>::new(value.into()).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiates an effect parameter with a string.
|
/// Instantiates an effect parameter with a string.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
unsafe extern "C" fn effect_parameter_new_string(value: *const c_char) -> OwnedPtr<EffectParameter> {
|
unsafe extern "C" fn effect_parameter_new_string(value: *const c_char) -> IdentifiablePointer<EffectParameter> {
|
||||||
let sk: StringKey = CStr::from_ptr(value).to_str().unwrap().into();
|
let sk: StringKey = CStr::from_ptr(value).to_str().unwrap().into();
|
||||||
Box::into_raw(Box::new(sk.into()))
|
Box::<EffectParameter>::new(sk.into()).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Drop an effect parameter.
|
/// Drop an effect parameter.
|
||||||
|
|
Loading…
Reference in New Issue