diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index a81b5151b..0ea484088 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -387,7 +387,7 @@ char* dc_array_get_marker (const dc_array_t*, size_t index); int dc_array_is_independent (const dc_array_t*, size_t index); int dc_array_search_id (const dc_array_t*, uint32_t needle, size_t* indx); -const uintptr_t* dc_array_get_raw (const dc_array_t*); +const uint32_t* dc_array_get_raw (const dc_array_t*); /** diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 9c73a63f1..d91a2ea24 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -1171,7 +1171,7 @@ pub unsafe extern "C" fn dc_array_search_id( } #[no_mangle] -pub unsafe extern "C" fn dc_array_get_raw(array: *const dc_array_t) -> *const libc::size_t { +pub unsafe extern "C" fn dc_array_get_raw(array: *const dc_array_t) -> *const u32 { assert!(!array.is_null()); dc_array::dc_array_get_raw(array) diff --git a/src/dc_array.rs b/src/dc_array.rs index ad2909e3e..4faa2c14e 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -7,7 +7,7 @@ use crate::types::*; #[allow(non_camel_case_types)] pub enum dc_array_t { Locations(Vec), - Uint(Vec), + Uint(Vec), } impl dc_array_t { @@ -26,7 +26,7 @@ impl dc_array_t { pub fn add_id(&mut self, item: uint32_t) { if let Self::Uint(array) = self { - array.push(item as uintptr_t); + array.push(item); } else { panic!("Attempt to add id to array of other type"); } @@ -105,7 +105,7 @@ impl dc_array_t { } } - pub fn search_id(&self, needle: uintptr_t) -> Option { + pub fn search_id(&self, needle: u32) -> Option { if let Self::Uint(array) = self { for (i, &u) in array.iter().enumerate() { if u == needle { @@ -129,7 +129,7 @@ impl dc_array_t { impl From> for dc_array_t { fn from(array: Vec) -> Self { - dc_array_t::Uint(array.iter().map(|&x| x as uintptr_t).collect()) + dc_array_t::Uint(array) } } @@ -235,7 +235,7 @@ pub unsafe fn dc_array_search_id( ) -> bool { assert!(!array.is_null()); - if let Some(i) = (*array).search_id(needle as uintptr_t) { + if let Some(i) = (*array).search_id(needle) { if !ret_index.is_null() { *ret_index = i } @@ -245,7 +245,7 @@ pub unsafe fn dc_array_search_id( } } -pub unsafe fn dc_array_get_raw(array: *const dc_array_t) -> *const uintptr_t { +pub unsafe fn dc_array_get_raw(array: *const dc_array_t) -> *const u32 { assert!(!array.is_null()); if let dc_array_t::Uint(v) = &*array {