mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
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:
committed by
Friedel Ziegelmayer
parent
67f1d67de7
commit
2cf6cde5d1
@@ -15,13 +15,15 @@ pub struct dc_keyring_t {
|
||||
}
|
||||
|
||||
pub unsafe fn dc_keyring_new() -> *mut dc_keyring_t {
|
||||
let mut keyring: *mut dc_keyring_t = 0 as *mut dc_keyring_t;
|
||||
let mut keyring: *mut dc_keyring_t;
|
||||
keyring = calloc(1, ::std::mem::size_of::<dc_keyring_t>()) as *mut dc_keyring_t;
|
||||
if keyring.is_null() {
|
||||
exit(42i32);
|
||||
}
|
||||
return keyring;
|
||||
|
||||
keyring
|
||||
}
|
||||
|
||||
pub unsafe fn dc_keyring_unref(mut keyring: *mut dc_keyring_t) {
|
||||
if keyring.is_null() {
|
||||
return;
|
||||
@@ -34,6 +36,7 @@ pub unsafe fn dc_keyring_unref(mut keyring: *mut dc_keyring_t) {
|
||||
free((*keyring).keys as *mut libc::c_void);
|
||||
free(keyring as *mut libc::c_void);
|
||||
}
|
||||
|
||||
/* the reference counter of the key is increased by one */
|
||||
pub unsafe fn dc_keyring_add(mut keyring: *mut dc_keyring_t, mut to_add: *mut dc_key_t) {
|
||||
if keyring.is_null() || to_add.is_null() {
|
||||
@@ -54,12 +57,15 @@ pub unsafe fn dc_keyring_add(mut keyring: *mut dc_keyring_t, mut to_add: *mut dc
|
||||
*fresh0 = dc_key_ref(to_add);
|
||||
(*keyring).count += 1;
|
||||
}
|
||||
|
||||
// TODO should return bool? /rtn
|
||||
pub unsafe fn dc_keyring_load_self_private_for_decrypting(
|
||||
context: &dc_context_t,
|
||||
keyring: *mut dc_keyring_t,
|
||||
self_addr: *const libc::c_char,
|
||||
sql: &dc_sqlite3_t,
|
||||
) -> libc::c_int {
|
||||
// Can we prevent keyring and self_addr to be null?
|
||||
if keyring.is_null() || self_addr.is_null() {
|
||||
return 0i32;
|
||||
}
|
||||
@@ -78,5 +84,6 @@ pub unsafe fn dc_keyring_load_self_private_for_decrypting(
|
||||
dc_key_unref(key);
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
return 1i32;
|
||||
|
||||
1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user