diff --git a/.circleci/config.yml b/.circleci/config.yml index c6915d3a5..c2abf887c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ jobs: name: Setup build environment command: | apt update - apt install -y curl build-essential autoconf libtool git python pkg-config zlib1g-dev libssl-dev libetpan-dev libsasl2-dev + apt install -y curl build-essential autoconf libtool git python pkg-config libssl-dev # this will pick default toolchain from `rust-toolchain` file curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y; source $HOME/.cargo/env diff --git a/Cargo.toml b/Cargo.toml index 561621f6e..80e29415b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,6 @@ cc = "1.0.35" pkg-config = "0.3" [dependencies] -c2rust-bitfields = "0.1.0" libc = "0.2.51" pgp = "0.2.0" hex = "0.3.2" @@ -25,6 +24,7 @@ lettre = "0.9.0" imap = "1.0.1" mmime = { git = "https://github.com/dignifiedquire/mmime" } base64 = "0.10.1" +charset = "0.1.2" [dev-dependencies] tempfile = "3.0.7" diff --git a/README.md b/README.md index a19b11cd7..816f7b898 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ > Project porting deltachat-core to rust -[![CircleCI](https://circleci.com/gh/deltachat/deltachat-core-rust.svg?style=svg)](https://circleci.com/gh/deltachat/deltachat-core-rust) + +[![CircleCI build status][circle-shield]][circle] [![Appveyor build status][appveyor-shield]][appveyor] Current commit on deltachat/deltachat-core: `12ef73c8e76185f9b78e844ea673025f56a959ab`. @@ -17,3 +18,8 @@ $ cat deltachat-ffi/deltachat.h # run tests $ cargo test --all ``` + +[circle-shield]: https://img.shields.io/circleci/project/github/deltachat/deltachat-core-rust/master.svg?style=flat-square +[circle]: https://circleci.com/gh/deltachat/deltachat-core-rust/ +[appveyor-shield]: https://ci.appveyor.com/api/projects/status/lqpegel3ld4ipxj8/branch/master?style=flat-square +[appveyor]: https://ci.appveyor.com/project/dignifiedquire/deltachat-core-rust/branch/master diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..d09a3a542 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,37 @@ +environment: + matrix: + # MinGW + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + TARGET: i686-pc-windows-gnu + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + TARGET: x86_64-pc-windows-gnu + + # MSVC + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + TARGET: i686-pc-windows-msvc + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + TARGET: x86_64-pc-windows-msvc + +install: + - ps: >- + If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') { + $Env:PATH += ';C:\msys64\mingw64\bin' + } ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') { + $Env:PATH += ';C:\msys64\mingw32\bin' + } + - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe + - rustup-init -yv --default-host %target% --default-toolchain none + - set PATH=%PATH%;%USERPROFILE%\.cargo\bin + - rustc -vV + - cargo -vV + - cd %APPVEYOR_BUILD_FOLDER% + - git submodule update --init --recursive + +build: false + +test_script: +- cargo test + +cache: + - target + - C:\Users\appveyor\.cargo\registry diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 355af7acc..cf0c36bcc 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -1014,7 +1014,7 @@ pub unsafe extern "C" fn dc_array_get_accuracy( pub unsafe extern "C" fn dc_array_get_timestamp( array: *const dc_array_t, index: libc::size_t, -) -> libc::c_long { +) -> libc::time_t { dc_array::dc_array_get_timestamp(array, index) } #[no_mangle] diff --git a/examples/simple.rs b/examples/simple.rs index dbb0fdf27..e36e9cea7 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -16,6 +16,7 @@ use deltachat::dc_job::{ dc_perform_smtp_jobs, }; use deltachat::dc_lot::*; +use deltachat::x::strdup; extern "C" fn cb(_ctx: &dc_context_t, event: Event, data1: usize, data2: usize) -> usize { println!("[{:?}]", event); @@ -33,7 +34,7 @@ extern "C" fn cb(_ctx: &dc_context_t, event: Event, data1: usize, data2: usize) let c_res = CString::new(res.text().unwrap()).unwrap(); // need to use strdup to allocate the result with malloc // so it can be `free`d later. - unsafe { libc::strdup(c_res.as_ptr()) as usize } + unsafe { strdup(c_res.as_ptr()) as usize } } Err(err) => { println!("failed to download: {}: {:?}", url, err); diff --git a/src/dc_aheader.rs b/src/dc_aheader.rs index 8b4347ff3..aa1d7769d 100644 --- a/src/dc_aheader.rs +++ b/src/dc_aheader.rs @@ -162,7 +162,6 @@ impl str::FromStr for Aheader { { Some(key) => key, None => { - println!("invalid key"); return Err(()); } }; diff --git a/src/dc_apeerstate.rs b/src/dc_apeerstate.rs index c27e230da..47d1a33d4 100644 --- a/src/dc_apeerstate.rs +++ b/src/dc_apeerstate.rs @@ -261,7 +261,7 @@ pub unsafe fn dc_apeerstate_render_gossip_header( let header = Aheader::new(addr, key.clone(), EncryptPreference::NoPreference); let rendered = header.to_string(); let rendered_c = CString::new(rendered).unwrap(); - return libc::strdup(rendered_c.as_ptr()); + return strdup(rendered_c.as_ptr()); } std::ptr::null_mut() diff --git a/src/dc_chat.rs b/src/dc_chat.rs index 29cdbbb9b..125cb4811 100644 --- a/src/dc_chat.rs +++ b/src/dc_chat.rs @@ -188,9 +188,8 @@ unsafe fn set_from_stmt(mut chat: *mut dc_chat_t, row: *mut sqlite3_stmt) -> lib (*chat).gossiped_timestamp = sqlite3_column_int64(row, fresh7) as time_t; let fresh8 = row_offset; row_offset = row_offset + 1; - (*chat).is_sending_locations = (sqlite3_column_int64(row, fresh8) - > time(0 as *mut time_t) as libc::c_longlong) - as libc::c_int; + (*chat).is_sending_locations = + (sqlite3_column_int64(row, fresh8) > time(0 as *mut time_t)) as libc::c_int; if (*chat).id == 1i32 as libc::c_uint { free((*chat).name as *mut libc::c_void); (*chat).name = dc_stock_str((*chat).context, 8i32) @@ -314,7 +313,7 @@ pub unsafe fn dc_create_or_lookup_nchat_by_contact_id( create_blocked, (*contact).addr, ); - if 0 != !('K' as i32 == 'K' as i32) as libc::c_int as libc::c_long { + if 0 != !('K' as i32 == 'K' as i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 40], &[libc::c_char; 40]>( b"dc_create_or_lookup_nchat_by_contact_id\x00", @@ -1227,8 +1226,8 @@ pub unsafe fn dc_get_chat_msgs( let mut curr_id: uint32_t; let mut curr_local_timestamp: time_t; let mut curr_day: libc::c_int; - let mut last_day: libc::c_int = 0i32; - let cnv_to_local: libc::c_long = dc_gm2local_offset(); + let mut last_day = 0; + let cnv_to_local = dc_gm2local_offset(); if !ret.is_null() { if chat_id == 1i32 as libc::c_uint { let show_emails: libc::c_int = dc_sqlite3_get_config_int( @@ -1264,7 +1263,7 @@ pub unsafe fn dc_get_chat_msgs( } if 0 != flags & 0x1i32 as libc::c_uint { curr_local_timestamp = sqlite3_column_int64(stmt, 1i32) as time_t + cnv_to_local; - curr_day = (curr_local_timestamp / 86400i32 as libc::c_long) as libc::c_int; + curr_day = (curr_local_timestamp / 86400) as libc::c_int; if curr_day != last_day { dc_array_add_id(ret, 9i32 as uint32_t); last_day = curr_day diff --git a/src/dc_contact.rs b/src/dc_contact.rs index 87211c440..ce812b844 100644 --- a/src/dc_contact.rs +++ b/src/dc_contact.rs @@ -51,12 +51,12 @@ pub unsafe fn dc_may_be_valid_addr(addr: *const libc::c_char) -> bool { 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 { + if at.is_null() || at.wrapping_offset_from(addr) < 1 { return false; } let dot: *const libc::c_char = strchr(at, '.' as i32); if dot.is_null() - || (dot.wrapping_offset_from(at) as libc::c_long) < 2i32 as libc::c_long + || dot.wrapping_offset_from(at) < 2 || *dot.offset(1isize) as libc::c_int == 0i32 || *dot.offset(2isize) as libc::c_int == 0i32 { diff --git a/src/dc_e2ee.rs b/src/dc_e2ee.rs index abf3509b1..4e06364f2 100644 --- a/src/dc_e2ee.rs +++ b/src/dc_e2ee.rs @@ -309,7 +309,7 @@ pub unsafe fn dc_e2ee_encrypt( ) { let ctext_bytes = ctext_v.len(); let ctext_c = CString::new(ctext_v).unwrap(); - let ctext = libc::strdup(ctext_c.as_ptr()); + let ctext = strdup(ctext_c.as_ptr()); (*helper).cdata_to_free = ctext as *mut libc::c_void; @@ -375,7 +375,7 @@ pub unsafe fn dc_e2ee_encrypt( imffields_unprotected, mailimf_field_new_custom( strdup(b"Autocrypt\x00" as *const u8 as *const libc::c_char), - libc::strdup(rendered.as_ptr()), + strdup(rendered.as_ptr()), ), ); } @@ -612,16 +612,14 @@ pub unsafe fn dc_e2ee_decrypt( let orig_date: *mut mailimf_orig_date = (*field).fld_data.fld_orig_date; if !orig_date.is_null() { message_time = dc_timestamp_from_date((*orig_date).dt_date_time); - if message_time != -1i32 as libc::c_long - && message_time > time(0 as *mut time_t) - { + if message_time != -1 && message_time > time(0 as *mut time_t) { message_time = time(0 as *mut time_t) } } } } let autocryptheader = Aheader::from_imffields(from, imffields); - if message_time > 0i32 as libc::c_long && !from.is_null() { + if message_time > 0 && !from.is_null() { if 0 != dc_apeerstate_load_by_addr( &mut peerstate, &context.sql.clone().read().unwrap(), @@ -662,7 +660,7 @@ pub unsafe fn dc_e2ee_decrypt( self_addr, &context.sql.clone().read().unwrap(), ) { - if peerstate.last_seen == 0i32 as libc::c_long { + if peerstate.last_seen == 0 { dc_apeerstate_load_by_addr( &mut peerstate, &context.sql.clone().read().unwrap(), @@ -1032,7 +1030,7 @@ unsafe fn decrypt_part( ) { let plain_bytes = plain.len(); let plain_c = CString::new(plain).unwrap(); - let plain_buf = libc::strdup(plain_c.as_ptr()); + let plain_buf = strdup(plain_c.as_ptr()); let mut index: size_t = 0i32 as size_t; let mut decrypted_mime: *mut mailmime = 0 as *mut mailmime; diff --git a/src/dc_hash.rs b/src/dc_hash.rs index 56bf92a70..bccb9d404 100644 --- a/src/dc_hash.rs +++ b/src/dc_hash.rs @@ -73,7 +73,7 @@ pub unsafe fn dc_hash_init( keyClass: libc::c_int, mut copyKey: libc::c_int, ) { - if 0 != pNew.is_null() as libc::c_int as libc::c_long { + if 0 != pNew.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 13], &[libc::c_char; 13]>(b"dc_hash_init\x00")) .as_ptr(), @@ -83,7 +83,7 @@ pub unsafe fn dc_hash_init( ); } else { }; - if 0 != !(keyClass >= 1i32 && keyClass <= 4i32) as libc::c_int as libc::c_long { + if 0 != !(keyClass >= 1i32 && keyClass <= 4i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 13], &[libc::c_char; 13]>(b"dc_hash_init\x00")) .as_ptr(), @@ -126,7 +126,7 @@ pub unsafe fn dc_hash_insert( assert!(xHash.is_some(), "missing hashing function"); hraw = xHash.expect("non-null function pointer")(pKey, nKey); - if 0 != !((*pH).htsize & (*pH).htsize - 1i32 == 0i32) as libc::c_int as libc::c_long { + if 0 != !((*pH).htsize & (*pH).htsize - 1i32 == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 15], &[libc::c_char; 15]>(b"dc_hash_insert\x00")) .as_ptr(), @@ -178,7 +178,7 @@ pub unsafe fn dc_hash_insert( if (*pH).count > (*pH).htsize { rehash(pH, (*pH).htsize * 2); } - if 0 != !((*pH).htsize > 0i32) as libc::c_int as libc::c_long { + if 0 != !((*pH).htsize > 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 15], &[libc::c_char; 15]>(b"dc_hash_insert\x00")) .as_ptr(), @@ -188,7 +188,7 @@ pub unsafe fn dc_hash_insert( ); } else { }; - if 0 != !((*pH).htsize & (*pH).htsize - 1i32 == 0i32) as libc::c_int as libc::c_long { + if 0 != !((*pH).htsize & (*pH).htsize - 1i32 == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 15], &[libc::c_char; 15]>(b"dc_hash_insert\x00")) .as_ptr(), @@ -248,7 +248,7 @@ unsafe fn rehash(mut pH: *mut dc_hash_t, new_size: libc::c_int) { let mut next_elem: *mut dc_hashelem_t; /* The hash function */ let xHash: Option libc::c_int>; - if 0 != !(new_size & new_size - 1i32 == 0i32) as libc::c_int as libc::c_long { + if 0 != !(new_size & new_size - 1i32 == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 7], &[libc::c_char; 7]>(b"rehash\x00")).as_ptr(), b"../src/dc_hash.c\x00" as *const u8 as *const libc::c_char, diff --git a/src/dc_imex.rs b/src/dc_imex.rs index 2f489f69a..1857357d1 100644 --- a/src/dc_imex.rs +++ b/src/dc_imex.rs @@ -103,8 +103,7 @@ pub unsafe fn dc_imex_has_backup( b"backup_time\x00" as *const u8 as *const libc::c_char, 0i32, ) as time_t; - if curr_backup_time > 0i32 as libc::c_long && curr_backup_time > ret_backup_time - { + if curr_backup_time > 0 && curr_backup_time > ret_backup_time { free(ret as *mut libc::c_void); ret = curr_pathNfilename; ret_backup_time = curr_backup_time; @@ -243,7 +242,7 @@ pub unsafe fn dc_initiate_key_transfer(context: &dc_context_t) -> *mut libc::c_c current_block = 6116957410927263949; break; } - sleep(1i32 as libc::c_uint); + std::thread::sleep(std::time::Duration::from_secs(1)); msg = dc_get_msg(context, msg_id); if 0 != dc_msg_is_sent(msg) { current_block = 6450636197030046351; @@ -326,7 +325,7 @@ pub unsafe extern "C" fn dc_render_setup_file( strlen(payload_key_asc), ) { let encr_string_c = CString::new(encr).unwrap(); - let mut encr_string = libc::strdup(encr_string_c.as_ptr()); + let mut encr_string = strdup(encr_string_c.as_ptr()); free(payload_key_asc as *mut libc::c_void); let replacement: *mut libc::c_char = @@ -666,7 +665,7 @@ pub unsafe fn dc_decrypt_setup_file( if let Some(plain) = dc_pgp_symm_decrypt(passphrase, binary as *const libc::c_void, binary_bytes) { - payload = libc::strdup(CString::new(plain).unwrap().as_ptr()); + payload = strdup(CString::new(plain).unwrap().as_ptr()); } } } diff --git a/src/dc_job.rs b/src/dc_job.rs index e3d18cd5c..8909c28ee 100644 --- a/src/dc_job.rs +++ b/src/dc_job.rs @@ -268,15 +268,15 @@ unsafe fn dc_job_delete(context: &dc_context_t, job: &dc_job_t) { ******************************************************************************/ unsafe fn get_backoff_time_offset(c_tries: libc::c_int) -> time_t { // results in ~3 weeks for the last backoff timespan - let mut N: time_t = pow(2i32 as libc::c_double, (c_tries - 1i32) as libc::c_double) as time_t; - N = N * 60i32 as libc::c_long; + let mut N = 2_i32.pow((c_tries - 1) as u32); + N = N * 60; let mut rng = thread_rng(); - let n: libc::c_long = rng.gen(); - let mut seconds: time_t = n % (N + 1i32 as libc::c_long); - if seconds < 1i32 as libc::c_long { - seconds = 1i32 as time_t + let n: i32 = rng.gen(); + let mut seconds = n % (N + 1); + if seconds < 1 { + seconds = 1; } - return seconds; + seconds as time_t } unsafe fn dc_job_update(context: &dc_context_t, job: &dc_job_t) { let stmt: *mut sqlite3_stmt = dc_sqlite3_prepare( @@ -299,7 +299,7 @@ unsafe fn dc_suspend_smtp_thread(context: &dc_context_t, suspend: libc::c_int) { if context.smtp_state.0.lock().unwrap().doing_jobs == 0 { return; } - usleep((300i32 * 1000i32) as libc::useconds_t); + std::thread::sleep(std::time::Duration::from_micros(300 * 1000)); } } } @@ -891,7 +891,7 @@ pub unsafe fn dc_job_add( sqlite3_bind_int64( stmt, 6i32, - (timestamp + delay_seconds as libc::c_long) as sqlite3_int64, + (timestamp + delay_seconds as time_t) as sqlite3_int64, ); sqlite3_step(stmt); sqlite3_finalize(stmt); diff --git a/src/dc_jobthread.rs b/src/dc_jobthread.rs index 0cf6c57a3..941144126 100644 --- a/src/dc_jobthread.rs +++ b/src/dc_jobthread.rs @@ -6,7 +6,6 @@ use crate::dc_imap::Imap; use crate::dc_log::*; use crate::dc_sqlite3::*; use crate::dc_tools::*; -use crate::types::*; use crate::x::*; #[repr(C)] @@ -67,7 +66,7 @@ pub unsafe fn dc_jobthread_suspend( if using_handle == 0 { return; } - usleep((300i32 * 1000i32) as useconds_t); + std::thread::sleep(std::time::Duration::from_micros(300 * 1000)); } } else { dc_log_info( diff --git a/src/dc_key.rs b/src/dc_key.rs index 7dc1fa670..57d8195b0 100644 --- a/src/dc_key.rs +++ b/src/dc_key.rs @@ -4,7 +4,6 @@ use std::io::Cursor; use std::slice; use libc; -use mmime::other::*; use pgp::composed::{Deserializable, SignedPublicKey, SignedSecretKey}; use pgp::ser::Serialize; use pgp::types::{KeyTrait, SecretKeyTrait}; @@ -15,6 +14,7 @@ use crate::dc_log::*; use crate::dc_sqlite3::*; use crate::dc_tools::*; use crate::types::*; +use crate::x::*; #[derive(Debug, PartialEq, Eq, Clone)] pub enum Key { @@ -106,7 +106,7 @@ impl Key { } } Err(err) => { - println!("Invalid key bytes: {:?}\n{}", err, hex::encode(bytes)); + eprintln!("Invalid key bytes: {:?}\n{}", err, hex::encode(bytes)); None } } @@ -246,7 +246,7 @@ impl Key { // need to use strdup to allocate the result with malloc // so it can be `free`d later. - unsafe { libc::strdup(res_c.as_ptr()) } + unsafe { strdup(res_c.as_ptr()) } } pub fn to_armored_string( @@ -274,7 +274,7 @@ impl Key { // need to use strdup to allocate the result with malloc // so it can be `free`d later. - unsafe { libc::strdup(buf_c.as_ptr()) } + unsafe { strdup(buf_c.as_ptr()) } } pub fn write_asc_to_file(&self, file: *const libc::c_char, context: &dc_context_t) -> bool { @@ -314,7 +314,7 @@ impl Key { pub fn fingerprint_c(&self) -> *mut libc::c_char { let res = CString::new(self.fingerprint()).unwrap(); - unsafe { libc::strdup(res.as_ptr()) } + unsafe { strdup(res.as_ptr()) } } pub fn formatted_fingerprint(&self) -> String { @@ -325,7 +325,7 @@ impl Key { pub fn formatted_fingerprint_c(&self) -> *mut libc::c_char { let res = CString::new(self.formatted_fingerprint()).unwrap(); - unsafe { libc::strdup(res.as_ptr()) } + unsafe { strdup(res.as_ptr()) } } pub fn split_key(&self) -> Option { @@ -384,7 +384,7 @@ pub fn dc_key_save_self_keypair( None, ) }; - unsafe { sqlite3_bind_int64(stmt, 5, time(0 as *mut time_t) as sqlite3_int64) }; + unsafe { sqlite3_bind_int64(stmt, 5, libc::time(0 as *mut time_t) as sqlite3_int64) }; let success = if unsafe { sqlite3_step(stmt) } == 101 { true } else { @@ -419,7 +419,7 @@ pub fn dc_format_fingerprint_c(fp: *const libc::c_char) -> *mut libc::c_char { let res = dc_format_fingerprint(input); let res_c = CString::new(res).unwrap(); - unsafe { libc::strdup(res_c.as_ptr()) } + unsafe { strdup(res_c.as_ptr()) } } /// Bring a human-readable or otherwise formatted fingerprint back to the 40-characters-uppercase-hex format. @@ -435,7 +435,7 @@ pub fn dc_normalize_fingerprint_c(fp: *const libc::c_char) -> *mut libc::c_char let res = dc_normalize_fingerprint(input); let res_c = CString::new(res).unwrap(); - unsafe { libc::strdup(res_c.as_ptr()) } + unsafe { strdup(res_c.as_ptr()) } } #[cfg(test)] diff --git a/src/dc_location.rs b/src/dc_location.rs index 67d76188a..8796f6da6 100644 --- a/src/dc_location.rs +++ b/src/dc_location.rs @@ -60,19 +60,15 @@ pub unsafe fn dc_send_locations_to_chat( sqlite3_bind_int64( stmt, 1i32, - (if 0 != seconds { - now - } else { - 0i32 as libc::c_long - }) as sqlite3_int64, + (if 0 != seconds { now } else { 0 }) as sqlite3_int64, ); sqlite3_bind_int64( stmt, 2i32, (if 0 != seconds { - now + seconds as libc::c_long + now + seconds as time_t } else { - 0i32 as libc::c_long + 0 }) as sqlite3_int64, ); sqlite3_bind_int(stmt, 3i32, chat_id as libc::c_int); @@ -224,8 +220,8 @@ pub unsafe fn dc_get_locations( let ret: *mut dc_array_t = dc_array_new_typed(1i32, 500i32 as size_t); let stmt: *mut sqlite3_stmt; - if timestamp_to == 0i32 as libc::c_long { - timestamp_to = time(0 as *mut time_t) + 10i32 as libc::c_long + if timestamp_to == 0 { + timestamp_to = time(0 as *mut time_t) + 10; } stmt = dc_sqlite3_prepare( context, @@ -361,7 +357,7 @@ pub unsafe fn dc_get_location_kml( locations_last_sent = sqlite3_column_int64(stmt, 2i32) as time_t; sqlite3_finalize(stmt); stmt = 0 as *mut sqlite3_stmt; - if !(locations_send_begin == 0i32 as libc::c_long || now > locations_send_until) { + if !(locations_send_begin == 0 || now > locations_send_until) { dc_strbuilder_catf(&mut ret as *mut dc_strbuilder_t, b"\n\n\n\x00" as *const u8 as *const libc::c_char, @@ -806,7 +802,7 @@ pub unsafe fn dc_job_do_DC_JOB_MAYBE_SEND_LOCATIONS(context: &dc_context_t, _job let locations_last_sent: time_t = sqlite3_column_int64(stmt_chats, 2i32) as time_t; continue_streaming = 1i32; // be a bit tolerant as the timer may not align exactly with time(NULL) - if now - locations_last_sent < (60i32 - 3i32) as libc::c_long { + if now - locations_last_sent < (60 - 3) { continue; } if stmt_locations.is_null() { @@ -875,15 +871,11 @@ pub unsafe fn dc_job_do_DC_JOB_MAYBE_SEND_LOC_ENDED(context: &dc_context_t, job: locations_send_until = sqlite3_column_int64(stmt, 1i32) as time_t; sqlite3_finalize(stmt); stmt = 0 as *mut sqlite3_stmt; - if !(locations_send_begin != 0i32 as libc::c_long - && time(0 as *mut time_t) <= locations_send_until) - { + if !(locations_send_begin != 0 && time(0 as *mut time_t) <= locations_send_until) { // still streaming - // may happen as several calls to dc_send_locations_to_chat() // do not un-schedule pending DC_MAYBE_SEND_LOC_ENDED jobs - if !(locations_send_begin == 0i32 as libc::c_long - && locations_send_until == 0i32 as libc::c_long) - { + if !(locations_send_begin == 0 && locations_send_until == 0) { // not streaming, device-message already sent stmt = dc_sqlite3_prepare( diff --git a/src/dc_mimefactory.rs b/src/dc_mimefactory.rs index af294d185..c7df7bc2e 100644 --- a/src/dc_mimefactory.rs +++ b/src/dc_mimefactory.rs @@ -529,9 +529,8 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc: e2ee_guaranteed = dc_param_get_int((*(*factory).msg).param, 'c' as i32, 0i32) } } - if (*chat).gossiped_timestamp == 0i32 as libc::c_long - || ((*chat).gossiped_timestamp + (2i32 * 24i32 * 60i32 * 60i32) as libc::c_long) - < time(0 as *mut time_t) + if (*chat).gossiped_timestamp == 0 + || ((*chat).gossiped_timestamp + (2 * 24 * 60 * 60)) < time(0 as *mut time_t) { do_gossip = 1i32 } diff --git a/src/dc_mimeparser.rs b/src/dc_mimeparser.rs index a7ce75586..dceea54e6 100644 --- a/src/dc_mimeparser.rs +++ b/src/dc_mimeparser.rs @@ -1,4 +1,6 @@ -use mmime::charconv::*; +use std::ffi::{CStr, CString}; + +use charset::Charset; use mmime::mailimf::*; use mmime::mailimf_types::*; use mmime::mailmime::*; @@ -289,10 +291,8 @@ pub unsafe fn dc_mimeparser_parse( let mut prepend_subject: libc::c_int = 1i32; if 0 == (*mimeparser).decrypting_failed { let p: *mut libc::c_char = strchr((*mimeparser).subject, ':' as i32); - if p.wrapping_offset_from((*mimeparser).subject) as libc::c_long - == 2i32 as libc::c_long - || p.wrapping_offset_from((*mimeparser).subject) as libc::c_long - == 3i32 as libc::c_long + if p.wrapping_offset_from((*mimeparser).subject) == 2 + || p.wrapping_offset_from((*mimeparser).subject) == 3 || 0 != (*mimeparser).is_send_by_messenger || !strstr( (*mimeparser).subject, @@ -1172,8 +1172,6 @@ unsafe fn dc_mimeparser_add_single_part_if_known( let mut raw_mime: *mut libc::c_char = 0 as *mut libc::c_char; /* mmap_string_unref()'d if set */ let mut transfer_decoding_buffer: *mut libc::c_char = 0 as *mut libc::c_char; - /* charconv_buffer_free()'d if set (just calls mmap_string_unref()) */ - let mut charset_buffer: *mut libc::c_char = 0 as *mut libc::c_char; /* must not be free()'d */ let mut decoded_data: *const libc::c_char = 0 as *const libc::c_char; let mut decoded_data_bytes = 0; @@ -1225,32 +1223,34 @@ unsafe fn dc_mimeparser_add_single_part_if_known( b"UTF-8\x00" as *const u8 as *const libc::c_char, ) != 0i32 { - let mut ret_bytes = 0; - let r: libc::c_int = charconv_buffer( - b"utf-8\x00" as *const u8 as *const libc::c_char, - charset, - decoded_data, - decoded_data_bytes, - &mut charset_buffer, - &mut ret_bytes, - ); - if r != MAIL_CHARCONV_NO_ERROR as libc::c_int { - dc_log_warning((*mimeparser).context, - 0i32, - b"Cannot convert %i bytes from \"%s\" to \"utf-8\"; errorcode is %i.\x00" - as *const u8 as - *const libc::c_char, - decoded_data_bytes as - libc::c_int, - charset, - r as libc::c_int); - current_block = 17788412896529399552; - } else if charset_buffer.is_null() || ret_bytes <= 0 { - /* no error - but nothing to add */ - current_block = 8795901732489102124; + if let Some(encoding) = Charset::for_label( + CStr::from_ptr(charset).to_str().unwrap().as_bytes(), + ) { + let data = std::slice::from_raw_parts( + decoded_data as *const u8, + decoded_data_bytes, + ); + + let (res, _, _) = encoding.decode(data); + if res.is_empty() { + /* no error - but nothing to add */ + current_block = 8795901732489102124; + } else { + decoded_data_bytes = res.len(); + let res_c = CString::new(res.as_bytes()).unwrap(); + decoded_data = strdup(res_c.as_ptr()); + current_block = 17788412896529399552; + } } else { - decoded_data = charset_buffer; - decoded_data_bytes = ret_bytes; + dc_log_warning( + (*mimeparser).context, + 0i32, + b"Cannot convert %i bytes from \"%s\" to \"utf-8\".\x00" + as *const u8 + as *const libc::c_char, + decoded_data_bytes as libc::c_int, + charset, + ); current_block = 17788412896529399552; } } else { @@ -1484,9 +1484,6 @@ unsafe fn dc_mimeparser_add_single_part_if_known( } /* add object? (we do not add all objetcs, eg. signatures etc. are ignored) */ dc_simplify_unref(simplifier); - if !charset_buffer.is_null() { - charconv_buffer_free(charset_buffer); - } if !transfer_decoding_buffer.is_null() { mmap_string_unref(transfer_decoding_buffer); } diff --git a/src/dc_msg.rs b/src/dc_msg.rs index f2adeaa9e..06cb7c196 100644 --- a/src/dc_msg.rs +++ b/src/dc_msg.rs @@ -1061,12 +1061,11 @@ pub unsafe fn dc_msg_get_summarytext_by_raw( } pub unsafe fn dc_msg_has_deviating_timestamp(msg: *const dc_msg_t) -> libc::c_int { - let cnv_to_local: libc::c_long = dc_gm2local_offset(); + let cnv_to_local = dc_gm2local_offset(); let sort_timestamp: time_t = dc_msg_get_sort_timestamp(msg) + cnv_to_local; let send_timestamp: time_t = dc_msg_get_timestamp(msg) + cnv_to_local; - (sort_timestamp / 86400i32 as libc::c_long != send_timestamp / 86400i32 as libc::c_long) - as libc::c_int + (sort_timestamp / 86400 != send_timestamp / 86400) as libc::c_int } // TODO should return bool /rtn diff --git a/src/dc_oauth2.rs b/src/dc_oauth2.rs index c63e663bd..930ac2f90 100644 --- a/src/dc_oauth2.rs +++ b/src/dc_oauth2.rs @@ -326,11 +326,7 @@ pub unsafe fn dc_get_oauth2_access_token( ); if !expires_in_str.is_null() { let val: time_t = atol(expires_in_str); - if val > 20i32 as libc::c_long - && val - < (60i32 * 60i32 * 24i32 * 365i32 * 5i32) - as libc::c_long - { + if val > 20 && val < (60 * 60 * 24 * 365 * 5) { expires_in = val } free(expires_in_str as *mut libc::c_void); @@ -419,9 +415,9 @@ pub unsafe fn dc_get_oauth2_access_token( b"oauth2_timestamp_expires\x00" as *const u8 as *const libc::c_char, (if 0 != expires_in { - time(0 as *mut time_t) + expires_in - 5i32 as libc::c_long + time(0 as *mut time_t) + expires_in - 5 } else { - 0i32 as libc::c_long + 0 }) as int64_t, ); if 0 != update_redirect_uri_on_success { @@ -495,7 +491,7 @@ unsafe fn is_expired(context: &dc_context_t) -> bool { b"oauth2_timestamp_expires\x00" as *const u8 as *const libc::c_char, 0i32 as int64_t, ) as time_t; - if expire_timestamp <= 0i32 as libc::c_long { + if expire_timestamp <= 0 { return false; } if expire_timestamp > time(0 as *mut time_t) { diff --git a/src/dc_pgp.rs b/src/dc_pgp.rs index ea17b0bda..a4109bffa 100644 --- a/src/dc_pgp.rs +++ b/src/dc_pgp.rs @@ -260,7 +260,7 @@ pub fn dc_pgp_pk_decrypt( let fp_r = hex::encode_upper(pkey.fingerprint()); let len = fp_r.len() as libc::c_int; let fp_c = CString::new(fp_r).unwrap(); - let fp = unsafe { libc::strdup(fp_c.as_ptr()) }; + let fp = unsafe { strdup(fp_c.as_ptr()) }; unsafe { dc_hash_insert( diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index a9dfbbf0f..d4e203e13 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -268,12 +268,8 @@ pub unsafe fn dc_receive_imf( } } if 0 != incoming { - state = if 0 != flags as libc::c_long & 0x1 { - 16i32 - } else { - 10i32 - }; - to_id = 1i32 as uint32_t; + state = if 0 != flags & 0x1 { 16 } else { 10 }; + to_id = 1 as uint32_t; if !dc_mimeparser_lookup_field( mime_parser, b"Secure-Join\x00" as *const u8 as *const libc::c_char, @@ -454,11 +450,7 @@ pub unsafe fn dc_receive_imf( chat_id, from_id, sent_timestamp, - if 0 != flags as libc::c_long & 0x1 { - 0i32 - } else { - 1i32 - }, + if 0 != flags & 0x1 { 0 } else { 1 }, &mut sort_timestamp, &mut sent_timestamp, &mut rcvd_timestamp, @@ -481,8 +473,7 @@ pub unsafe fn dc_receive_imf( ); if !p.is_null() { header_bytes = (p.wrapping_offset_from(imf_raw_not_terminated) - as libc::c_long - + 4i32 as libc::c_long) + + 4) as libc::c_int } else { p = strstr( @@ -490,11 +481,9 @@ pub unsafe fn dc_receive_imf( b"\n\n\x00" as *const u8 as *const libc::c_char, ); if !p.is_null() { - header_bytes = (p - .wrapping_offset_from(imf_raw_not_terminated) - as libc::c_long - + 2i32 as libc::c_long) - as libc::c_int + header_bytes = + (p.wrapping_offset_from(imf_raw_not_terminated) + 2) + as libc::c_int } } } @@ -1059,9 +1048,9 @@ unsafe fn calc_timestamps( sqlite3_bind_int64(stmt, 3i32, *sort_timestamp as sqlite3_int64); if sqlite3_step(stmt) == 100i32 { let last_msg_time: time_t = sqlite3_column_int64(stmt, 0i32) as time_t; - if last_msg_time > 0i32 as libc::c_long { + if last_msg_time > 0 { if *sort_timestamp <= last_msg_time { - *sort_timestamp = last_msg_time + 1i32 as libc::c_long + *sort_timestamp = last_msg_time + 1 } } } diff --git a/src/dc_saxparser.rs b/src/dc_saxparser.rs index af6c60a3a..1f44960dd 100644 --- a/src/dc_saxparser.rs +++ b/src/dc_saxparser.rs @@ -103,7 +103,7 @@ pub unsafe fn dc_saxparser_parse(saxparser: *mut dc_saxparser_t, buf_start__: *c call_text_cb( saxparser, last_text_start, - p.wrapping_offset_from(last_text_start) as libc::c_long as size_t, + p.wrapping_offset_from(last_text_start) as size_t, '&' as i32 as libc::c_char, ); p = p.offset(1isize); @@ -123,7 +123,7 @@ pub unsafe fn dc_saxparser_parse(saxparser: *mut dc_saxparser_t, buf_start__: *c call_text_cb( saxparser, text_beg, - p.wrapping_offset_from(text_beg) as libc::c_long as size_t, + p.wrapping_offset_from(text_beg) as size_t, 'c' as i32 as libc::c_char, ); p = p.offset(3isize) @@ -341,7 +341,7 @@ pub unsafe fn dc_saxparser_parse(saxparser: *mut dc_saxparser_t, buf_start__: *c call_text_cb( saxparser, last_text_start, - p.wrapping_offset_from(last_text_start) as libc::c_long as size_t, + p.wrapping_offset_from(last_text_start) as size_t, '&' as i32 as libc::c_char, ); } @@ -465,7 +465,7 @@ unsafe fn xml_decode(mut s: *mut libc::c_char, type_0: libc::c_char) -> *mut lib s = s.offset(1); *fresh2 = c as libc::c_char } else { - b = 0i32 as libc::c_long; + b = 0; d = c; while 0 != d { b += 1; @@ -491,7 +491,7 @@ unsafe fn xml_decode(mut s: *mut libc::c_char, type_0: libc::c_char) -> *mut lib } else if *s as libc::c_int == '&' as i32 && (type_0 as libc::c_int == '&' as i32 || type_0 as libc::c_int == ' ' as i32) { - b = 0i32 as libc::c_long; + b = 0; while !s_ent[b as usize].is_null() && 0 != strncmp( s.offset(1isize), @@ -499,7 +499,7 @@ unsafe fn xml_decode(mut s: *mut libc::c_char, type_0: libc::c_char) -> *mut lib strlen(s_ent[b as usize]), ) { - b += 2i32 as libc::c_long + b += 2; } let fresh5 = b; b = b + 1; diff --git a/src/dc_securejoin.rs b/src/dc_securejoin.rs index deace608b..2d10e708b 100644 --- a/src/dc_securejoin.rs +++ b/src/dc_securejoin.rs @@ -267,7 +267,7 @@ pub unsafe fn dc_join_securejoin(context: &dc_context_t, qr: *const libc::c_char .unwrap() .shall_stop_ongoing) { - usleep((300i32 * 1000i32) as useconds_t); + std::thread::sleep(std::time::Duration::from_micros(300 * 1000)); } } } diff --git a/src/dc_smtp.rs b/src/dc_smtp.rs index b68f9c6b7..3f38332fc 100644 --- a/src/dc_smtp.rs +++ b/src/dc_smtp.rs @@ -184,7 +184,7 @@ impl Smtp { Err(err) => { let error_msg = format!("SMTP failed to send message: {:?}", err); let msg = CString::new(error_msg).unwrap(); - self.error = unsafe { libc::strdup(msg.as_ptr()) }; + self.error = unsafe { strdup(msg.as_ptr()) }; warn!(context, 0, "%s", msg,); diff --git a/src/dc_sqlite3.rs b/src/dc_sqlite3.rs index b8bef6864..6463a09f5 100644 --- a/src/dc_sqlite3.rs +++ b/src/dc_sqlite3.rs @@ -725,9 +725,7 @@ pub unsafe fn dc_sqlite3_open( as *const u8 as *const libc::c_char, ); - if 0 != !(DC_MOVE_STATE_UNDEFINED as libc::c_int == 0) as libc::c_int - as libc::c_long - { + if 0 != !(DC_MOVE_STATE_UNDEFINED as libc::c_int == 0) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>( b"dc_sqlite3_open\x00", @@ -740,9 +738,7 @@ pub unsafe fn dc_sqlite3_open( ); } else { }; - if 0 != !(DC_MOVE_STATE_PENDING as libc::c_int == 1) as libc::c_int - as libc::c_long - { + if 0 != !(DC_MOVE_STATE_PENDING as libc::c_int == 1) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>( b"dc_sqlite3_open\x00", @@ -755,9 +751,7 @@ pub unsafe fn dc_sqlite3_open( ); } else { }; - if 0 != !(DC_MOVE_STATE_STAY as libc::c_int == 2) as libc::c_int - as libc::c_long - { + if 0 != !(DC_MOVE_STATE_STAY as libc::c_int == 2) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>( b"dc_sqlite3_open\x00", @@ -770,9 +764,7 @@ pub unsafe fn dc_sqlite3_open( ); } else { }; - if 0 != !(DC_MOVE_STATE_MOVING as libc::c_int == 3) as libc::c_int - as libc::c_long - { + if 0 != !(DC_MOVE_STATE_MOVING as libc::c_int == 3) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>( b"dc_sqlite3_open\x00", @@ -935,7 +927,7 @@ pub unsafe fn dc_sqlite3_open( context.get_blobdir(), ); dc_ensure_no_slash(repl_from); - if 0 != !('f' as i32 == 'f' as i32) as libc::c_int as libc::c_long { + if 0 != !('f' as i32 == 'f' as i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>( b"dc_sqlite3_open\x00", @@ -954,7 +946,7 @@ pub unsafe fn dc_sqlite3_open( repl_from); dc_sqlite3_execute(context, sql, q3); sqlite3_free(q3 as *mut libc::c_void); - if 0 != !('i' as i32 == 'i' as i32) as libc::c_int as libc::c_long { + if 0 != !('i' as i32 == 'i' as i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>( b"dc_sqlite3_open\x00", @@ -1298,7 +1290,7 @@ pub unsafe fn dc_sqlite3_set_config_int64( ) -> libc::c_int { let value_str = dc_mprintf( b"%lld\x00" as *const u8 as *const libc::c_char, - value as libc::c_long, + value as time_t, ); if value_str.is_null() { return 0; diff --git a/src/dc_strbuilder.rs b/src/dc_strbuilder.rs index 557b91ef2..a5a460393 100644 --- a/src/dc_strbuilder.rs +++ b/src/dc_strbuilder.rs @@ -40,8 +40,8 @@ pub unsafe fn dc_strbuilder_cat( } else { (*strbuilder).allocated }; - let old_offset: libc::c_int = (*strbuilder).eos.wrapping_offset_from((*strbuilder).buf) - as libc::c_long as libc::c_int; + let old_offset: libc::c_int = + (*strbuilder).eos.wrapping_offset_from((*strbuilder).buf) as libc::c_int; (*strbuilder).allocated = (*strbuilder).allocated + add_bytes; (*strbuilder).buf = realloc( (*strbuilder).buf as *mut libc::c_void, diff --git a/src/dc_strencode.rs b/src/dc_strencode.rs index a0a73cf50..e445b653b 100644 --- a/src/dc_strencode.rs +++ b/src/dc_strencode.rs @@ -1,10 +1,13 @@ -use mmime::charconv::*; +use std::ffi::{CStr, CString}; + +use charset::Charset; use mmime::mailmime_decode::*; use mmime::mmapstring::*; use mmime::other::*; use crate::dc_tools::*; use crate::types::*; +use crate::x::*; #[inline] pub fn isalnum(mut _c: libc::c_int) -> libc::c_int { @@ -32,9 +35,8 @@ pub unsafe fn dc_urlencode(to_encode: *const libc::c_char) -> *mut libc::c_char let buf: *mut libc::c_char = malloc(strlen(to_encode).wrapping_mul(3).wrapping_add(1)) as *mut libc::c_char; let mut pbuf: *mut libc::c_char = buf; - if buf.is_null() { - exit(46i32); - } + assert!(!buf.is_null()); + while 0 != *pstr { if 0 != isalnum(*pstr as libc::c_int) || *pstr as libc::c_int == '-' as i32 @@ -85,9 +87,8 @@ pub unsafe fn dc_urldecode(to_decode: *const libc::c_char) -> *mut libc::c_char } let buf: *mut libc::c_char = malloc(strlen(to_decode).wrapping_add(1)) as *mut libc::c_char; let mut pbuf: *mut libc::c_char = buf; - if buf.is_null() { - exit(50i32); - } + assert!(!buf.is_null()); + while 0 != *pstr { if *pstr as libc::c_int == '%' as i32 { if 0 != *pstr.offset(1isize) as libc::c_int && 0 != *pstr.offset(2isize) as libc::c_int @@ -119,7 +120,7 @@ unsafe fn hex_2_int(ch: libc::c_char) -> libc::c_char { return (if 0 != isdigit(ch as libc::c_int) { ch as libc::c_int - '0' as i32 } else { - libc::tolower(ch as libc::c_int) - 'a' as i32 + 10i32 + tolower(ch as libc::c_int) - 'a' as i32 + 10i32 }) as libc::c_char; } @@ -167,7 +168,7 @@ pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut lib b"utf-8\x00" as *const u8 as *const libc::c_char, mmapstr, begin, - end.wrapping_offset_from(begin) as libc::c_long as size_t, + end.wrapping_offset_from(begin) as size_t, ) { current_block = 8550051112593613029; continue; @@ -183,7 +184,7 @@ pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut lib if mmap_string_append_len( mmapstr, end, - cur.wrapping_offset_from(end) as libc::c_long as size_t, + cur.wrapping_offset_from(end) as size_t, ) .is_null() { @@ -194,7 +195,7 @@ pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut lib } else if mmap_string_append_len( mmapstr, begin, - cur.wrapping_offset_from(begin) as libc::c_long as size_t, + cur.wrapping_offset_from(begin) as size_t, ) .is_null() { @@ -297,10 +298,7 @@ unsafe fn get_word( { cur = cur.offset(1isize) } - *pto_be_quoted = to_be_quoted( - begin, - cur.wrapping_offset_from(begin) as libc::c_long as size_t, - ); + *pto_be_quoted = to_be_quoted(begin, cur.wrapping_offset_from(begin) as size_t); *pend = cur; } @@ -369,9 +367,8 @@ pub unsafe fn dc_encode_modified_utf7( } res = malloc(2usize.wrapping_mul(strlen(to_encode)).wrapping_add(1)) as *mut libc::c_char; dst = res; - if dst.is_null() { - exit(51i32); - } + assert!(!dst.is_null()); + utf7mode = 0i32 as libc::c_uint; utf8total = 0i32 as libc::c_uint; bitstogo = 0i32 as libc::c_uint; @@ -521,10 +518,9 @@ pub unsafe fn dc_decode_modified_utf7( res = malloc(4usize.wrapping_mul(strlen(to_decode)).wrapping_add(1)) as *mut libc::c_char; dst = res; src = to_decode; - if dst.is_null() { - exit(52i32); - } - memset( + assert!(!dst.is_null()); + + libc::memset( base64.as_mut_ptr() as *mut libc::c_void, 64, ::std::mem::size_of::<[libc::c_uchar; 256]>(), @@ -642,9 +638,8 @@ pub unsafe fn dc_encode_ext_header(to_encode: *const libc::c_char) -> *mut libc: .wrapping_add(strlen(to_encode).wrapping_mul(3)) .wrapping_add(1), ) as *mut libc::c_char; - if buf.is_null() { - exit(46i32); - } + assert!(!buf.is_null()); + let mut pbuf: *mut libc::c_char = buf; strcpy(pbuf, b"utf-8\'\'\x00" as *const u8 as *const libc::c_char); pbuf = pbuf.offset(strlen(pbuf) as isize); @@ -685,10 +680,8 @@ pub unsafe fn dc_decode_ext_header(to_decode: *const libc::c_char) -> *mut libc: p2 = strchr(to_decode, '\'' as i32); if !(p2.is_null() || p2 == to_decode) { /*no empty charset allowed*/ - charset = dc_null_terminate( - to_decode, - p2.wrapping_offset_from(to_decode) as libc::c_long as libc::c_int, - ); + charset = + dc_null_terminate(to_decode, p2.wrapping_offset_from(to_decode) as libc::c_int); p2 = p2.offset(1isize); // skip language p2 = strchr(p2, '\'' as i32); @@ -699,19 +692,17 @@ pub unsafe fn dc_decode_ext_header(to_decode: *const libc::c_char) -> *mut libc: && strcmp(charset, b"utf-8\x00" as *const u8 as *const libc::c_char) != 0i32 && strcmp(charset, b"UTF-8\x00" as *const u8 as *const libc::c_char) != 0i32 { - let mut converted: *mut libc::c_char = 0 as *mut libc::c_char; - let r: libc::c_int = charconv( - b"utf-8\x00" as *const u8 as *const libc::c_char, - charset, - decoded, - strlen(decoded), - &mut converted, - ); - if r == MAIL_CHARCONV_NO_ERROR as libc::c_int && !converted.is_null() { + if let Some(encoding) = + Charset::for_label(CStr::from_ptr(charset).to_str().unwrap().as_bytes()) + { + let data = + std::slice::from_raw_parts(decoded as *const u8, strlen(decoded)); + + let (res, _, _) = encoding.decode(data); free(decoded as *mut libc::c_void); - decoded = converted - } else { - free(converted as *mut libc::c_void); + let res_c = CString::new(res.as_bytes()).unwrap(); + + decoded = strdup(res_c.as_ptr()); } } } diff --git a/src/dc_tools.rs b/src/dc_tools.rs index e3a27718f..439b9a444 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -96,8 +96,8 @@ pub unsafe fn dc_str_replace( if p2.is_null() { break; } - start_search_pos = (p2.wrapping_offset_from(*haystack) as libc::c_long - + replacement_len as libc::c_long) as libc::c_int; + start_search_pos = + (p2.wrapping_offset_from(*haystack) + replacement_len as isize) as libc::c_int; *p2 = 0i32 as libc::c_char; p2 = p2.offset(needle_len as isize); let new_string: *mut libc::c_char = dc_mprintf( @@ -185,7 +185,7 @@ pub unsafe fn dc_strlower(in_0: *const libc::c_char) -> *mut libc::c_char { let out: *mut libc::c_char = dc_strdup(in_0); let mut p: *mut libc::c_char = out; while 0 != *p { - *p = libc::tolower(*p as libc::c_int) as libc::c_char; + *p = tolower(*p as libc::c_int) as libc::c_char; p = p.offset(1isize) } @@ -195,7 +195,7 @@ pub unsafe fn dc_strlower(in_0: *const libc::c_char) -> *mut libc::c_char { pub unsafe fn dc_strlower_in_place(in_0: *mut libc::c_char) { let mut p: *mut libc::c_char = in_0; while 0 != *p { - *p = libc::tolower(*p as libc::c_int) as libc::c_char; + *p = tolower(*p as libc::c_int) as libc::c_char; p = p.offset(1isize) } } @@ -593,10 +593,7 @@ pub unsafe fn dc_str_to_clist( clist_insert_after( list, (*list).last, - strndup( - p1, - p2.wrapping_offset_from(p1) as libc::c_long as libc::c_ulong, - ) as *mut libc::c_void, + strndup(p1, p2.wrapping_offset_from(p1) as libc::c_ulong) as *mut libc::c_void, ); p1 = p2.offset(strlen(delimiter) as isize) } @@ -725,7 +722,7 @@ pub unsafe fn dc_timestamp_from_date(date_time: *mut mailimf_date_time) -> time_ zone_hour = -(-(*date_time).dt_zone / 100i32); zone_min = -(-(*date_time).dt_zone % 100i32) } - timeval -= (zone_hour * 3600i32 + zone_min * 60i32) as libc::c_long; + timeval -= (zone_hour * 3600 + zone_min * 60) as time_t; timeval } @@ -754,18 +751,14 @@ pub unsafe fn mkgmtime(tmp: *mut tm) -> time_t { yourtm.tm_sec = 0i32; bits = 0i32; t = 1i32 as time_t; - while t > 0i32 as libc::c_long { + while t > 0 { bits += 1; t <<= 1i32 } if bits > 40i32 { bits = 40i32 } - t = if t < 0i32 as libc::c_long { - 0i32 as libc::c_long - } else { - (1i32 as time_t) << bits - }; + t = if t < 0 { 0 } else { (1i32 as time_t) << bits }; loop { gmtime_r(&mut t, &mut mytm); dir = tmcomp(&mut mytm, &mut yourtm); @@ -785,7 +778,7 @@ pub unsafe fn mkgmtime(tmp: *mut tm) -> time_t { t += (1i32 as time_t) << bits } } - t += saved_seconds as libc::c_long; + t += saved_seconds as time_t; t } @@ -851,7 +844,7 @@ pub unsafe fn dc_timestamp_to_str(mut wanted: time_t) -> *mut libc::c_char { ); } -pub unsafe fn dc_gm2local_offset() -> libc::c_long { +pub unsafe fn dc_gm2local_offset() -> time_t { /* returns the offset that must be _added_ to an UTC/GMT-time to create the localtime. the function may return nagative values. */ let mut gmtime: time_t = time(0 as *mut time_t); @@ -902,14 +895,15 @@ pub unsafe fn dc_create_smeared_timestamp(context: &dc_context_t) -> time_t { pub unsafe fn dc_create_smeared_timestamps(context: &dc_context_t, count: libc::c_int) -> time_t { /* get a range to timestamps that can be used uniquely */ - let now: time_t = time(0 as *mut time_t); - let mut start: time_t = - now + (if count < 5i32 { count } else { 5i32 }) as libc::c_long - count as libc::c_long; + let now = time(0 as *mut time_t); + let start = now + (if count < 5 { count } else { 5 }) as time_t - count as time_t; let ts = *context.last_smeared_timestamp.clone().write().unwrap(); - start = if ts + 1 > start { ts + 1 } else { start }; - - start + if ts + 1 > start { + ts + 1 + } else { + start + } } /* Message-ID tools */ @@ -1212,11 +1206,10 @@ pub unsafe fn dc_get_filemeta( as uint32_t; return 1i32; } - pos += (2i32 - + ((*buf.offset((pos + 2) as isize) as libc::c_int) << 8i32) - + *buf.offset((pos + 3) as isize) as libc::c_int) - as libc::c_long; - if (pos + 12) > buf_bytes as libc::c_long { + pos += 2 + + ((*buf.offset((pos + 2) as isize) as libc::c_int) << 8) + + *buf.offset((pos + 3) as isize) as libc::c_int; + if (pos + 12) > buf_bytes as libc::c_int { break; } } @@ -1552,10 +1545,10 @@ pub unsafe fn dc_get_fine_pathNfilename( while i < 1000i32 { /*no deadlocks, please*/ if 0 != i { - let idx: time_t = if i < 100i32 { - i as libc::c_long + let idx = if i < 100 { + i as time_t } else { - now + i as libc::c_long + now + i as time_t }; ret = dc_mprintf( b"%s/%s-%lu%s\x00" as *const u8 as *const libc::c_char, diff --git a/src/types.rs b/src/types.rs index e0575ee88..21de554de 100644 --- a/src/types.rs +++ b/src/types.rs @@ -21,12 +21,6 @@ pub type __darwin_ct_rune_t = libc::c_int; pub type __darwin_wchar_t = libc::c_int; pub type __darwin_rune_t = __darwin_wchar_t; pub type uint64_t = libc::c_ulonglong; -pub type uid_t = libc::uid_t; -pub type gid_t = libc::gid_t; -pub type dev_t = libc::dev_t; -pub type blkcnt_t = libc::blkcnt_t; -pub type blksize_t = libc::blksize_t; -pub type nlink_t = __uint16_t; /** * Callback function that should be given to dc_context_new(). @@ -73,7 +67,6 @@ pub type dc_get_config_t = unsafe fn( pub type sqlite_int64 = libc::int64_t; pub type sqlite3_int64 = sqlite_int64; -pub type useconds_t = libc::useconds_t; pub type int32_t = libc::int32_t; pub type int64_t = libc::int64_t; pub type uintptr_t = libc::uintptr_t; diff --git a/src/x.rs b/src/x.rs index 282395516..205c789ca 100644 --- a/src/x.rs +++ b/src/x.rs @@ -4,15 +4,23 @@ use crate::types::*; pub use libc::{ atoi, calloc, close, closedir, exit, fclose, fgets, fopen, fread, free, fseek, ftell, fwrite, gmtime, gmtime_r, localtime, localtime_r, malloc, memcmp, memcpy, memmove, memset, mkdir, open, - opendir, printf, read, readdir, realloc, remove, sleep, snprintf, sprintf, sscanf, strcasecmp, - strcat, strchr, strcmp, strcpy, strcspn, strdup, strlen, strncasecmp, strncmp, strncpy, - strrchr, strspn, strstr, strtol, system, time, tolower as __tolower, toupper as __toupper, - usleep, write, + opendir, printf, read, readdir, realloc, remove, sprintf, sscanf, strcat, strchr, strcmp, + strcpy, strcspn, strlen, strncmp, strncpy, strrchr, strspn, strstr, strtol, system, time, + tolower, write, }; -extern "C" { - // pub static mut _DefaultRuneLocale: _RuneLocale; +pub unsafe fn strdup(s: *const libc::c_char) -> *mut libc::c_char { + let slen = libc::strlen(s); + let result = libc::malloc(slen + 1); + if result.is_null() { + return std::ptr::null_mut(); + } + libc::memcpy(result, s as *const _, slen + 1); + result as *mut _ +} + +extern "C" { pub fn clock() -> libc::clock_t; pub fn qsort( __base: *mut libc::c_void, @@ -53,12 +61,23 @@ extern "C" { _: *const libc::c_char, ) -> !; + #[cfg(windows)] + pub(crate) fn snprintf( + s: *mut libc::c_char, + n: libc::size_t, + format: *const libc::c_char, + _: ... + ) -> libc::c_int; + // -- DC Methods pub fn dc_strbuilder_catf(_: *mut dc_strbuilder_t, format: *const libc::c_char, _: ...); pub fn dc_mprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char; } +#[cfg(not(windows))] +pub(crate) use libc::snprintf; + #[cfg(not(target_os = "macos"))] pub unsafe extern "C" fn __assert_rtn( a: *const libc::c_char, @@ -77,6 +96,41 @@ pub unsafe fn atof(nptr: *mut libc::c_char) -> libc::c_double { libc::strtod(nptr, std::ptr::null_mut()) } +pub(crate) unsafe fn strcasecmp(s1: *const libc::c_char, s2: *const libc::c_char) -> libc::c_int { + let s1 = std::ffi::CStr::from_ptr(s1) + .to_string_lossy() + .to_lowercase(); + let s2 = std::ffi::CStr::from_ptr(s2) + .to_string_lossy() + .to_lowercase(); + if s1 == s2 { + 0 + } else { + 1 + } +} + +pub(crate) unsafe fn strncasecmp( + s1: *const libc::c_char, + s2: *const libc::c_char, + n: libc::size_t, +) -> libc::c_int { + let s1 = std::ffi::CStr::from_ptr(s1) + .to_string_lossy() + .to_lowercase(); + let s2 = std::ffi::CStr::from_ptr(s2) + .to_string_lossy() + .to_lowercase(); + let m1 = std::cmp::min(n, s1.len()); + let m2 = std::cmp::min(n, s2.len()); + + if s1[..m1] == s2[..m2] { + 0 + } else { + 1 + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/tests/stress.rs b/tests/stress.rs index 6c156105f..6bc1275d1 100644 --- a/tests/stress.rs +++ b/tests/stress.rs @@ -3,7 +3,6 @@ use std::ffi::{CStr, CString}; use mmime::mailimf_types::*; -use mmime::other::*; use tempfile::{tempdir, TempDir}; use deltachat::constants::*; @@ -101,7 +100,7 @@ unsafe fn stress_functions(context: &dc_context_t) { == dc_file_exist( context, b"$BLOBDIR/foobar\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -117,7 +116,7 @@ unsafe fn stress_functions(context: &dc_context_t) { != dc_file_exist( context, b"$BLOBDIR/foobarx\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -132,7 +131,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(dc_get_filebytes( context, b"$BLOBDIR/foobar\x00" as *const u8 as *const libc::c_char, - ) == 7i32 as libc::c_ulonglong) as libc::c_int as libc::c_long + ) == 7i32 as libc::c_ulonglong) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -149,7 +148,7 @@ unsafe fn stress_functions(context: &dc_context_t) { context.get_blobdir(), b"foobar\x00" as *const u8 as *const libc::c_char, ); - if 0 != (0 == dc_is_blobdir_path(context, abs_path)) as libc::c_int as libc::c_long { + if 0 != (0 == dc_is_blobdir_path(context, abs_path)) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -163,7 +162,7 @@ unsafe fn stress_functions(context: &dc_context_t) { == dc_is_blobdir_path( context, b"$BLOBDIR/fofo\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -179,7 +178,7 @@ unsafe fn stress_functions(context: &dc_context_t) { != dc_is_blobdir_path( context, b"/BLOBDIR/fofo\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -191,7 +190,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (0 == dc_file_exist(context, abs_path)) as libc::c_int as libc::c_long { + if 0 != (0 == dc_file_exist(context, abs_path)) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -207,7 +206,7 @@ unsafe fn stress_functions(context: &dc_context_t) { context, b"$BLOBDIR/foobar\x00" as *const u8 as *const libc::c_char, b"$BLOBDIR/dada\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -222,7 +221,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(dc_get_filebytes( context, b"$BLOBDIR/dada\x00" as *const u8 as *const libc::c_char, - ) == 7i32 as libc::c_ulonglong) as libc::c_int as libc::c_long + ) == 7i32 as libc::c_ulonglong) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -258,7 +257,7 @@ unsafe fn stress_functions(context: &dc_context_t) { == dc_delete_file( context, b"$BLOBDIR/foobar\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -274,7 +273,7 @@ unsafe fn stress_functions(context: &dc_context_t) { == dc_delete_file( context, b"$BLOBDIR/dada\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -290,7 +289,7 @@ unsafe fn stress_functions(context: &dc_context_t) { == dc_create_folder( context, b"$BLOBDIR/foobar-folder\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -306,7 +305,7 @@ unsafe fn stress_functions(context: &dc_context_t) { == dc_file_exist( context, b"$BLOBDIR/foobar-folder\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -322,7 +321,7 @@ unsafe fn stress_functions(context: &dc_context_t) { == dc_delete_file( context, b"$BLOBDIR/foobar-folder\x00" as *const u8 as *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -339,7 +338,7 @@ unsafe fn stress_functions(context: &dc_context_t) { b"$BLOBDIR\x00" as *const u8 as *const libc::c_char, b"foobar.dadada\x00" as *const u8 as *const libc::c_char, ); - if 0 != fn0.is_null() as libc::c_int as libc::c_long { + if 0 != fn0.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -352,7 +351,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( fn0, b"$BLOBDIR/foobar.dadada\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -375,7 +374,7 @@ unsafe fn stress_functions(context: &dc_context_t) { b"$BLOBDIR\x00" as *const u8 as *const libc::c_char, b"foobar.dadada\x00" as *const u8 as *const libc::c_char, ); - if 0 != fn1.is_null() as libc::c_int as libc::c_long { + if 0 != fn1.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -388,7 +387,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( fn1, b"$BLOBDIR/foobar-1.dadada\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -400,7 +399,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (0 == dc_delete_file(context, fn0)) as libc::c_int as libc::c_long { + if 0 != (0 == dc_delete_file(context, fn0)) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -419,7 +418,7 @@ unsafe fn stress_functions(context: &dc_context_t) { as *const u8 as *const libc::c_char); let mut buf2: *mut libc::c_char = strdup(buf1); dc_replace_bad_utf8_chars(buf2); - if 0 != !(strcmp(buf1, buf2) == 0i32) as libc::c_int as libc::c_long { + if 0 != !(strcmp(buf1, buf2) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -437,7 +436,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( b"ISO-String with Ae: _\x00" as *const u8 as *const libc::c_char, buf2, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -453,7 +452,7 @@ unsafe fn stress_functions(context: &dc_context_t) { buf1 = strdup(b"\x00" as *const u8 as *const libc::c_char); buf2 = strdup(buf1); dc_replace_bad_utf8_chars(buf2); - if 0 != !(*buf2.offset(0isize) as libc::c_int == 0i32) as libc::c_int as libc::c_long { + if 0 != !(*buf2.offset(0isize) as libc::c_int == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -470,7 +469,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( buf1, b"Bj%C3%B6rn+Petersen\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -485,7 +484,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( buf2, b"Bj\xc3\xb6rn Petersen\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -499,7 +498,7 @@ unsafe fn stress_functions(context: &dc_context_t) { free(buf1 as *mut libc::c_void); free(buf2 as *mut libc::c_void); buf1 = dc_create_id(); - if 0 != !(strlen(buf1) == 11) as libc::c_int as libc::c_long { + if 0 != !(strlen(buf1) == 11) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -517,7 +516,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( buf1, b"Bj&APY-rn_Petersen\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -532,7 +531,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( buf2, b"Bj\xc3\xb6rn Petersen\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -545,9 +544,7 @@ unsafe fn stress_functions(context: &dc_context_t) { }; free(buf1 as *mut libc::c_void); free(buf2 as *mut libc::c_void); - if 0 != !(2100i32 == 2100i32 || 2100i32 == 2052i32 || 2100i32 == 2055i32) as libc::c_int - as libc::c_long - { + if 0 != !(2100i32 == 2100i32 || 2100i32 == 2052i32 || 2100i32 == 2055i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -557,9 +554,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(2052i32 == 2100i32 || 2052i32 == 2052i32 || 2052i32 == 2055i32) as libc::c_int - as libc::c_long - { + if 0 != !(2052i32 == 2100i32 || 2052i32 == 2052i32 || 2052i32 == 2055i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -569,9 +564,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (100i32 == 2100i32 || 100i32 == 2052i32 || 100i32 == 2055i32) as libc::c_int - as libc::c_long - { + if 0 != (100i32 == 2100i32 || 100i32 == 2052i32 || 100i32 == 2055i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -581,9 +574,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (300i32 == 2100i32 || 300i32 == 2052i32 || 300i32 == 2055i32) as libc::c_int - as libc::c_long - { + if 0 != (300i32 == 2100i32 || 300i32 == 2052i32 || 300i32 == 2055i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -593,9 +584,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (400i32 == 2100i32 || 400i32 == 2052i32 || 400i32 == 2055i32) as libc::c_int - as libc::c_long - { + if 0 != (400i32 == 2100i32 || 400i32 == 2052i32 || 400i32 == 2055i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -605,7 +594,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(100i32 >= 100i32 && 100i32 <= 499i32) as libc::c_int as libc::c_long { + if 0 != !(100i32 >= 100i32 && 100i32 <= 499i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -615,7 +604,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(300i32 >= 100i32 && 300i32 <= 499i32) as libc::c_int as libc::c_long { + if 0 != !(300i32 >= 100i32 && 300i32 <= 499i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -625,7 +614,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(400i32 >= 100i32 && 400i32 <= 499i32) as libc::c_int as libc::c_long { + if 0 != !(400i32 >= 100i32 && 400i32 <= 499i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -635,7 +624,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (2010i32 >= 100i32 && 2010i32 <= 499i32) as libc::c_int as libc::c_long { + if 0 != (2010i32 >= 100i32 && 2010i32 <= 499i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -645,7 +634,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(2091i32 == 2091i32 || 2091i32 == 2100i32) as libc::c_int as libc::c_long { + if 0 != !(2091i32 == 2091i32 || 2091i32 == 2100i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -655,7 +644,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(2100i32 == 2091i32 || 2100i32 == 2100i32) as libc::c_int as libc::c_long { + if 0 != !(2100i32 == 2091i32 || 2100i32 == 2100i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -665,7 +654,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (100i32 == 2091i32 || 100i32 == 2100i32) as libc::c_int as libc::c_long { + if 0 != (100i32 == 2091i32 || 100i32 == 2100i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -675,7 +664,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (300i32 == 2091i32 || 300i32 == 2100i32) as libc::c_int as libc::c_long { + if 0 != (300i32 == 2091i32 || 300i32 == 2100i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -685,7 +674,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != (400i32 == 2091i32 || 400i32 == 2100i32) as libc::c_int as libc::c_long { + if 0 != (400i32 == 2091i32 || 400i32 == 2100i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -696,8 +685,7 @@ unsafe fn stress_functions(context: &dc_context_t) { } else { }; if 0 != !(dc_utf8_strlen(b"c\x00" as *const u8 as *const libc::c_char) == 1 - && strlen(b"c\x00" as *const u8 as *const libc::c_char) == 1) as libc::c_int - as libc::c_long + && strlen(b"c\x00" as *const u8 as *const libc::c_char) == 1) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -709,8 +697,7 @@ unsafe fn stress_functions(context: &dc_context_t) { } else { }; if 0 != !(dc_utf8_strlen(b"\xc3\xa4\x00" as *const u8 as *const libc::c_char) == 1 - && strlen(b"\xc3\xa4\x00" as *const u8 as *const libc::c_char) == 2) - as libc::c_int as libc::c_long + && strlen(b"\xc3\xa4\x00" as *const u8 as *const libc::c_char) == 2) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -723,7 +710,7 @@ unsafe fn stress_functions(context: &dc_context_t) { } else { }; let arr = dc_array_new(7i32 as size_t); - if 0 != !(dc_array_get_cnt(arr) == 0) as libc::c_int as libc::c_long { + if 0 != !(dc_array_get_cnt(arr) == 0) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -738,7 +725,7 @@ unsafe fn stress_functions(context: &dc_context_t) { dc_array_add_id(arr, (i + 1i32 * 2i32) as uint32_t); i += 1 } - if 0 != !(dc_array_get_cnt(arr) == 1000) as libc::c_int as libc::c_long { + if 0 != !(dc_array_get_cnt(arr) == 1000) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -750,9 +737,7 @@ unsafe fn stress_functions(context: &dc_context_t) { }; i = 0i32; while i < 1000i32 { - if 0 != !(dc_array_get_id(arr, i as size_t) == (i + 1i32 * 2i32) as libc::c_uint) - as libc::c_int as libc::c_long - { + if 0 != !(dc_array_get_id(arr, i as size_t) == (i + 1i32 * 2i32) as libc::c_uint) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -764,9 +749,7 @@ unsafe fn stress_functions(context: &dc_context_t) { }; i += 1 } - if 0 != !(dc_array_get_id(arr, -1i32 as size_t) == 0i32 as libc::c_uint) as libc::c_int - as libc::c_long - { + if 0 != !(dc_array_get_id(arr, -1i32 as size_t) == 0i32 as libc::c_uint) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -776,9 +759,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(dc_array_get_id(arr, 1000i32 as size_t) == 0i32 as libc::c_uint) as libc::c_int - as libc::c_long - { + if 0 != !(dc_array_get_id(arr, 1000i32 as size_t) == 0i32 as libc::c_uint) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -788,9 +769,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(dc_array_get_id(arr, (1000i32 + 1i32) as size_t) == 0i32 as libc::c_uint) - as libc::c_int as libc::c_long - { + if 0 != !(dc_array_get_id(arr, (1000i32 + 1i32) as size_t) == 0i32 as libc::c_uint) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -801,7 +780,7 @@ unsafe fn stress_functions(context: &dc_context_t) { } else { }; dc_array_empty(arr); - if 0 != !(dc_array_get_cnt(arr) == 0) as libc::c_int as libc::c_long { + if 0 != !(dc_array_get_cnt(arr) == 0) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -820,8 +799,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(dc_array_get_id(arr, 0i32 as size_t) == 0i32 as libc::c_uint && dc_array_get_id(arr, 1i32 as size_t) == 7i32 as libc::c_uint && dc_array_get_id(arr, 2i32 as size_t) == 13i32 as libc::c_uint - && dc_array_get_id(arr, 3i32 as size_t) == 666i32 as libc::c_uint) - as libc::c_int as libc::c_long + && dc_array_get_id(arr, 3i32 as size_t) == 666i32 as libc::c_uint) as usize { __assert_rtn((*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(), @@ -836,7 +814,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( str_0, b"0-7-13-666-5000\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -858,7 +836,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( str_0, b"0,12,133,1999999\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -891,7 +869,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( b"XX\x00" as *const u8 as *const libc::c_char, dc_array_get_ptr(arr, 0i32 as size_t) as *mut libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -906,7 +884,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( b"aaa\x00" as *const u8 as *const libc::c_char, dc_array_get_ptr(arr, 1i32 as size_t) as *mut libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -921,7 +899,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( b"bbb\x00" as *const u8 as *const libc::c_char, dc_array_get_ptr(arr, 2i32 as size_t) as *mut libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -936,7 +914,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( b"item1\x00" as *const u8 as *const libc::c_char, dc_array_get_ptr(arr, 3i32 as size_t) as *mut libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -954,7 +932,7 @@ unsafe fn stress_functions(context: &dc_context_t) { p1, b"\r\n\r\na=1\nb=2\n\nc = 3 \x00" as *const u8 as *const libc::c_char, ); - if 0 != !(dc_param_get_int(p1, 'a' as i32, 0i32) == 1i32) as libc::c_int as libc::c_long { + if 0 != !(dc_param_get_int(p1, 'a' as i32, 0i32) == 1i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -964,7 +942,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(dc_param_get_int(p1, 'b' as i32, 0i32) == 2i32) as libc::c_int as libc::c_long { + if 0 != !(dc_param_get_int(p1, 'b' as i32, 0i32) == 2i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -974,7 +952,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(dc_param_get_int(p1, 'c' as i32, 0i32) == 0i32) as libc::c_int as libc::c_long { + if 0 != !(dc_param_get_int(p1, 'c' as i32, 0i32) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -984,7 +962,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(dc_param_exists(p1, 'c' as i32) == 0i32) as libc::c_int as libc::c_long { + if 0 != !(dc_param_exists(p1, 'c' as i32) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -995,7 +973,7 @@ unsafe fn stress_functions(context: &dc_context_t) { } else { }; dc_param_set_int(p1, 'd' as i32, 4i32); - if 0 != !(dc_param_get_int(p1, 'd' as i32, 0i32) == 4i32) as libc::c_int as libc::c_long { + if 0 != !(dc_param_get_int(p1, 'd' as i32, 0i32) == 4i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1017,7 +995,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( (*p1).packed, b"a=foo\nb=2\nd=4\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1054,9 +1032,7 @@ unsafe fn stress_functions(context: &dc_context_t) { context, b"sys.config_keys\x00" as *const u8 as *const libc::c_char, ); - if 0 != !(!keys.is_null() && 0 != *keys.offset(0isize) as libc::c_int) as libc::c_int - as libc::c_long - { + if 0 != !(!keys.is_null() && 0 != *keys.offset(0isize) as libc::c_int) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1084,7 +1060,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" probably_never_a_key \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1096,9 +1072,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != strstr(keys, b" addr \x00" as *const u8 as *const libc::c_char).is_null() as libc::c_int - as libc::c_long - { + if 0 != strstr(keys, b" addr \x00" as *const u8 as *const libc::c_char).is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1112,7 +1086,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" mail_server \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1123,8 +1097,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != strstr(keys, b" mail_user \x00" as *const u8 as *const libc::c_char).is_null() - as libc::c_int as libc::c_long + if 0 != strstr(keys, b" mail_user \x00" as *const u8 as *const libc::c_char).is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1135,9 +1108,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != strstr(keys, b" mail_pw \x00" as *const u8 as *const libc::c_char).is_null() - as libc::c_int as libc::c_long - { + if 0 != strstr(keys, b" mail_pw \x00" as *const u8 as *const libc::c_char).is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1147,8 +1118,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != strstr(keys, b" mail_port \x00" as *const u8 as *const libc::c_char).is_null() - as libc::c_int as libc::c_long + if 0 != strstr(keys, b" mail_port \x00" as *const u8 as *const libc::c_char).is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1163,7 +1133,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" send_server \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1174,8 +1144,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != strstr(keys, b" send_user \x00" as *const u8 as *const libc::c_char).is_null() - as libc::c_int as libc::c_long + if 0 != strstr(keys, b" send_user \x00" as *const u8 as *const libc::c_char).is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1186,9 +1155,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != strstr(keys, b" send_pw \x00" as *const u8 as *const libc::c_char).is_null() - as libc::c_int as libc::c_long - { + if 0 != strstr(keys, b" send_pw \x00" as *const u8 as *const libc::c_char).is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1198,8 +1165,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != strstr(keys, b" send_port \x00" as *const u8 as *const libc::c_char).is_null() - as libc::c_int as libc::c_long + if 0 != strstr(keys, b" send_port \x00" as *const u8 as *const libc::c_char).is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1214,7 +1180,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" server_flags \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1229,7 +1195,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" imap_folder \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1244,7 +1210,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" displayname \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1259,7 +1225,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" selfstatus \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1274,7 +1240,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" selfavatar \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1289,7 +1255,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" e2ee_enabled \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1304,7 +1270,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" mdns_enabled \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1319,7 +1285,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" save_mime_headers \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1334,7 +1300,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_addr \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1349,7 +1315,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_mail_server \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1365,7 +1331,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_mail_user \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1381,7 +1347,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_mail_pw \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1396,7 +1362,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_mail_port \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1412,7 +1378,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_send_server \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1428,7 +1394,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_send_user \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1444,7 +1410,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_send_pw \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1459,7 +1425,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_send_port \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1475,7 +1441,7 @@ unsafe fn stress_functions(context: &dc_context_t) { keys, b" configured_server_flags \x00" as *const u8 as *const libc::c_char, ) - .is_null() as libc::c_int as libc::c_long + .is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1506,7 +1472,7 @@ unsafe fn stress_functions(context: &dc_context_t) { 0 as *mut *const libc::c_char, &mut base64, ); - if 0 != !(ok == 1i32) as libc::c_int as libc::c_long { + if 0 != !(ok == 1i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1520,7 +1486,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline, b"-----BEGIN PGP MESSAGE-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1553,7 +1519,7 @@ unsafe fn stress_functions(context: &dc_context_t) { 0 as *mut *const libc::c_char, &mut base64, ); - if 0 != !(ok == 1i32) as libc::c_int as libc::c_long { + if 0 != !(ok == 1i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1567,7 +1533,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline, b"-----BEGIN PGP MESSAGE-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1601,7 +1567,7 @@ unsafe fn stress_functions(context: &dc_context_t) { 0 as *mut *const libc::c_char, &mut base64, ); - if 0 != !(ok == 1i32) as libc::c_int as libc::c_long { + if 0 != !(ok == 1i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1615,7 +1581,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline, b"-----BEGIN PGP MESSAGE-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1627,7 +1593,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !setupcodebegin.is_null() as libc::c_int as libc::c_long { + if 0 != !setupcodebegin.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1656,7 +1622,7 @@ unsafe fn stress_functions(context: &dc_context_t) { 0 as *mut *const libc::c_char, &mut base64, ); - if 0 != !(ok == 0i32) as libc::c_int as libc::c_long { + if 0 != !(ok == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1677,7 +1643,7 @@ unsafe fn stress_functions(context: &dc_context_t) { 0 as *mut *const libc::c_char, &mut base64, ); - if 0 != !(ok == 1i32) as libc::c_int as libc::c_long { + if 0 != !(ok == 1i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1691,7 +1657,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline, b"-----BEGIN PGP MESSAGE-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1707,7 +1673,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( setupcodebegin, b"23\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1740,7 +1706,7 @@ unsafe fn stress_functions(context: &dc_context_t) { &mut preferencrypt, &mut base64, ); - if 0 != !(ok == 1i32) as libc::c_int as libc::c_long { + if 0 != !(ok == 1i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1754,7 +1720,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline, b"-----BEGIN PGP PRIVATE KEY BLOCK-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1770,7 +1736,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( preferencrypt, b"mutual\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1797,7 +1763,7 @@ unsafe fn stress_functions(context: &dc_context_t) { context, b"123422343234423452346234723482349234\x00" as *const u8 as *const libc::c_char, ); - if 0 != norm.is_null() as libc::c_int as libc::c_long { + if 0 != norm.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1810,7 +1776,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( norm, b"1234-2234-3234-4234-5234-6234-7234-8234-9234\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1828,7 +1794,7 @@ unsafe fn stress_functions(context: &dc_context_t) { b"\t1 2 3422343234- foo bar-- 423-45 2 34 6234723482349234 \x00" as *const u8 as *const libc::c_char, ); - if 0 != norm.is_null() as libc::c_int as libc::c_long { + if 0 != norm.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1841,7 +1807,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(strcmp( norm, b"1234-2234-3234-4234-5234-6234-7234-8234-9234\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1866,7 +1832,7 @@ unsafe fn stress_functions(context: &dc_context_t) { &mut setupcodebegin_0, &mut preferencrypt_0, 0 as *mut *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1882,7 +1848,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline_0, b"-----BEGIN PGP MESSAGE-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1897,7 +1863,7 @@ unsafe fn stress_functions(context: &dc_context_t) { if 0 != !(!setupcodebegin_0.is_null() && strlen(setupcodebegin_0) < strlen(S_EM_SETUPCODE) && strncmp(setupcodebegin_0, S_EM_SETUPCODE, strlen(setupcodebegin_0)) == 0i32) - as libc::c_int as libc::c_long + as usize { __assert_rtn((*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(), @@ -1907,7 +1873,7 @@ unsafe fn stress_functions(context: &dc_context_t) { as *const u8 as *const libc::c_char); } else { }; - if 0 != !preferencrypt_0.is_null() as libc::c_int as libc::c_long { + if 0 != !preferencrypt_0.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1919,7 +1885,7 @@ unsafe fn stress_functions(context: &dc_context_t) { }; free(buf_1 as *mut libc::c_void); buf_1 = dc_decrypt_setup_file(context, S_EM_SETUPCODE, S_EM_SETUPFILE); - if 0 != buf_1.is_null() as libc::c_int as libc::c_long { + if 0 != buf_1.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1937,7 +1903,7 @@ unsafe fn stress_functions(context: &dc_context_t) { &mut setupcodebegin_0, &mut preferencrypt_0, 0 as *mut *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1953,7 +1919,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline_0, b"-----BEGIN PGP PRIVATE KEY BLOCK-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1965,7 +1931,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !setupcodebegin_0.is_null() as libc::c_int as libc::c_long { + if 0 != !setupcodebegin_0.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -1979,7 +1945,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( preferencrypt_0, b"mutual\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -1996,7 +1962,7 @@ unsafe fn stress_functions(context: &dc_context_t) { let setupcode: *mut libc::c_char; let setupfile: *mut libc::c_char; setupcode = dc_create_setup_code(context); - if 0 != setupcode.is_null() as libc::c_int as libc::c_long { + if 0 != setupcode.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -2007,7 +1973,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !(strlen(setupcode) == 44) as libc::c_int as libc::c_long { + if 0 != !(strlen(setupcode) == 44) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -2024,8 +1990,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && *setupcode.offset(24isize) as libc::c_int == '-' as i32 && *setupcode.offset(29isize) as libc::c_int == '-' as i32 && *setupcode.offset(34isize) as libc::c_int == '-' as i32 - && *setupcode.offset(39isize) as libc::c_int == '-' as i32) - as libc::c_int as libc::c_long + && *setupcode.offset(39isize) as libc::c_int == '-' as i32) as usize { __assert_rtn((*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(), @@ -2036,7 +2001,7 @@ unsafe fn stress_functions(context: &dc_context_t) { } else { }; setupfile = dc_render_setup_file(context, setupcode); - if 0 != setupfile.is_null() as libc::c_int as libc::c_long { + if 0 != setupfile.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -2057,7 +2022,7 @@ unsafe fn stress_functions(context: &dc_context_t) { &mut setupcodebegin_1, 0 as *mut *const libc::c_char, 0 as *mut *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -2073,7 +2038,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline_1, b"-----BEGIN PGP MESSAGE-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -2087,8 +2052,7 @@ unsafe fn stress_functions(context: &dc_context_t) { }; if 0 != !(!setupcodebegin_1.is_null() && strlen(setupcodebegin_1) == 2 - && strncmp(setupcodebegin_1, setupcode, 2) == 0i32) as libc::c_int - as libc::c_long + && strncmp(setupcodebegin_1, setupcode, 2) == 0i32) as usize { __assert_rtn((*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(), @@ -2102,7 +2066,7 @@ unsafe fn stress_functions(context: &dc_context_t) { let payload: *mut libc::c_char; let mut headerline_2: *const libc::c_char = 0 as *const libc::c_char; payload = dc_decrypt_setup_file(context, setupcode, setupfile); - if 0 != payload.is_null() as libc::c_int as libc::c_long { + if 0 != payload.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -2120,7 +2084,7 @@ unsafe fn stress_functions(context: &dc_context_t) { 0 as *mut *const libc::c_char, 0 as *mut *const libc::c_char, 0 as *mut *const libc::c_char, - )) as libc::c_int as libc::c_long + )) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) @@ -2136,7 +2100,7 @@ unsafe fn stress_functions(context: &dc_context_t) { && strcmp( headerline_2, b"-----BEGIN PGP PRIVATE KEY BLOCK-----\x00" as *const u8 as *const libc::c_char, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn((*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(), @@ -2163,7 +2127,7 @@ unsafe fn stress_functions(context: &dc_context_t) { &mut *qr.offset(52isize), b"#a=\x00" as *const u8 as *const libc::c_char, 3, - ) == 0i32) as libc::c_int as libc::c_long + ) == 0i32) as usize { __assert_rtn((*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(), @@ -2174,7 +2138,7 @@ unsafe fn stress_functions(context: &dc_context_t) { } else { }; let mut res: *mut dc_lot_t = dc_check_qr(context, qr); - if 0 != res.is_null() as libc::c_int as libc::c_long { + if 0 != res.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -2185,7 +2149,7 @@ unsafe fn stress_functions(context: &dc_context_t) { } else { }; if 0 != !((*res).state == 200i32 || (*res).state == 220i32 || (*res).state == 230i32) - as libc::c_int as libc::c_long + as usize { __assert_rtn((*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(), @@ -2201,7 +2165,7 @@ unsafe fn stress_functions(context: &dc_context_t) { dc_check_qr(context, b"BEGIN:VCARD\nVERSION:3.0\nN:Last;First\nEMAIL;TYPE=INTERNET:stress@test.local\nEND:VCARD\x00" as *const u8 as *const libc::c_char); - if 0 != res.is_null() as libc::c_int as libc::c_long { + if 0 != res.is_null() as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -2211,7 +2175,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !((*res).state == 320i32) as libc::c_int as libc::c_long { + if 0 != !((*res).state == 320i32) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(), @@ -2221,7 +2185,7 @@ unsafe fn stress_functions(context: &dc_context_t) { ); } else { }; - if 0 != !((*res).id != 0i32 as libc::c_uint) as libc::c_int as libc::c_long { + if 0 != !((*res).id != 0i32 as libc::c_uint) as usize { __assert_rtn( (*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00")) .as_ptr(),