mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 13:26:38 +03:00
refactor: replace assert_rtn with assert macros
This commit is contained in:
@@ -310,18 +310,6 @@ pub unsafe fn dc_create_or_lookup_nchat_by_contact_id(
|
|||||||
create_blocked,
|
create_blocked,
|
||||||
(*contact).addr,
|
(*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);
|
stmt = dc_sqlite3_prepare(context, &context.sql.clone().read().unwrap(), q);
|
||||||
if !stmt.is_null() {
|
if !stmt.is_null() {
|
||||||
if !(sqlite3_step(stmt) != 101i32) {
|
if !(sqlite3_step(stmt) != 101i32) {
|
||||||
|
|||||||
@@ -726,58 +726,11 @@ pub unsafe fn dc_sqlite3_open(
|
|||||||
as *const u8
|
as *const u8
|
||||||
as *const libc::c_char,
|
as *const libc::c_char,
|
||||||
);
|
);
|
||||||
if 0 != !(DC_MOVE_STATE_UNDEFINED as libc::c_int == 0) as usize {
|
assert_eq!(DC_MOVE_STATE_UNDEFINED as libc::c_int, 0);
|
||||||
__assert_rtn(
|
assert_eq!(DC_MOVE_STATE_PENDING as libc::c_int, 1);
|
||||||
(*::std::mem::transmute::<&[u8; 16], &[libc::c_char; 16]>(
|
assert_eq!(DC_MOVE_STATE_STAY as libc::c_int, 2);
|
||||||
b"dc_sqlite3_open\x00",
|
assert_eq!(DC_MOVE_STATE_MOVING as libc::c_int, 3);
|
||||||
))
|
|
||||||
.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 {
|
|
||||||
};
|
|
||||||
dbversion = 48;
|
dbversion = 48;
|
||||||
dc_sqlite3_set_config_int(
|
dc_sqlite3_set_config_int(
|
||||||
context,
|
context,
|
||||||
@@ -926,18 +879,7 @@ pub unsafe fn dc_sqlite3_open(
|
|||||||
context.get_blobdir(),
|
context.get_blobdir(),
|
||||||
);
|
);
|
||||||
dc_ensure_no_slash(repl_from);
|
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 =
|
let mut q3: *mut libc::c_char =
|
||||||
sqlite3_mprintf(b"UPDATE msgs SET param=replace(param, \'f=%q/\', \'f=$BLOBDIR/\');\x00"
|
sqlite3_mprintf(b"UPDATE msgs SET param=replace(param, \'f=%q/\', \'f=$BLOBDIR/\');\x00"
|
||||||
as *const u8 as
|
as *const u8 as
|
||||||
@@ -945,19 +887,6 @@ pub unsafe fn dc_sqlite3_open(
|
|||||||
repl_from);
|
repl_from);
|
||||||
dc_sqlite3_execute(context, sql, q3);
|
dc_sqlite3_execute(context, sql, q3);
|
||||||
sqlite3_free(q3 as *mut libc::c_void);
|
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 =
|
q3 =
|
||||||
sqlite3_mprintf(b"UPDATE chats SET param=replace(param, \'i=%q/\', \'i=$BLOBDIR/\');\x00"
|
sqlite3_mprintf(b"UPDATE chats SET param=replace(param, \'i=%q/\', \'i=$BLOBDIR/\');\x00"
|
||||||
as *const u8 as
|
as *const u8 as
|
||||||
|
|||||||
25
src/x.rs
25
src/x.rs
@@ -58,37 +58,12 @@ extern "C" {
|
|||||||
_: ::std::ffi::VaList,
|
_: ::std::ffi::VaList,
|
||||||
) -> libc::c_int;
|
) -> 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
|
// -- DC Methods
|
||||||
|
|
||||||
pub fn dc_strbuilder_catf(_: *mut dc_strbuilder_t, format: *const libc::c_char, _: ...);
|
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;
|
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"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
pub use libc::atof;
|
pub use libc::atof;
|
||||||
|
|
||||||
|
|||||||
1429
tests/stress.rs
1429
tests/stress.rs
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user