refactor: replace assert_rtn with assert macros

This commit is contained in:
dignifiedquire
2019-05-30 00:34:10 +02:00
parent 65b073b711
commit 8154781a0d
4 changed files with 311 additions and 1238 deletions

View File

@@ -310,18 +310,6 @@ pub unsafe fn dc_create_or_lookup_nchat_by_contact_id(
create_blocked,
(*contact).addr,
);
if 0 != !('K' as i32 == 'K' as i32) as usize {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 40], &[libc::c_char; 40]>(
b"dc_create_or_lookup_nchat_by_contact_id\x00",
))
.as_ptr(),
b"../src/dc_chat.c\x00" as *const u8 as *const libc::c_char,
1386i32,
b"DC_PARAM_SELFTALK==\'K\'\x00" as *const u8 as *const libc::c_char,
);
} else {
};
stmt = dc_sqlite3_prepare(context, &context.sql.clone().read().unwrap(), q);
if !stmt.is_null() {
if !(sqlite3_step(stmt) != 101i32) {

View File

@@ -726,58 +726,11 @@ pub unsafe fn dc_sqlite3_open(
as *const u8
as *const libc::c_char,
);
if 0 != !(DC_MOVE_STATE_UNDEFINED as libc::c_int == 0) as usize {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>(
b"dc_sqlite3_open\x00",
))
.as_ptr(),
b"../src/dc_sqlite3.c\x00" as *const u8 as *const libc::c_char,
559,
b"DC_MOVE_STATE_UNDEFINED == 0\x00" as *const u8
as *const libc::c_char,
);
} else {
};
if 0 != !(DC_MOVE_STATE_PENDING as libc::c_int == 1) as usize {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>(
b"dc_sqlite3_open\x00",
))
.as_ptr(),
b"../src/dc_sqlite3.c\x00" as *const u8 as *const libc::c_char,
560,
b"DC_MOVE_STATE_PENDING == 1\x00" as *const u8
as *const libc::c_char,
);
} else {
};
if 0 != !(DC_MOVE_STATE_STAY as libc::c_int == 2) as usize {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>(
b"dc_sqlite3_open\x00",
))
.as_ptr(),
b"../src/dc_sqlite3.c\x00" as *const u8 as *const libc::c_char,
561,
b"DC_MOVE_STATE_STAY == 2\x00" as *const u8
as *const libc::c_char,
);
} else {
};
if 0 != !(DC_MOVE_STATE_MOVING as libc::c_int == 3) as usize {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>(
b"dc_sqlite3_open\x00",
))
.as_ptr(),
b"../src/dc_sqlite3.c\x00" as *const u8 as *const libc::c_char,
562,
b"DC_MOVE_STATE_MOVING == 3\x00" as *const u8
as *const libc::c_char,
);
} else {
};
assert_eq!(DC_MOVE_STATE_UNDEFINED as libc::c_int, 0);
assert_eq!(DC_MOVE_STATE_PENDING as libc::c_int, 1);
assert_eq!(DC_MOVE_STATE_STAY as libc::c_int, 2);
assert_eq!(DC_MOVE_STATE_MOVING as libc::c_int, 3);
dbversion = 48;
dc_sqlite3_set_config_int(
context,
@@ -926,18 +879,7 @@ pub unsafe fn dc_sqlite3_open(
context.get_blobdir(),
);
dc_ensure_no_slash(repl_from);
if 0 != !('f' as i32 == 'f' as i32) as usize {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>(
b"dc_sqlite3_open\x00",
))
.as_ptr(),
b"../src/dc_sqlite3.c\x00" as *const u8 as *const libc::c_char,
656,
b"\'f\'==DC_PARAM_FILE\x00" as *const u8 as *const libc::c_char,
);
} else {
};
let mut q3: *mut libc::c_char =
sqlite3_mprintf(b"UPDATE msgs SET param=replace(param, \'f=%q/\', \'f=$BLOBDIR/\');\x00"
as *const u8 as
@@ -945,19 +887,6 @@ pub unsafe fn dc_sqlite3_open(
repl_from);
dc_sqlite3_execute(context, sql, q3);
sqlite3_free(q3 as *mut libc::c_void);
if 0 != !('i' as i32 == 'i' as i32) as usize {
__assert_rtn(
(*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>(
b"dc_sqlite3_open\x00",
))
.as_ptr(),
b"../src/dc_sqlite3.c\x00" as *const u8 as *const libc::c_char,
661,
b"\'i\'==DC_PARAM_PROFILE_IMAGE\x00" as *const u8
as *const libc::c_char,
);
} else {
};
q3 =
sqlite3_mprintf(b"UPDATE chats SET param=replace(param, \'i=%q/\', \'i=$BLOBDIR/\');\x00"
as *const u8 as

View File

@@ -58,37 +58,12 @@ extern "C" {
_: ::std::ffi::VaList,
) -> libc::c_int;
#[cfg(target_os = "macos")]
pub fn __assert_rtn(
_: *const libc::c_char,
_: *const libc::c_char,
_: libc::c_int,
_: *const libc::c_char,
) -> !;
#[cfg(not(target_os = "macos"))]
fn __assert(
_: *const libc::c_char,
_: *const libc::c_char,
_: libc::c_int,
_: *const libc::c_char,
) -> !;
// -- DC Methods
pub fn dc_strbuilder_catf(_: *mut dc_strbuilder_t, format: *const libc::c_char, _: ...);
pub fn dc_mprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char;
}
#[cfg(not(target_os = "macos"))]
pub unsafe extern "C" fn __assert_rtn(
a: *const libc::c_char,
b: *const libc::c_char,
c: libc::c_int,
d: *const libc::c_char,
) -> ! {
__assert(a, b, c, d)
}
#[cfg(not(target_os = "android"))]
pub use libc::atof;