Use Vec to store dc_array_t data

This commit is contained in:
Alexander Krotov
2019-07-22 03:30:31 +03:00
parent 252697b174
commit e15e3a1e84
2 changed files with 64 additions and 122 deletions

View File

@@ -2168,11 +2168,8 @@ pub unsafe fn dc_chat_get_profile_image(chat: *const Chat) -> *mut libc::c_char
image_abs = dc_get_abs_path((*chat).context, image_rel)
} else if (*chat).type_0 == 100i32 {
contacts = dc_get_chat_contacts((*chat).context, (*chat).id);
if (*contacts).count >= 1 {
contact = dc_get_contact(
(*chat).context,
*(*contacts).array.offset(0isize) as uint32_t,
);
if !(*contacts).array.is_empty() {
contact = dc_get_contact((*chat).context, (*contacts).array[0] as uint32_t);
image_abs = dc_contact_get_profile_image(contact)
}
}
@@ -2192,11 +2189,8 @@ pub unsafe fn dc_chat_get_color(chat: *const Chat) -> uint32_t {
if !(chat.is_null() || (*chat).magic != 0xc4a7c4a7u32) {
if (*chat).type_0 == 100i32 {
contacts = dc_get_chat_contacts((*chat).context, (*chat).id);
if (*contacts).count >= 1 {
contact = dc_get_contact(
(*chat).context,
*(*contacts).array.offset(0isize) as uint32_t,
);
if !(*contacts).array.is_empty() {
contact = dc_get_contact((*chat).context, (*contacts).array[0] as uint32_t);
color = dc_str_to_color((*contact).addr) as uint32_t
}
} else {