Replace types that use only 0 and 1 with bool (#18) (#58)

* Start replacing int with bool where possible (#18)

* Continue replacing int with bool where possible (#18)

* Continue replacing int with bool where possible (#18)

* Run fmt
This commit is contained in:
Hocuri
2019-05-11 12:07:09 +02:00
committed by Lars-Magnus Skog
parent 7266b64c66
commit 569c924a0c
17 changed files with 196 additions and 208 deletions

View File

@@ -684,7 +684,11 @@ pub unsafe extern "C" fn dc_get_msg<'a>(
#[no_mangle]
pub unsafe extern "C" fn dc_may_be_valid_addr(addr: *mut libc::c_char) -> libc::c_int {
dc_contact::dc_may_be_valid_addr(addr)
if dc_contact::dc_may_be_valid_addr(addr) {
1
} else {
0
}
}
#[no_mangle]
@@ -782,7 +786,11 @@ pub unsafe extern "C" fn dc_delete_contact(
assert!(!context.is_null());
let context = &*context;
dc_contact::dc_delete_contact(context, contact_id)
if dc_contact::dc_delete_contact(context, contact_id) {
1
} else {
0
}
}
#[no_mangle]
@@ -1052,7 +1060,11 @@ pub unsafe extern "C" fn dc_array_search_id(
needle: libc::c_uint,
ret_index: *mut libc::size_t,
) -> libc::c_int {
dc_array::dc_array_search_id(array, needle, ret_index)
if dc_array::dc_array_search_id(array, needle, ret_index) {
1
} else {
0
}
}
#[no_mangle]
pub unsafe extern "C" fn dc_array_get_raw(array: *const dc_array_t) -> *const libc::size_t {
@@ -1289,7 +1301,11 @@ pub unsafe extern "C" fn dc_msg_get_height(msg: *mut dc_msg::dc_msg_t) -> libc::
#[no_mangle]
pub unsafe extern "C" fn dc_msg_get_duration(msg: *mut dc_msg::dc_msg_t) -> libc::c_int {
dc_msg::dc_msg_get_duration(msg)
if dc_msg::dc_msg_get_duration(msg) {
1
} else {
0
}
}
#[no_mangle]
@@ -1320,7 +1336,11 @@ pub unsafe extern "C" fn dc_msg_has_deviating_timestamp(msg: *mut dc_msg::dc_msg
#[no_mangle]
pub unsafe extern "C" fn dc_msg_has_location(msg: *mut dc_msg::dc_msg_t) -> libc::c_int {
dc_msg::dc_msg_has_location(msg)
if dc_msg::dc_msg_has_location(msg) {
1
} else {
0
}
}
#[no_mangle]

View File

@@ -336,7 +336,7 @@ unsafe fn log_msg(context: &dc_context_t, prefix: *const libc::c_char, msg: *mut
} else {
b"\x00" as *const u8 as *const libc::c_char
},
if 0 != dc_msg_has_location(msg) {
if dc_msg_has_location(msg) {
b"\xf0\x9f\x93\x8d\x00" as *const u8 as *const libc::c_char
} else {
b"\x00" as *const u8 as *const libc::c_char
@@ -408,7 +408,7 @@ unsafe fn log_msglist(context: &dc_context_t, msglist: *mut dc_array_t) {
unsafe fn log_contactlist(context: &dc_context_t, contacts: *mut dc_array_t) {
let mut contact: *mut dc_contact_t;
let peerstate: *mut dc_apeerstate_t = dc_apeerstate_new(context);
if 0 == dc_array_search_id(contacts, 1i32 as uint32_t, 0 as *mut size_t) {
if !dc_array_search_id(contacts, 1i32 as uint32_t, 0 as *mut size_t) {
dc_array_add_id(contacts, 1i32 as uint32_t);
}
let mut i = 0;
@@ -1556,7 +1556,7 @@ pub unsafe fn dc_cmdline(context: &dc_context_t, cmdline: &str) -> *mut libc::c_
}
} else if strcmp(cmd, b"delcontact\x00" as *const u8 as *const libc::c_char) == 0i32 {
if !arg1.is_empty() {
ret = if 0 != dc_delete_contact(context, arg1.parse().unwrap()) {
ret = if dc_delete_contact(context, arg1.parse().unwrap()) {
2i32 as *mut libc::c_char
} else {
1i32 as *mut libc::c_char

View File

@@ -194,7 +194,7 @@ unsafe fn add_attribute(
value: *const libc::c_char,
) -> libc::c_int {
if strcasecmp(name, b"addr\x00" as *const u8 as *const libc::c_char) == 0 {
if value.is_null() || 0 == dc_may_be_valid_addr(value) || !(*aheader).addr.is_null() {
if value.is_null() || !dc_may_be_valid_addr(value) || !(*aheader).addr.is_null() {
return 0;
}
(*aheader).addr = dc_addr_normalize(value);

View File

@@ -229,14 +229,13 @@ pub unsafe fn dc_array_is_independent(array: *const dc_array_t, index: size_t) -
(*(*(*array).array.offset(index as isize) as *mut _dc_location)).independent as libc::c_int
}
// TODO should return bool /rtn
pub unsafe fn dc_array_search_id(
array: *const dc_array_t,
needle: uint32_t,
ret_index: *mut size_t,
) -> libc::c_int {
) -> bool {
if array.is_null() || (*array).magic != 0xa11aai32 as libc::c_uint {
return 0i32;
return false;
}
let data: *mut uintptr_t = (*array).array;
let mut i: size_t = 0;
@@ -246,11 +245,11 @@ pub unsafe fn dc_array_search_id(
if !ret_index.is_null() {
*ret_index = i
}
return 1i32;
return true;
}
i = i.wrapping_add(1)
}
0
false
}
pub unsafe fn dc_array_get_raw(array: *const dc_array_t) -> *const uintptr_t {

View File

@@ -37,8 +37,8 @@ pub unsafe fn dc_create_chat_by_msg_id(context: &dc_context_t, msg_id: uint32_t)
let mut send_event: libc::c_int = 0i32;
let msg: *mut dc_msg_t = dc_msg_new_untyped(context);
let chat: *mut dc_chat_t = dc_chat_new(context);
if !(0 == dc_msg_load_from_db(msg, context, msg_id)
|| 0 == dc_chat_load_from_db(chat, (*msg).chat_id)
if !(!dc_msg_load_from_db(msg, context, msg_id)
|| !dc_chat_load_from_db(chat, (*msg).chat_id)
|| (*chat).id <= 9i32 as libc::c_uint)
{
chat_id = (*chat).id;
@@ -129,9 +129,8 @@ pub unsafe fn dc_block_chat(context: &dc_context_t, chat_id: uint32_t, new_block
sqlite3_finalize(stmt);
}
// TODO should return bool /rtn
pub unsafe fn dc_chat_load_from_db(chat: *mut dc_chat_t, chat_id: uint32_t) -> libc::c_int {
let mut success: libc::c_int = 0i32;
pub unsafe fn dc_chat_load_from_db(chat: *mut dc_chat_t, chat_id: uint32_t) -> bool {
let mut success = false;
let mut stmt: *mut sqlite3_stmt = 0 as *mut sqlite3_stmt;
if !(chat.is_null() || (*chat).magic != 0xc4a7c4a7u32) {
dc_chat_empty(chat);
@@ -146,7 +145,7 @@ pub unsafe fn dc_chat_load_from_db(chat: *mut dc_chat_t, chat_id: uint32_t) -> l
if !(sqlite3_step(stmt) != 100i32) {
if !(0 == set_from_stmt(chat, stmt)) {
success = 1i32
success = true
}
}
}
@@ -227,9 +226,7 @@ pub unsafe fn dc_create_chat_by_contact_id(
dc_unblock_chat(context, chat_id);
send_event = 1i32
}
} else if 0i32 == dc_real_contact_exists(context, contact_id)
&& contact_id != 1i32 as libc::c_uint
{
} else if !dc_real_contact_exists(context, contact_id) && contact_id != 1i32 as libc::c_uint {
dc_log_warning(
context,
0i32,
@@ -297,7 +294,7 @@ pub unsafe fn dc_create_or_lookup_nchat_by_contact_id(
return;
}
contact = dc_contact_new(context);
if !(0 == dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id)) {
if dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id) {
chat_name =
if !(*contact).name.is_null() && 0 != *(*contact).name.offset(0isize) as libc::c_int {
(*contact).name
@@ -518,7 +515,7 @@ unsafe fn prepare_msg_common<'a>(
17281240262373992796 => {
dc_unarchive_chat(context, chat_id);
chat = dc_chat_new(context);
if 0 != dc_chat_load_from_db(chat, chat_id) {
if dc_chat_load_from_db(chat, chat_id) {
if (*msg).state != 18i32 {
(*msg).state = 20i32
}
@@ -1209,7 +1206,7 @@ pub unsafe fn dc_get_draft(context: &dc_context_t, chat_id: uint32_t) -> *mut dc
return 0 as *mut dc_msg_t;
}
draft_msg = dc_msg_new_untyped(context);
if 0 == dc_msg_load_from_db(draft_msg, context, draft_msg_id) {
if !dc_msg_load_from_db(draft_msg, context, draft_msg_id) {
dc_msg_unref(draft_msg);
return 0 as *mut dc_msg_t;
}
@@ -1436,7 +1433,7 @@ pub unsafe fn dc_get_next_media(
let mut i: libc::c_int;
let cnt: libc::c_int;
if !(0 == dc_msg_load_from_db(msg, context, curr_msg_id)) {
if dc_msg_load_from_db(msg, context, curr_msg_id) {
list = dc_get_chat_media(
context,
(*msg).chat_id,
@@ -1512,7 +1509,7 @@ pub unsafe fn dc_delete_chat(context: &dc_context_t, chat_id: uint32_t) {
let obj: *mut dc_chat_t = dc_chat_new(context);
let mut q3: *mut libc::c_char = 0 as *mut libc::c_char;
if !(chat_id <= 9i32 as libc::c_uint) {
if !(0 == dc_chat_load_from_db(obj, chat_id)) {
if !(!dc_chat_load_from_db(obj, chat_id)) {
q3 = sqlite3_mprintf(
b"DELETE FROM msgs_mdns WHERE msg_id IN (SELECT id FROM msgs WHERE chat_id=%i);\x00"
as *const u8 as *const libc::c_char,
@@ -1593,7 +1590,7 @@ pub unsafe fn dc_get_chat(context: &dc_context_t, chat_id: uint32_t) -> *mut dc_
let mut success: libc::c_int = 0i32;
let obj: *mut dc_chat_t = dc_chat_new(context);
if !(0 == dc_chat_load_from_db(obj, chat_id)) {
if !(!dc_chat_load_from_db(obj, chat_id)) {
success = 1i32
}
@@ -1714,9 +1711,8 @@ pub unsafe fn dc_add_contact_to_chat_ex(
dc_reset_gossiped_timestamp(context, chat_id);
/*this also makes sure, not contacts are added to special or normal chats*/
if !(0i32 == real_group_exists(context, chat_id)
|| 0i32 == dc_real_contact_exists(context, contact_id)
&& contact_id != 1i32 as libc::c_uint
|| 0i32 == dc_chat_load_from_db(chat, chat_id))
|| !dc_real_contact_exists(context, contact_id) && contact_id != 1i32 as libc::c_uint
|| !dc_chat_load_from_db(chat, chat_id))
{
if !(dc_is_contact_in_chat(context, chat_id, 1i32 as uint32_t) == 1i32) {
dc_log_event(
@@ -1902,9 +1898,7 @@ pub unsafe fn dc_remove_contact_from_chat(
{
/* we do not check if "contact_id" exists but just delete all records with the id from chats_contacts */
/* this allows to delete pending references to deleted contacts. Of course, this should _not_ happen. */
if !(0i32 == real_group_exists(context, chat_id)
|| 0i32 == dc_chat_load_from_db(chat, chat_id))
{
if !(0i32 == real_group_exists(context, chat_id) || !dc_chat_load_from_db(chat, chat_id)) {
if !(dc_is_contact_in_chat(context, chat_id, 1i32 as uint32_t) == 1i32) {
dc_log_event(
context,
@@ -2017,9 +2011,7 @@ pub unsafe fn dc_set_chat_name(
|| *new_name.offset(0isize) as libc::c_int == 0i32
|| chat_id <= 9i32 as libc::c_uint)
{
if !(0i32 == real_group_exists(context, chat_id)
|| 0i32 == dc_chat_load_from_db(chat, chat_id))
{
if !(0i32 == real_group_exists(context, chat_id) || !dc_chat_load_from_db(chat, chat_id)) {
if strcmp((*chat).name, new_name) == 0i32 {
success = 1i32
} else if !(dc_is_contact_in_chat(context, chat_id, 1i32 as uint32_t) == 1i32) {
@@ -2089,9 +2081,7 @@ pub unsafe fn dc_set_chat_profile_image(
let mut msg: *mut dc_msg_t = dc_msg_new_untyped(context);
let mut new_image_rel: *mut libc::c_char = 0 as *mut libc::c_char;
if !(chat_id <= 9i32 as libc::c_uint) {
if !(0i32 == real_group_exists(context, chat_id)
|| 0i32 == dc_chat_load_from_db(chat, chat_id))
{
if !(0i32 == real_group_exists(context, chat_id) || !dc_chat_load_from_db(chat, chat_id)) {
if !(dc_is_contact_in_chat(context, chat_id, 1i32 as uint32_t) == 1i32) {
dc_log_event(
context,
@@ -2178,7 +2168,7 @@ pub unsafe fn dc_forward_msgs(
let original_param: *mut dc_param_t = dc_param_new();
if !(msg_ids.is_null() || msg_cnt <= 0i32 || chat_id <= 9i32 as libc::c_uint) {
dc_unarchive_chat(context, chat_id);
if !(0 == dc_chat_load_from_db(chat, chat_id)) {
if !(!dc_chat_load_from_db(chat, chat_id)) {
curr_timestamp = dc_create_smeared_timestamps(context, msg_cnt);
idsstr = dc_arr_to_string(msg_ids, msg_cnt);
q3 = sqlite3_mprintf(
@@ -2192,7 +2182,7 @@ pub unsafe fn dc_forward_msgs(
break;
}
let src_msg_id: libc::c_int = sqlite3_column_int(stmt, 0i32);
if 0 == dc_msg_load_from_db(msg, context, src_msg_id as uint32_t) {
if !dc_msg_load_from_db(msg, context, src_msg_id as uint32_t) {
break;
}
dc_param_set_packed(original_param, (*(*msg).param).packed);

View File

@@ -324,7 +324,7 @@ pub unsafe fn dc_chatlist_get_summary<'a>(
if chat.is_null() {
chat = dc_chat_new((*chatlist).context);
chat_to_delete = chat;
if 0 == dc_chat_load_from_db(
if !dc_chat_load_from_db(
chat,
dc_array_get_id((*chatlist).chatNlastmsg_ids, index.wrapping_mul(2)),
) {

View File

@@ -46,14 +46,13 @@ pub unsafe fn dc_marknoticed_contact(context: &dc_context_t, contact_id: uint32_
}
// handle contacts
// TODO should return bool /rtn
pub unsafe extern "C" fn dc_may_be_valid_addr(addr: *const libc::c_char) -> libc::c_int {
pub unsafe extern "C" fn dc_may_be_valid_addr(addr: *const libc::c_char) -> bool {
if addr.is_null() {
return 0i32;
return false;
}
let at: *const libc::c_char = strchr(addr, '@' as i32);
if at.is_null() || (at.wrapping_offset_from(addr) as libc::c_long) < 1i32 as libc::c_long {
return 0i32;
return false;
}
let dot: *const libc::c_char = strchr(at, '.' as i32);
if dot.is_null()
@@ -61,10 +60,10 @@ pub unsafe extern "C" fn dc_may_be_valid_addr(addr: *const libc::c_char) -> libc
|| *dot.offset(1isize) as libc::c_int == 0i32
|| *dot.offset(2isize) as libc::c_int == 0i32
{
return 0i32;
return false;
}
1
true
}
pub unsafe fn dc_lookup_contact_id_by_addr(
@@ -137,7 +136,7 @@ pub unsafe fn dc_create_contact(
) -> uint32_t {
let mut contact_id: uint32_t = 0i32 as uint32_t;
let mut sth_modified: libc::c_int = 0i32;
let blocked: libc::c_int;
let blocked: bool;
if !(addr.is_null() || *addr.offset(0isize) as libc::c_int == 0i32) {
contact_id = dc_add_or_lookup_contact(context, name, addr, 0x4000000i32, &mut sth_modified);
blocked = dc_is_contact_blocked(context, contact_id);
@@ -151,7 +150,7 @@ pub unsafe fn dc_create_contact(
}) as uintptr_t,
0i32 as uintptr_t,
);
if 0 != blocked {
if blocked {
dc_block_contact(context, contact_id, 0i32);
}
}
@@ -169,7 +168,7 @@ pub unsafe fn dc_block_contact(
let contact: *mut dc_contact_t = dc_contact_new(context);
let mut stmt: *mut sqlite3_stmt = 0 as *mut sqlite3_stmt;
if !(contact_id <= 9i32 as libc::c_uint) {
if 0 != dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id)
if dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id)
&& (*contact).blocked != new_blocking
{
stmt = dc_sqlite3_prepare(
@@ -296,14 +295,13 @@ pub unsafe fn dc_contact_empty(mut contact: *mut dc_contact_t) {
/* contacts with at least this origin value are shown in the contact list */
/* contacts with at least this origin value are verified and known not to be spam */
/* contacts with at least this origin value start a new "normal" chat, defaults to off */
// TODO should return bool /rtn
pub unsafe fn dc_contact_load_from_db(
contact: *mut dc_contact_t,
sql: &dc_sqlite3_t,
contact_id: uint32_t,
) -> libc::c_int {
) -> bool {
let current_block: u64;
let mut success: libc::c_int = 0i32;
let mut success = false;
let mut stmt: *mut sqlite3_stmt = 0 as *mut sqlite3_stmt;
if !(contact.is_null() || (*contact).magic != 0xc047ac7i32 as libc::c_uint) {
dc_contact_empty(contact);
@@ -339,7 +337,7 @@ pub unsafe fn dc_contact_load_from_db(
}
match current_block {
12908855840294526070 => {}
_ => success = 1i32,
_ => success = true,
}
}
sqlite3_finalize(stmt);
@@ -347,13 +345,12 @@ pub unsafe fn dc_contact_load_from_db(
success
}
// TODO should return bool /rtn
pub unsafe fn dc_is_contact_blocked(context: &dc_context_t, contact_id: uint32_t) -> libc::c_int {
let mut is_blocked: libc::c_int = 0i32;
pub unsafe fn dc_is_contact_blocked(context: &dc_context_t, contact_id: uint32_t) -> bool {
let mut is_blocked = false;
let contact: *mut dc_contact_t = dc_contact_new(context);
if 0 != dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id) {
if dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id) {
if 0 != (*contact).blocked {
is_blocked = 1i32
is_blocked = true
}
}
dc_contact_unref(contact);
@@ -391,7 +388,7 @@ pub unsafe fn dc_add_or_lookup_contact(
);
if strcasecmp(addr, addr_self) == 0i32 {
row_id = 1i32 as uint32_t
} else if 0 == dc_may_be_valid_addr(addr) {
} else if !dc_may_be_valid_addr(addr) {
dc_log_warning(
context,
0i32,
@@ -786,7 +783,7 @@ pub unsafe fn dc_get_contact_encrinfo(
eos: 0 as *mut libc::c_char,
};
dc_strbuilder_init(&mut ret, 0i32);
if !(0 == dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id)) {
if !(!dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id)) {
dc_apeerstate_load_by_addr(
peerstate,
&context.sql.clone().read().unwrap(),
@@ -920,9 +917,8 @@ unsafe fn cat_fingerprint(
};
}
// TODO should return bool /rtn
pub unsafe fn dc_delete_contact(context: &dc_context_t, contact_id: uint32_t) -> libc::c_int {
let mut success: libc::c_int = 0i32;
pub unsafe fn dc_delete_contact(context: &dc_context_t, contact_id: uint32_t) -> bool {
let mut success = false;
let mut stmt: *mut sqlite3_stmt = 0 as *mut sqlite3_stmt;
if !contact_id <= 9i32 as libc::c_uint {
stmt = dc_sqlite3_prepare(
@@ -957,7 +953,7 @@ pub unsafe fn dc_delete_contact(context: &dc_context_t, contact_id: uint32_t) ->
0i32 as uintptr_t,
0i32 as uintptr_t,
);
success = 1i32
success = true
}
}
}
@@ -969,7 +965,7 @@ pub unsafe fn dc_delete_contact(context: &dc_context_t, contact_id: uint32_t) ->
pub unsafe fn dc_get_contact(context: &dc_context_t, contact_id: uint32_t) -> *mut dc_contact_t {
let mut ret: *mut dc_contact_t = dc_contact_new(context);
if 0 == dc_contact_load_from_db(ret, &context.sql.clone().read().unwrap(), contact_id) {
if !dc_contact_load_from_db(ret, &context.sql.clone().read().unwrap(), contact_id) {
dc_contact_unref(ret);
ret = 0 as *mut dc_contact_t
}
@@ -1163,20 +1159,19 @@ pub unsafe fn dc_addr_equals_self(
ret
}
// TODO should return bool /rtn
pub unsafe fn dc_addr_equals_contact(
context: &dc_context_t,
addr: *const libc::c_char,
contact_id: uint32_t,
) -> libc::c_int {
let mut addr_are_equal: libc::c_int = 0i32;
) -> bool {
let mut addr_are_equal = false;
if !addr.is_null() {
let contact: *mut dc_contact_t = dc_contact_new(context);
if 0 != dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id) {
if dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id) {
if !(*contact).addr.is_null() {
let normalized_addr: *mut libc::c_char = dc_addr_normalize(addr);
if strcasecmp((*contact).addr, normalized_addr) == 0i32 {
addr_are_equal = 1i32
addr_are_equal = true;
}
free(normalized_addr as *mut libc::c_void);
}
@@ -1217,7 +1212,7 @@ pub unsafe fn dc_get_contact_origin(
}
let contact: *mut dc_contact_t = dc_contact_new(context);
*ret_blocked = 0i32;
if !(0 == dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id)) {
if dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), contact_id) {
/* we could optimize this by loading only the needed fields */
if 0 != (*contact).blocked {
*ret_blocked = 1i32
@@ -1229,10 +1224,9 @@ pub unsafe fn dc_get_contact_origin(
ret
}
// TODO should return bool /rtn
pub unsafe fn dc_real_contact_exists(context: &dc_context_t, contact_id: uint32_t) -> libc::c_int {
pub unsafe fn dc_real_contact_exists(context: &dc_context_t, contact_id: uint32_t) -> bool {
let mut stmt: *mut sqlite3_stmt = 0 as *mut sqlite3_stmt;
let mut ret: libc::c_int = 0i32;
let mut ret = false;
if !(context.sql.clone().read().unwrap().cobj.is_null() || contact_id <= 9i32 as libc::c_uint) {
stmt = dc_sqlite3_prepare(
context,
@@ -1241,7 +1235,7 @@ pub unsafe fn dc_real_contact_exists(context: &dc_context_t, contact_id: uint32_
);
sqlite3_bind_int(stmt, 1i32, contact_id as libc::c_int);
if sqlite3_step(stmt) == 100i32 {
ret = 1i32
ret = true
}
}
sqlite3_finalize(stmt);

View File

@@ -472,7 +472,7 @@ unsafe fn dc_job_do_DC_JOB_MOVE_MSG(context: &dc_context_t, job: &mut dc_job_t)
}
match current_block {
2473556513754201174 => {
if !(0 == dc_msg_load_from_db(msg, context, job.foreign_id)) {
if dc_msg_load_from_db(msg, context, job.foreign_id) {
if dc_sqlite3_get_config_int(
context,
&context.sql.clone().read().unwrap(),
@@ -625,7 +625,7 @@ unsafe fn dc_job_do_DC_JOB_MARKSEEN_MSG_ON_IMAP(context: &dc_context_t, job: &mu
}
match current_block {
15240798224410183470 => {
if !(0 == dc_msg_load_from_db(msg, context, job.foreign_id)) {
if dc_msg_load_from_db(msg, context, job.foreign_id) {
let server_folder = CStr::from_ptr((*msg).server_folder).to_str().unwrap();
match inbox.set_seen(context, server_folder, (*msg).server_uid) as libc::c_uint {
0 => {}
@@ -938,7 +938,7 @@ unsafe fn dc_job_do_DC_JOB_DELETE_MSG_ON_IMAP(context: &dc_context_t, job: &mut
let msg: *mut dc_msg_t = dc_msg_new_untyped(context);
let inbox = context.inbox.read().unwrap();
if !(0 == dc_msg_load_from_db(msg, context, job.foreign_id)
if !(!dc_msg_load_from_db(msg, context, job.foreign_id)
|| (*msg).rfc724_mid.is_null()
|| *(*msg).rfc724_mid.offset(0isize) as libc::c_int == 0i32)
{

View File

@@ -123,8 +123,8 @@ pub unsafe fn dc_mimefactory_load_msg(
(*factory).recipients_addr = clist_new();
(*factory).msg = dc_msg_new_untyped(context);
(*factory).chat = dc_chat_new(context);
if 0 != dc_msg_load_from_db((*factory).msg, context, msg_id)
&& 0 != dc_chat_load_from_db((*factory).chat, (*(*factory).msg).chat_id)
if dc_msg_load_from_db((*factory).msg, context, msg_id)
&& dc_chat_load_from_db((*factory).chat, (*(*factory).msg).chat_id)
{
load_from(factory);
(*factory).req_mdn = 0i32;
@@ -289,8 +289,8 @@ pub unsafe fn dc_mimefactory_load_mdn(
{
/* MDNs not enabled - check this is late, in the job. the use may have changed its choice while offline ... */
contact = dc_contact_new((*factory).context);
if !(0 == dc_msg_load_from_db((*factory).msg, (*factory).context, msg_id)
|| 0 == dc_contact_load_from_db(
if !(!dc_msg_load_from_db((*factory).msg, (*factory).context, msg_id)
|| !dc_contact_load_from_db(
contact,
&mut (*factory).context.sql.clone().read().unwrap(),
(*(*factory).msg).from_id,
@@ -1131,7 +1131,7 @@ unsafe fn build_body_file(
mut base_name: *const libc::c_char,
ret_file_name_as_sent: *mut *mut libc::c_char,
) -> *mut mailmime {
let needs_ext: libc::c_int;
let needs_ext: bool;
let mime_fields: *mut mailmime_fields;
let mut mime_sub: *mut mailmime = 0 as *mut mailmime;
let content: *mut mailmime_content;
@@ -1229,14 +1229,14 @@ unsafe fn build_body_file(
needs_ext = dc_needs_ext_header(filename_to_send);
mime_fields = mailmime_fields_new_filename(
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
if 0 != needs_ext {
if needs_ext {
0 as *mut libc::c_char
} else {
dc_strdup(filename_to_send)
},
MAILMIME_MECHANISM_BASE64 as libc::c_int,
);
if 0 != needs_ext {
if needs_ext {
let mut cur1: *mut clistiter = (*(*mime_fields).fld_list).first;
while !cur1.is_null() {
let field: *mut mailmime_field = (if !cur1.is_null() {

View File

@@ -160,7 +160,7 @@ pub unsafe fn dc_get_msg_info(context: &dc_context_t, msg_id: uint32_t) -> *mut
p,
);
free(p as *mut libc::c_void);
if 0 != dc_msg_has_location(msg) {
if dc_msg_has_location(msg) {
dc_strbuilder_cat(
&mut ret,
b", Location sent\x00" as *const u8 as *const libc::c_char,
@@ -448,13 +448,12 @@ pub unsafe fn dc_msg_get_file(msg: *const dc_msg_t) -> *mut libc::c_char {
* @param msg The message object.
* @return 1=Message has location bound to it, 0=No location bound to message.
*/
// TODO should return bool /rtn
pub unsafe fn dc_msg_has_location(msg: *const dc_msg_t) -> libc::c_int {
pub unsafe fn dc_msg_has_location(msg: *const dc_msg_t) -> bool {
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
return 0i32;
return false;
}
((*msg).location_id != 0i32 as libc::c_uint) as libc::c_int
((*msg).location_id != 0i32 as libc::c_uint)
}
/**
@@ -505,13 +504,12 @@ pub unsafe fn dc_msg_get_timestamp(msg: *const dc_msg_t) -> time_t {
};
}
// TODO should return bool /rtn
pub unsafe fn dc_msg_load_from_db<'a>(
msg: *mut dc_msg_t<'a>,
context: &'a dc_context_t,
id: uint32_t,
) -> libc::c_int {
let mut success: libc::c_int = 0i32;
) -> bool {
let mut success = false;
let mut stmt = 0 as *mut sqlite3_stmt;
if !msg.is_null() {
stmt =
@@ -525,7 +523,7 @@ pub unsafe fn dc_msg_load_from_db<'a>(
if !(0 == dc_msg_set_from_stmt(msg, stmt, 0i32)) {
/* also calls dc_msg_empty() */
(*msg).context = context;
success = 1i32
success = true
}
}
}
@@ -777,7 +775,7 @@ pub unsafe fn dc_star_msgs(
pub unsafe fn dc_get_msg<'a>(context: &'a dc_context_t, msg_id: uint32_t) -> *mut dc_msg_t<'a> {
let mut success: libc::c_int = 0i32;
let obj: *mut dc_msg_t = dc_msg_new_untyped(context);
if !(0 == dc_msg_load_from_db(obj, context, msg_id)) {
if dc_msg_load_from_db(obj, context, msg_id) {
success = 1i32
}
if 0 != success {
@@ -905,13 +903,12 @@ pub unsafe fn dc_msg_get_height(msg: *const dc_msg_t) -> libc::c_int {
dc_param_get_int((*msg).param, 'h' as i32, 0i32)
}
// TODO should return bool /rtn
pub unsafe fn dc_msg_get_duration(msg: *const dc_msg_t) -> libc::c_int {
pub unsafe fn dc_msg_get_duration(msg: *const dc_msg_t) -> bool {
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
return 0i32;
return false;
}
dc_param_get_int((*msg).param, 'd' as i32, 0i32)
0 != dc_param_get_int((*msg).param, 'd' as i32, 0i32)
}
// TODO should return bool /rtn
@@ -1267,7 +1264,7 @@ pub unsafe fn dc_msg_new_load<'a>(
pub unsafe fn dc_delete_msg_from_db(context: &dc_context_t, msg_id: uint32_t) {
let msg: *mut dc_msg_t = dc_msg_new_untyped(context);
let mut stmt: *mut sqlite3_stmt = 0 as *mut sqlite3_stmt;
if !(0 == dc_msg_load_from_db(msg, context, msg_id)) {
if dc_msg_load_from_db(msg, context, msg_id) {
stmt = dc_sqlite3_prepare(
context,
&context.sql.clone().read().unwrap(),
@@ -1346,7 +1343,7 @@ pub unsafe fn dc_set_msg_failed(
) {
let mut msg = dc_msg_new_untyped(context);
let mut stmt: *mut sqlite3_stmt = 0 as *mut sqlite3_stmt;
if !(0 == dc_msg_load_from_db(msg, context, msg_id)) {
if dc_msg_load_from_db(msg, context, msg_id) {
if 18i32 == (*msg).state || 20i32 == (*msg).state || 26i32 == (*msg).state {
(*msg).state = 24i32
}

View File

@@ -173,7 +173,7 @@ pub unsafe fn dc_get_oauth2_access_token(
let l = lock.lock().unwrap();
// read generated token
if 0 == flags & 0x1i32 && 0 == is_expired(context) {
if 0 == flags & 0x1i32 && !is_expired(context) {
access_token = dc_sqlite3_get_config(
context,
&context.sql.clone().read().unwrap(),
@@ -488,8 +488,7 @@ unsafe extern "C" fn jsoneq(
-1
}
// TODO should return bool /rtn
unsafe fn is_expired(context: &dc_context_t) -> libc::c_int {
unsafe fn is_expired(context: &dc_context_t) -> bool {
let expire_timestamp: time_t = dc_sqlite3_get_config_int64(
context,
&context.sql.clone().read().unwrap(),
@@ -497,13 +496,13 @@ unsafe fn is_expired(context: &dc_context_t) -> libc::c_int {
0i32 as int64_t,
) as time_t;
if expire_timestamp <= 0i32 as libc::c_long {
return 0i32;
return false;
}
if expire_timestamp > time(0 as *mut time_t) {
return 0i32;
return false;
}
1
true
}
pub unsafe fn dc_get_oauth2_addr(

View File

@@ -205,7 +205,7 @@ pub unsafe fn dc_check_qr(context: &dc_context_t, qr: *const libc::c_char) -> *m
temp = dc_addr_normalize(addr);
free(addr as *mut libc::c_void);
addr = temp;
if 0 == dc_may_be_valid_addr(addr) {
if !dc_may_be_valid_addr(addr) {
(*qr_parsed).state = 400i32;
(*qr_parsed).text1 = dc_strdup(
b"Bad e-mail address.\x00" as *const u8 as *const libc::c_char,

View File

@@ -408,7 +408,7 @@ pub unsafe fn dc_receive_imf(
}
if chat_id == 0i32 as libc::c_uint && 0 != allow_creation {
let create_blocked_1: libc::c_int = if 0 != msgrmsg
&& 0 == dc_is_contact_blocked(context, to_id)
&& !dc_is_contact_blocked(context, to_id)
{
0i32
} else {
@@ -1470,14 +1470,13 @@ unsafe fn create_or_lookup_group(
dc_add_to_chat_contacts_table(context, chat_id, 1i32 as uint32_t);
}
if from_id > 9i32 {
if dc_addr_equals_contact(context, self_addr, from_id as uint32_t)
== 0i32
if !dc_addr_equals_contact(context, self_addr, from_id as uint32_t)
&& (skip.is_null()
|| dc_addr_equals_contact(
|| !dc_addr_equals_contact(
context,
skip,
from_id as uint32_t,
) == 0i32)
))
{
dc_add_to_chat_contacts_table(
context,
@@ -1489,9 +1488,9 @@ unsafe fn create_or_lookup_group(
i = 0i32;
while i < to_ids_cnt {
let to_id: uint32_t = dc_array_get_id(to_ids, i as size_t);
if dc_addr_equals_contact(context, self_addr, to_id) == 0i32
if !dc_addr_equals_contact(context, self_addr, to_id)
&& (skip.is_null()
|| dc_addr_equals_contact(context, skip, to_id) == 0i32)
|| !dc_addr_equals_contact(context, skip, to_id))
{
dc_add_to_chat_contacts_table(context, chat_id, to_id);
}
@@ -1576,10 +1575,10 @@ unsafe fn create_or_lookup_adhoc_group(
if !(dc_array_get_cnt(to_ids) == 0 || 0 != dc_mimeparser_is_mailinglist_message(mime_parser)) {
/* too few contacts or a mailinglist */
member_ids = dc_array_duplicate(to_ids);
if 0 == dc_array_search_id(member_ids, from_id as uint32_t, 0 as *mut size_t) {
if !dc_array_search_id(member_ids, from_id as uint32_t, 0 as *mut size_t) {
dc_array_add_id(member_ids, from_id as uint32_t);
}
if 0 == dc_array_search_id(member_ids, 1i32 as uint32_t, 0 as *mut size_t) {
if !dc_array_search_id(member_ids, 1i32 as uint32_t, 0 as *mut size_t) {
dc_array_add_id(member_ids, 1i32 as uint32_t);
}
if !(dc_array_get_cnt(member_ids) < 3) {
@@ -1803,7 +1802,7 @@ unsafe fn search_chat_ids_by_contact_ids(
while i < iCnt {
let curr_id: uint32_t = dc_array_get_id(unsorted_contact_ids, i as size_t);
if curr_id != 1i32 as libc::c_uint
&& 0 == dc_array_search_id(contact_ids, curr_id, 0 as *mut size_t)
&& !dc_array_search_id(contact_ids, curr_id, 0 as *mut size_t)
{
dc_array_add_id(contact_ids, curr_id);
}
@@ -1866,7 +1865,7 @@ unsafe fn check_verified_properties(
let mut to_ids_str: *mut libc::c_char = 0 as *mut libc::c_char;
let mut q3: *mut libc::c_char = 0 as *mut libc::c_char;
let mut stmt: *mut sqlite3_stmt = 0 as *mut sqlite3_stmt;
if 0 == dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), from_id) {
if !dc_contact_load_from_db(contact, &context.sql.clone().read().unwrap(), from_id) {
*failure_reason = dc_mprintf(
b"%s. See \"Info\" for details.\x00" as *const u8 as *const libc::c_char,
b"Internal Error; cannot load contact.\x00" as *const u8 as *const libc::c_char,
@@ -2340,7 +2339,7 @@ unsafe fn add_or_lookup_contact_by_addr(
);
free(display_name_dec as *mut libc::c_void);
if 0 != row_id {
if 0 == dc_array_search_id(ids, row_id, 0 as *mut size_t) {
if !dc_array_search_id(ids, row_id, 0 as *mut size_t) {
dc_array_add_id(ids, row_id);
}
};

View File

@@ -363,13 +363,12 @@ unsafe fn fingerprint_equals_sender(
let peerstate: *mut dc_apeerstate_t = dc_apeerstate_new(context);
let mut fingerprint_normalized: *mut libc::c_char = 0 as *mut libc::c_char;
if !(dc_array_get_cnt(contacts) != 1) {
if !(0
== dc_contact_load_from_db(
contact,
&context.sql.clone().read().unwrap(),
dc_array_get_id(contacts, 0i32 as size_t),
)
|| 0 == dc_apeerstate_load_by_addr(
if !(!dc_contact_load_from_db(
contact,
&context.sql.clone().read().unwrap(),
dc_array_get_id(contacts, 0i32 as size_t),
) || 0
== dc_apeerstate_load_by_addr(
peerstate,
&context.sql.clone().read().unwrap(),
(*contact).addr,

View File

@@ -158,9 +158,9 @@ unsafe fn dc_simplify_simplify_plain_text(
l = l_last;
while l >= l_first {
line = carray_get(lines, l as libc::c_uint) as *mut libc::c_char;
if 0 != is_plain_quote(line) {
if is_plain_quote(line) {
l_lastQuotedLine = l
} else if 0 == is_empty_line(line) {
} else if !is_empty_line(line) {
break;
}
l -= 1
@@ -169,14 +169,13 @@ unsafe fn dc_simplify_simplify_plain_text(
l_last = l_lastQuotedLine - 1i32;
(*simplify).is_cut_at_end = 1i32;
if l_last > 0i32 {
if 0 != is_empty_line(carray_get(lines, l_last as libc::c_uint) as *mut libc::c_char)
{
if is_empty_line(carray_get(lines, l_last as libc::c_uint) as *mut libc::c_char) {
l_last -= 1
}
}
if l_last > 0i32 {
line = carray_get(lines, l_last as libc::c_uint) as *mut libc::c_char;
if 0 != is_quoted_headline(line) {
if is_quoted_headline(line) {
l_last -= 1
}
}
@@ -188,12 +187,10 @@ unsafe fn dc_simplify_simplify_plain_text(
l = l_first;
while l <= l_last {
line = carray_get(lines, l as libc::c_uint) as *mut libc::c_char;
if 0 != is_plain_quote(line) {
if is_plain_quote(line) {
l_lastQuotedLine_0 = l
} else if 0 == is_empty_line(line) {
if 0 != is_quoted_headline(line)
&& 0 == hasQuotedHeadline
&& l_lastQuotedLine_0 == -1i32
} else if !is_empty_line(line) {
if is_quoted_headline(line) && 0 == hasQuotedHeadline && l_lastQuotedLine_0 == -1i32
{
hasQuotedHeadline = 1i32
} else {
@@ -225,7 +222,7 @@ unsafe fn dc_simplify_simplify_plain_text(
l = l_first;
while l <= l_last {
line = carray_get(lines, l as libc::c_uint) as *mut libc::c_char;
if 0 != is_empty_line(line) {
if is_empty_line(line) {
pending_linebreaks += 1
} else {
if 0 != content_lines_added {
@@ -256,42 +253,39 @@ unsafe fn dc_simplify_simplify_plain_text(
/* ******************************************************************************
* Tools
******************************************************************************/
// TODO should return bool /rtn
unsafe fn is_empty_line(buf: *const libc::c_char) -> libc::c_int {
unsafe fn is_empty_line(buf: *const libc::c_char) -> bool {
/* force unsigned - otherwise the `> ' '` comparison will fail */
let mut p1: *const libc::c_uchar = buf as *const libc::c_uchar;
while 0 != *p1 {
if *p1 as libc::c_int > ' ' as i32 {
return 0i32;
return false;
}
p1 = p1.offset(1isize)
}
1
true
}
// TODO should return bool /rtn
unsafe fn is_quoted_headline(buf: *const libc::c_char) -> libc::c_int {
unsafe fn is_quoted_headline(buf: *const libc::c_char) -> bool {
/* This function may be called for the line _directly_ before a quote.
The function checks if the line contains sth. like "On 01.02.2016, xy@z wrote:" in various languages.
- Currently, we simply check if the last character is a ':'.
- Checking for the existance of an email address may fail (headlines may show the user's name instead of the address) */
let buf_len: libc::c_int = strlen(buf) as libc::c_int;
if buf_len > 80i32 {
return 0i32;
return false;
}
if buf_len > 0i32 && *buf.offset((buf_len - 1i32) as isize) as libc::c_int == ':' as i32 {
return 1i32;
return true;
}
0
false
}
// TODO should return bool /rtn
unsafe fn is_plain_quote(buf: *const libc::c_char) -> libc::c_int {
unsafe fn is_plain_quote(buf: *const libc::c_char) -> bool {
if *buf.offset(0isize) as libc::c_int == '>' as i32 {
return 1i32;
return true;
}
0
false
}

View File

@@ -145,15 +145,15 @@ pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut lib
if *cur as libc::c_int != '\u{0}' as i32 {
let begin: *const libc::c_char;
let mut end: *const libc::c_char;
let mut do_quote: libc::c_int;
let mut do_quote: bool;
let mut quote_words: libc::c_int;
begin = cur;
end = begin;
quote_words = 0i32;
do_quote = 1i32;
do_quote = true;
while *cur as libc::c_int != '\u{0}' as i32 {
get_word(cur, &mut cur, &mut do_quote);
if !(0 != do_quote) {
if !do_quote {
break;
}
quote_words = 1i32;
@@ -163,7 +163,7 @@ pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut lib
}
}
if 0 != quote_words {
if 0 == quote_word(
if !quote_word(
b"utf-8\x00" as *const u8 as *const libc::c_char,
mmapstr,
begin,
@@ -222,25 +222,24 @@ pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut lib
ret_str
}
// TODO return bool /rtn
unsafe fn quote_word(
display_charset: *const libc::c_char,
mmapstr: *mut MMAPString,
word: *const libc::c_char,
size: size_t,
) -> libc::c_int {
) -> bool {
let mut cur: *const libc::c_char;
let mut i: size_t = 0i32 as size_t;
let mut hex: [libc::c_char; 4] = [0; 4];
// let mut col: libc::c_int = 0i32;
if mmap_string_append(mmapstr, b"=?\x00" as *const u8 as *const libc::c_char).is_null() {
return 0i32;
return false;
}
if mmap_string_append(mmapstr, display_charset).is_null() {
return 0i32;
return false;
}
if mmap_string_append(mmapstr, b"?Q?\x00" as *const u8 as *const libc::c_char).is_null() {
return 0i32;
return false;
}
// col = (*mmapstr).len as libc::c_int;
cur = word;
@@ -263,16 +262,16 @@ unsafe fn quote_word(
*cur as libc::c_uchar as libc::c_int,
);
if mmap_string_append(mmapstr, hex.as_mut_ptr()).is_null() {
return 0i32;
return false;
}
// col += 3i32
} else {
if *cur as libc::c_int == ' ' as i32 {
if mmap_string_append_c(mmapstr, '_' as i32 as libc::c_char).is_null() {
return 0i32;
return false;
}
} else if mmap_string_append_c(mmapstr, *cur).is_null() {
return 0i32;
return false;
}
// col += 3i32
}
@@ -280,16 +279,16 @@ unsafe fn quote_word(
i = i.wrapping_add(1)
}
if mmap_string_append(mmapstr, b"?=\x00" as *const u8 as *const libc::c_char).is_null() {
return 0i32;
return false;
}
1
true
}
unsafe fn get_word(
begin: *const libc::c_char,
pend: *mut *const libc::c_char,
pto_be_quoted: *mut libc::c_int, // TODO should be bool /rtn
pto_be_quoted: *mut bool,
) {
let mut cur: *const libc::c_char = begin;
while *cur as libc::c_int != ' ' as i32
@@ -310,17 +309,16 @@ unsafe fn get_word(
******************************************************************************/
/* see comment below */
// TODO should be bool /rtn
unsafe fn to_be_quoted(word: *const libc::c_char, size: size_t) -> libc::c_int {
unsafe fn to_be_quoted(word: *const libc::c_char, size: size_t) -> bool {
let mut cur: *const libc::c_char = word;
let mut i: size_t = 0i32 as size_t;
while i < size {
match *cur as libc::c_int {
44 | 58 | 33 | 34 | 35 | 36 | 64 | 91 | 92 | 93 | 94 | 96 | 123 | 124 | 125 | 126
| 61 | 63 | 95 => return 1i32,
| 61 | 63 | 95 => return true,
_ => {
if *cur as libc::c_uchar as libc::c_int >= 128i32 {
return 1i32;
return true;
}
}
}
@@ -328,7 +326,7 @@ unsafe fn to_be_quoted(word: *const libc::c_char, size: size_t) -> libc::c_int {
i = i.wrapping_add(1)
}
0
false
}
pub unsafe fn dc_decode_header_words(in_0: *const libc::c_char) -> *mut libc::c_char {
@@ -616,8 +614,7 @@ pub unsafe fn dc_decode_modified_utf7(
res
}
// TODO should be bool /rtn
pub unsafe fn dc_needs_ext_header(mut to_check: *const libc::c_char) -> libc::c_int {
pub unsafe fn dc_needs_ext_header(mut to_check: *const libc::c_char) -> bool {
if !to_check.is_null() {
while 0 != *to_check {
if 0 == isalnum(*to_check as libc::c_int)
@@ -626,13 +623,13 @@ pub unsafe fn dc_needs_ext_header(mut to_check: *const libc::c_char) -> libc::c_
&& *to_check as libc::c_int != '.' as i32
&& *to_check as libc::c_int != '~' as i32
{
return 1i32;
return true;
}
to_check = to_check.offset(1isize)
}
}
0
false
}
pub unsafe fn dc_encode_ext_header(to_encode: *const libc::c_char) -> *mut libc::c_char {

View File

@@ -930,7 +930,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
} else {
};
free(s as *mut libc::c_void);
if 0 != (0 != dc_may_be_valid_addr(0 as *const libc::c_char)) as libc::c_int as libc::c_long {
if 0 != (dc_may_be_valid_addr(0 as *const libc::c_char)) as libc::c_int as libc::c_long {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
.as_ptr(),
@@ -940,7 +940,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"\x00" as *const u8 as *const libc::c_char)) as libc::c_int
if 0 != (dc_may_be_valid_addr(b"\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
@@ -952,7 +952,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 == dc_may_be_valid_addr(b"user@domain.tld\x00" as *const u8 as *const libc::c_char))
if 0 != (!dc_may_be_valid_addr(b"user@domain.tld\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
{
__assert_rtn(
@@ -964,8 +964,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"uuu\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_may_be_valid_addr(b"uuu\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -976,8 +976,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"dd.tt\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_may_be_valid_addr(b"dd.tt\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -988,7 +988,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"tt.dd@uu\x00" as *const u8 as *const libc::c_char))
if 0 != (dc_may_be_valid_addr(b"tt.dd@uu\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
{
__assert_rtn(
@@ -1000,8 +1000,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"uu\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_may_be_valid_addr(b"uu\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -1012,8 +1012,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"u@d\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_may_be_valid_addr(b"u@d\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -1024,8 +1024,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"u@d.\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_may_be_valid_addr(b"u@d.\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -1036,8 +1036,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"u@d.t\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_may_be_valid_addr(b"u@d.t\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -1048,7 +1048,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 == dc_may_be_valid_addr(b"u@d.tt\x00" as *const u8 as *const libc::c_char))
if 0 != (!dc_may_be_valid_addr(b"u@d.tt\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
{
__assert_rtn(
@@ -1060,8 +1060,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"u@.tt\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_may_be_valid_addr(b"u@.tt\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -1072,8 +1072,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_may_be_valid_addr(b"@d.tt\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_may_be_valid_addr(b"@d.tt\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -2127,7 +2127,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
} else {
};
free(buf1 as *mut libc::c_void);
if 0 != (0 == dc_needs_ext_header(b"Bj\xc3\xb6rn\x00" as *const u8 as *const libc::c_char))
if 0 != (!dc_needs_ext_header(b"Bj\xc3\xb6rn\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
{
__assert_rtn(
@@ -2139,8 +2139,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_needs_ext_header(b"Bjoern\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (dc_needs_ext_header(b"Bjoern\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -2151,7 +2151,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_needs_ext_header(b"\x00" as *const u8 as *const libc::c_char)) as libc::c_int
if 0 != (dc_needs_ext_header(b"\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
@@ -2163,7 +2163,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 == dc_needs_ext_header(b" \x00" as *const u8 as *const libc::c_char)) as libc::c_int
if 0 != (!dc_needs_ext_header(b" \x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
@@ -2175,8 +2175,8 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 == dc_needs_ext_header(b"a b\x00" as *const u8 as *const libc::c_char))
as libc::c_int as libc::c_long
if 0 != (!dc_needs_ext_header(b"a b\x00" as *const u8 as *const libc::c_char)) as libc::c_int
as libc::c_long
{
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
@@ -2187,7 +2187,7 @@ unsafe extern "C" fn stress_functions(context: &dc_context_t) {
);
} else {
};
if 0 != (0 != dc_needs_ext_header(0 as *const libc::c_char)) as libc::c_int as libc::c_long {
if 0 != (dc_needs_ext_header(0 as *const libc::c_char)) as libc::c_int as libc::c_long {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
.as_ptr(),