diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 0e5c1bd56..a81b5151b 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -372,14 +372,10 @@ void dc_delete_all_locations (dc_context_t*); */ void dc_array_unref (dc_array_t*); -void dc_array_add_uint (dc_array_t*, uintptr_t); void dc_array_add_id (dc_array_t*, uint32_t); -void dc_array_add_ptr (dc_array_t*, void*); size_t dc_array_get_cnt (const dc_array_t*); -uintptr_t dc_array_get_uint (const dc_array_t*, size_t index); uint32_t dc_array_get_id (const dc_array_t*, size_t index); -void* dc_array_get_ptr (const dc_array_t*, size_t index); double dc_array_get_latitude (const dc_array_t*, size_t index); double dc_array_get_longitude (const dc_array_t*, size_t index); double dc_array_get_accuracy (const dc_array_t*, size_t index); diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 823e2a6be..9c73a63f1 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -1064,24 +1064,12 @@ pub unsafe extern "C" fn dc_array_unref(a: *mut dc_array::dc_array_t) { dc_array::dc_array_unref(a) } -#[no_mangle] -pub unsafe extern "C" fn dc_array_add_uint(array: *mut dc_array_t, item: libc::uintptr_t) { - assert!(!array.is_null()); - - dc_array::dc_array_add_uint(array, item) -} #[no_mangle] pub unsafe extern "C" fn dc_array_add_id(array: *mut dc_array_t, item: libc::c_uint) { assert!(!array.is_null()); dc_array::dc_array_add_id(array, item) } -#[no_mangle] -pub unsafe extern "C" fn dc_array_add_ptr(array: *mut dc_array_t, item: *mut libc::c_void) { - assert!(!array.is_null()); - - dc_array::dc_array_add_ptr(array, item) -} #[no_mangle] pub unsafe extern "C" fn dc_array_get_cnt(array: *const dc_array_t) -> libc::size_t { @@ -1090,15 +1078,6 @@ pub unsafe extern "C" fn dc_array_get_cnt(array: *const dc_array_t) -> libc::siz dc_array::dc_array_get_cnt(array) } #[no_mangle] -pub unsafe extern "C" fn dc_array_get_uint( - array: *const dc_array_t, - index: libc::size_t, -) -> libc::uintptr_t { - assert!(!array.is_null()); - - dc_array::dc_array_get_uint(array, index) -} -#[no_mangle] pub unsafe extern "C" fn dc_array_get_id( array: *const dc_array_t, index: libc::size_t, @@ -1108,15 +1087,6 @@ pub unsafe extern "C" fn dc_array_get_id( dc_array::dc_array_get_id(array, index) } #[no_mangle] -pub unsafe extern "C" fn dc_array_get_ptr( - array: *const dc_array_t, - index: libc::size_t, -) -> *mut libc::c_void { - assert!(!array.is_null()); - - dc_array::dc_array_get_ptr(array, index) -} -#[no_mangle] pub unsafe extern "C" fn dc_array_get_latitude( array: *const dc_array_t, index: libc::size_t, diff --git a/src/dc_array.rs b/src/dc_array.rs index 92cb5bb5f..ad2909e3e 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -24,16 +24,12 @@ impl dc_array_t { Box::into_raw(Box::new(self)) } - pub fn add_uint(&mut self, item: uintptr_t) { - if let Self::Uint(array) = self { - array.push(item); - } else { - panic!("Attempt to add uint to array of other type"); - } - } - pub fn add_id(&mut self, item: uint32_t) { - self.add_uint(item as uintptr_t); + if let Self::Uint(array) = self { + array.push(item as uintptr_t); + } else { + panic!("Attempt to add id to array of other type"); + } } pub fn add_location(&mut self, location: dc_location) { @@ -44,14 +40,6 @@ impl dc_array_t { } } - pub fn get_uint(&self, index: usize) -> uintptr_t { - if let Self::Uint(array) = self { - array[index] - } else { - panic!("Attempt to get uint from array of other type"); - } - } - pub fn get_id(&self, index: usize) -> uint32_t { match self { Self::Locations(array) => array[index].location_id, @@ -59,14 +47,6 @@ impl dc_array_t { } } - pub fn get_ptr(&self, index: size_t) -> *mut libc::c_void { - if let Self::Uint(array) = self { - array[index] as *mut libc::c_void - } else { - panic!("Not an array of pointers"); - } - } - pub fn get_location(&self, index: usize) -> &dc_location { if let Self::Locations(array) = self { &array[index] @@ -164,40 +144,21 @@ pub unsafe fn dc_array_unref(array: *mut dc_array_t) { Box::from_raw(array); } -pub unsafe fn dc_array_add_uint(array: *mut dc_array_t, item: uintptr_t) { - assert!(!array.is_null()); - (*array).add_uint(item); -} - pub unsafe fn dc_array_add_id(array: *mut dc_array_t, item: uint32_t) { assert!(!array.is_null()); (*array).add_id(item); } -pub unsafe fn dc_array_add_ptr(array: *mut dc_array_t, item: *mut libc::c_void) { - dc_array_add_uint(array, item as uintptr_t); -} - pub unsafe fn dc_array_get_cnt(array: *const dc_array_t) -> size_t { assert!(!array.is_null()); (*array).len() } -pub unsafe fn dc_array_get_uint(array: *const dc_array_t, index: size_t) -> uintptr_t { - assert!(!array.is_null()); - (*array).get_uint(index) -} - pub unsafe fn dc_array_get_id(array: *const dc_array_t, index: size_t) -> uint32_t { assert!(!array.is_null()); (*array).get_id(index) } -pub unsafe fn dc_array_get_ptr(array: *const dc_array_t, index: size_t) -> *mut libc::c_void { - assert!(!array.is_null()); - (*array).get_ptr(index) -} - pub unsafe fn dc_array_get_latitude(array: *const dc_array_t, index: size_t) -> libc::c_double { assert!(!array.is_null()); (*array).get_latitude(index)