From 1cdb9c733a15e03a6b9580b2afab279485d40b05 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Tue, 10 Sep 2019 16:09:34 +0000 Subject: [PATCH] Change return type of `dc_is_configured' to bool --- deltachat-ffi/src/lib.rs | 2 +- src/configure/mod.rs | 6 +++--- src/dc_imex.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index bdb89109e..0022b70fc 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -233,7 +233,7 @@ pub unsafe extern "C" fn dc_is_configured(context: *mut dc_context_t) -> libc::c let context = &*context; - configure::dc_is_configured(context) + configure::dc_is_configured(context) as libc::c_int } #[no_mangle] diff --git a/src/configure/mod.rs b/src/configure/mod.rs index e230ce9c0..86b5274fd 100644 --- a/src/configure/mod.rs +++ b/src/configure/mod.rs @@ -45,16 +45,16 @@ pub unsafe fn configure(context: &Context) { } /// Check if the context is already configured. -pub fn dc_is_configured(context: &Context) -> libc::c_int { +pub fn dc_is_configured(context: &Context) -> bool { if context .sql .get_config_int(context, "configured") .unwrap_or_default() > 0 { - 1 + true } else { - 0 + false } } diff --git a/src/dc_imex.rs b/src/dc_imex.rs index d9d785ba5..2222d0a4b 100644 --- a/src/dc_imex.rs +++ b/src/dc_imex.rs @@ -581,7 +581,7 @@ unsafe fn import_backup(context: &Context, backup_to_import: *const libc::c_char .map_or("<>", |p| p.to_str().unwrap()) ); - if 0 != dc_is_configured(context) { + if dc_is_configured(context) { error!(context, 0, "Cannot import backups to accounts in use."); return 0; }