diff --git a/Cargo.lock b/Cargo.lock index a23b871..5d9ea8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -304,7 +304,6 @@ dependencies = [ name = "loot-condition-interpreter-ffi" version = "5.3.3" dependencies = [ - "libc", "loot-condition-interpreter", ] diff --git a/ffi/Cargo.toml b/ffi/Cargo.toml index f97d201..a21f3a7 100644 --- a/ffi/Cargo.toml +++ b/ffi/Cargo.toml @@ -8,7 +8,6 @@ edition.workspace = true [dependencies] loot-condition-interpreter = { path = ".." } -libc = "0.2" [lib] name = "loot_condition_interpreter_ffi" diff --git a/ffi/src/helpers.rs b/ffi/src/helpers.rs index 0cb5c34..1f66f19 100644 --- a/ffi/src/helpers.rs +++ b/ffi/src/helpers.rs @@ -2,7 +2,6 @@ use std::ffi::{c_char, c_int, CStr, CString}; use std::path::PathBuf; use std::slice; -use libc::size_t; use loot_condition_interpreter::{Error, GameType}; use super::ERROR_MESSAGE; @@ -68,7 +67,7 @@ pub(crate) unsafe fn to_str<'a>(c_string: *const c_char) -> Result<&'a str, c_in pub(crate) unsafe fn to_vec( array: *const U, - array_size: size_t, + array_size: usize, mapper: F, ) -> Result, c_int> where @@ -86,14 +85,14 @@ where pub(crate) unsafe fn to_str_vec<'a>( array: *const *const c_char, - array_size: size_t, + array_size: usize, ) -> Result, c_int> { to_vec(array, array_size, |c| to_str(*c)) } pub(crate) unsafe fn to_path_buf_vec( array: *const *const c_char, - array_size: size_t, + array_size: usize, ) -> Result, c_int> { to_vec(array, array_size, |c| to_str(*c).map(PathBuf::from)) } @@ -105,14 +104,14 @@ unsafe fn map_plugin_version(c_object: &plugin_version) -> Result<(String, Strin pub(crate) unsafe fn map_plugin_versions( plugin_versions: *const plugin_version, - num_plugins: size_t, + num_plugins: usize, ) -> Result, c_int> { to_vec(plugin_versions, num_plugins, |v| map_plugin_version(v)) } pub(crate) unsafe fn map_plugin_crcs( plugin_crcs: *const plugin_crc, - num_entries: size_t, + num_entries: usize, ) -> Result, c_int> { to_vec(plugin_crcs, num_entries, |v| { to_str(v.plugin_name).map(|s| (s.into(), v.crc)) diff --git a/ffi/src/state.rs b/ffi/src/state.rs index 2e102f7..a062f87 100644 --- a/ffi/src/state.rs +++ b/ffi/src/state.rs @@ -3,7 +3,6 @@ use std::panic::catch_unwind; use std::path::PathBuf; use std::sync::RwLock; -use libc::size_t; use loot_condition_interpreter::State; use crate::constants::{ @@ -74,7 +73,7 @@ pub unsafe extern "C" fn lci_state_destroy(state: *mut lci_state) { pub unsafe extern "C" fn lci_state_set_active_plugins( state: *mut lci_state, plugin_names: *const *const c_char, - num_plugins: size_t, + num_plugins: usize, ) -> c_int { catch_unwind(|| { if state.is_null() { @@ -112,7 +111,7 @@ pub unsafe extern "C" fn lci_state_set_active_plugins( pub unsafe extern "C" fn lci_state_set_plugin_versions( state: *mut lci_state, plugin_versions: *const plugin_version, - num_plugins: size_t, + num_plugins: usize, ) -> c_int { catch_unwind(|| { if state.is_null() { @@ -150,7 +149,7 @@ pub unsafe extern "C" fn lci_state_set_plugin_versions( pub unsafe extern "C" fn lci_state_set_crc_cache( state: *mut lci_state, entries: *const plugin_crc, - num_entries: size_t, + num_entries: usize, ) -> c_int { catch_unwind(|| { if state.is_null() { @@ -213,7 +212,7 @@ pub unsafe extern "C" fn lci_state_clear_condition_cache(state: *mut lci_state) pub unsafe extern "C" fn lci_state_set_additional_data_paths( state: *mut lci_state, paths: *const *const c_char, - num_paths: size_t, + num_paths: usize, ) -> c_int { catch_unwind(|| { if state.is_null() || (paths.is_null() && num_paths != 0) {