Replace types that use only 0 and 1 with bool (#18) (#58)

* Start replacing int with bool where possible (#18)

* Continue replacing int with bool where possible (#18)

* Continue replacing int with bool where possible (#18)

* Run fmt
This commit is contained in:
Hocuri
2019-05-11 12:07:09 +02:00
committed by Lars-Magnus Skog
parent 7266b64c66
commit 569c924a0c
17 changed files with 196 additions and 208 deletions

View File

@@ -173,7 +173,7 @@ pub unsafe fn dc_get_oauth2_access_token(
let l = lock.lock().unwrap();
// read generated token
if 0 == flags & 0x1i32 && 0 == is_expired(context) {
if 0 == flags & 0x1i32 && !is_expired(context) {
access_token = dc_sqlite3_get_config(
context,
&context.sql.clone().read().unwrap(),
@@ -488,8 +488,7 @@ unsafe extern "C" fn jsoneq(
-1
}
// TODO should return bool /rtn
unsafe fn is_expired(context: &dc_context_t) -> libc::c_int {
unsafe fn is_expired(context: &dc_context_t) -> bool {
let expire_timestamp: time_t = dc_sqlite3_get_config_int64(
context,
&context.sql.clone().read().unwrap(),
@@ -497,13 +496,13 @@ unsafe fn is_expired(context: &dc_context_t) -> libc::c_int {
0i32 as int64_t,
) as time_t;
if expire_timestamp <= 0i32 as libc::c_long {
return 0i32;
return false;
}
if expire_timestamp > time(0 as *mut time_t) {
return 0i32;
return false;
}
1
true
}
pub unsafe fn dc_get_oauth2_addr(