chore: fix compiler warnings (mut + unused assignments) (#40)

* Stop allowing unused assignments

* test: remove unused assignments in cmdline

* chore: fix compiler warnings in dc_tools.rs

* chore: fix compiler warnings in dc_token.rs

* chore: fix compiler warnings in dc_strencode.rs

* chore: fix compiler warnings in dc_stock.rs

* chore: fix compiler warnings in dc_sqlite3.rs

* chore: fix compiler warnings in dc_simplify.rs

* chore: fix compiler warnings in dc_securejoin.rs

* chore: fix compiler warnings in dc_saxparser.rs

* chore: fix compiler warnings in dc_pgp.rs

* chore: fix compiler warnings in dc_param.rs

* chore: fix compiler warnings in dc_oauth2.rs

* chore: fix compiler warnings in dc_msg.rs

* chore: fix compiler warnings in dc_mimeparser.rs

* chore: fix compiler warnings in dc_mimefactory.rs

* chore: fix compiler warnings in dc_lot.rs

* chore: fix compiler warnings in dc_loginparams.rs

* chore: fix compiler warnings in dc_log.rs

* chore: fix compiler warnings in dc_location.rs

* chore: fix compiler warnings in dc_keyring.rs

* chore: fix compiler warnings in dc_key.rs

* chore: fix compiler warnings in dc_jsmn.rs

* chore: fix compiler warnings in dc_jobthread.rs

* chore: fix compiler warnings in dc_imex.rs

* chore: fix compiler warnings in dc_hash.rs

* chore: fix compiler warnings in dc_e2ee.rs

* chore: fix compiler warnings in dc_context.rs

* chore: fix compiler warnings in dc_contact.rs

* chore: fix compiler warnings in dc_chatlist.rs

* chore: fix compiler warnings in dc_chat.rs

* chore: fix compiler warnings in dc_array.rs

* chore: fix compiler warnings in dc_apeerstate.rs

* chore: fix compiler warnings in dc_aheader.rs

* chore: fix compiler warnings in dc_array.rs

* test: remove compiler warnings in test/stress.rs

* test: reduce compiler warnings in examples/repl/main.rs

* test: std:🧵:sleep_ms() is deprecated

* chore: remove unused variable in dc_sqlite3.rs

* chore: fix compiler warnings in dc_receive_imf.rs

* chore: fix compiler warnings in dc_job.rs

* chore: fix compiler warnings in dc_configure.rs

* Fix formatting
This commit is contained in:
Lars-Magnus Skog
2019-05-05 21:58:59 +02:00
committed by Friedel Ziegelmayer
parent 67f1d67de7
commit 2cf6cde5d1
40 changed files with 1635 additions and 888 deletions

View File

@@ -23,13 +23,15 @@ pub struct dc_loginparam_t {
}
pub unsafe fn dc_loginparam_new() -> *mut dc_loginparam_t {
let mut loginparam: *mut dc_loginparam_t = 0 as *mut dc_loginparam_t;
let mut loginparam: *mut dc_loginparam_t;
loginparam = calloc(1, ::std::mem::size_of::<dc_loginparam_t>()) as *mut dc_loginparam_t;
if loginparam.is_null() {
exit(22i32);
}
return loginparam;
loginparam
}
pub unsafe fn dc_loginparam_unref(mut loginparam: *mut dc_loginparam_t) {
if loginparam.is_null() {
return;
@@ -37,6 +39,7 @@ pub unsafe fn dc_loginparam_unref(mut loginparam: *mut dc_loginparam_t) {
dc_loginparam_empty(loginparam);
free(loginparam as *mut libc::c_void);
}
/* clears all data and frees its memory. All pointers are NULL after this function is called. */
pub unsafe fn dc_loginparam_empty(mut loginparam: *mut dc_loginparam_t) {
if loginparam.is_null() {
@@ -60,6 +63,7 @@ pub unsafe fn dc_loginparam_empty(mut loginparam: *mut dc_loginparam_t) {
(*loginparam).send_pw = 0 as *mut libc::c_char;
(*loginparam).server_flags = 0i32;
}
pub unsafe fn dc_loginparam_read(
context: &dc_context_t,
loginparam: *mut dc_loginparam_t,
@@ -140,6 +144,7 @@ pub unsafe fn dc_loginparam_read(
(*loginparam).server_flags = dc_sqlite3_get_config_int(context, sql, key, 0i32);
sqlite3_free(key as *mut libc::c_void);
}
pub unsafe fn dc_loginparam_write(
context: &dc_context_t,
loginparam: *const dc_loginparam_t,
@@ -219,6 +224,7 @@ pub unsafe fn dc_loginparam_write(
dc_sqlite3_set_config_int(context, sql, key, (*loginparam).server_flags);
sqlite3_free(key as *mut libc::c_void);
}
pub unsafe fn dc_loginparam_get_readable(
mut loginparam: *const dc_loginparam_t,
) -> *mut libc::c_char {
@@ -270,8 +276,10 @@ pub unsafe fn dc_loginparam_get_readable(
flags_readable,
);
free(flags_readable as *mut libc::c_void);
return ret;
ret
}
unsafe fn get_readable_flags(mut flags: libc::c_int) -> *mut libc::c_char {
let mut strbuilder: dc_strbuilder_t = dc_strbuilder_t {
buf: 0 as *mut libc::c_char,
@@ -358,5 +366,6 @@ unsafe fn get_readable_flags(mut flags: libc::c_int) -> *mut libc::c_char {
);
}
dc_trim(strbuilder.buf);
return strbuilder.buf;
strbuilder.buf
}