Return bool from dc_continue_key_transfer

This commit is contained in:
Alexander Krotov
2019-09-10 13:53:32 +03:00
committed by holger krekel
parent d0960f7f7f
commit 6a2368f83c
3 changed files with 5 additions and 6 deletions

View File

@@ -1288,7 +1288,7 @@ pub unsafe extern "C" fn dc_continue_key_transfer(
let context = &*context;
dc_imex::dc_continue_key_transfer(context, msg_id, setup_code)
dc_imex::dc_continue_key_transfer(context, msg_id, setup_code) as libc::c_int
}
#[no_mangle]

View File

@@ -496,7 +496,7 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
!arg1.is_empty() && !arg2.is_empty(),
"Arguments <msg-id> <setup-code> expected"
);
if 0 == dc_continue_key_transfer(context, arg1.parse()?, arg2_c) {
if !dc_continue_key_transfer(context, arg1.parse()?, arg2_c) {
bail!("Continue key transfer failed");
}
}

View File

@@ -268,13 +268,12 @@ pub fn dc_create_setup_code(_context: &Context) -> String {
ret
}
// TODO should return bool /rtn
pub unsafe fn dc_continue_key_transfer(
context: &Context,
msg_id: uint32_t,
setup_code: *const libc::c_char,
) -> libc::c_int {
let mut success: libc::c_int = 0i32;
) -> bool {
let mut success = false;
let mut filename: *mut libc::c_char = ptr::null_mut();
let mut filecontent: *mut libc::c_char = ptr::null_mut();
let mut filebytes: size_t = 0i32 as size_t;
@@ -313,7 +312,7 @@ pub unsafe fn dc_continue_key_transfer(
} else if set_self_key(context, armored_key, 1) {
/*set default*/
/* error already logged */
success = 1i32
success = true
}
}
}