mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 18:36:30 +03:00
feat(examples): refactor repl to use rustyline and safe rust
This commit is contained in:
@@ -740,7 +740,7 @@ unsafe fn prepare_msg_raw(
|
||||
VALUES (?,?,?, ?,?,1);\x00" as *const u8
|
||||
as *const libc::c_char,
|
||||
);
|
||||
sqlite3_bind_int64(stmt, 1, timestamp as libc::int64_t);
|
||||
sqlite3_bind_int64(stmt, 1, timestamp as i64);
|
||||
sqlite3_bind_int(stmt, 2, DC_CONTACT_ID_SELF as libc::c_int);
|
||||
sqlite3_bind_int(stmt, 3, (*chat).id as libc::c_int);
|
||||
sqlite3_bind_double(
|
||||
|
||||
@@ -96,10 +96,10 @@ macro_rules! info {
|
||||
};
|
||||
($ctx:expr, $data1:expr, $msg:expr, $($args:expr),* $(,)?) => {{
|
||||
let formatted = format!($msg, $($args),*);
|
||||
let formatted_c = crate::dc_tools::to_cstring(formatted);
|
||||
let formatted_c = $crate::dc_tools::to_cstring(formatted);
|
||||
unsafe {
|
||||
($ctx.cb)($ctx, crate::constants::Event::INFO, $data1 as uintptr_t,
|
||||
crate::dc_tools::dc_strdup(formatted_c.as_ptr()) as uintptr_t)
|
||||
($ctx.cb)($ctx, $crate::constants::Event::INFO, $data1 as uintptr_t,
|
||||
$crate::dc_tools::dc_strdup(formatted_c.as_ptr()) as uintptr_t)
|
||||
}
|
||||
}};
|
||||
}
|
||||
@@ -111,10 +111,10 @@ macro_rules! warn {
|
||||
};
|
||||
($ctx:expr, $data1:expr, $msg:expr, $($args:expr),* $(,)?) => {
|
||||
let formatted = format!($msg, $($args),*);
|
||||
let formatted_c = crate::dc_tools::to_cstring(formatted);
|
||||
let formatted_c = $crate::dc_tools::to_cstring(formatted);
|
||||
unsafe {
|
||||
($ctx.cb)($ctx, crate::constants::Event::WARNING, $data1 as libc::uintptr_t,
|
||||
crate::dc_tools::dc_strdup(formatted_c.as_ptr()) as libc::uintptr_t)
|
||||
($ctx.cb)($ctx, $crate::constants::Event::WARNING, $data1 as libc::uintptr_t,
|
||||
$crate::dc_tools::dc_strdup(formatted_c.as_ptr()) as libc::uintptr_t)
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -126,10 +126,10 @@ macro_rules! error {
|
||||
};
|
||||
($ctx:expr, $data1:expr, $msg:expr, $($args:expr),* $(,)?) => {
|
||||
let formatted = format!($msg, $($args),*);
|
||||
let formatted_c = crate::dc_tools::to_cstring(formatted);
|
||||
let formatted_c = $crate::dc_tools::to_cstring(formatted);
|
||||
unsafe {
|
||||
($ctx.cb)($ctx, crate::constants::Event::ERROR, $data1 as uintptr_t,
|
||||
crate::dc_tools::dc_strdup(formatted_c.as_ptr()) as uintptr_t)
|
||||
($ctx.cb)($ctx, $crate::constants::Event::ERROR, $data1 as uintptr_t,
|
||||
$crate::dc_tools::dc_strdup(formatted_c.as_ptr()) as uintptr_t)
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -141,10 +141,10 @@ macro_rules! log_event {
|
||||
};
|
||||
($ctx:expr, $event:expr, $data1:expr, $msg:expr, $($args:expr),* $(,)?) => {
|
||||
let formatted = format!($msg, $($args),*);
|
||||
let formatted_c = crate::dc_tools::to_cstring(formatted);
|
||||
let formatted_c = $crate::dc_tools::to_cstring(formatted);
|
||||
unsafe {
|
||||
($ctx.cb)($ctx, $event, $data1 as uintptr_t,
|
||||
crate::dc_tools::dc_strdup(formatted_c.as_ptr()) as uintptr_t)
|
||||
$crate::dc_tools::dc_strdup(formatted_c.as_ptr()) as uintptr_t)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,15 +38,15 @@ pub type dc_set_config_t =
|
||||
pub type dc_get_config_t =
|
||||
unsafe fn(_: &Context, _: *const libc::c_char, _: *const libc::c_char) -> *mut libc::c_char;
|
||||
|
||||
pub type sqlite_int64 = libc::int64_t;
|
||||
pub type sqlite_int64 = i64;
|
||||
pub type sqlite3_int64 = sqlite_int64;
|
||||
|
||||
pub type int32_t = libc::int32_t;
|
||||
pub type int64_t = libc::int64_t;
|
||||
pub type int32_t = i32;
|
||||
pub type int64_t = i64;
|
||||
pub type uintptr_t = libc::uintptr_t;
|
||||
pub type size_t = libc::size_t;
|
||||
pub type ssize_t = libc::ssize_t;
|
||||
pub type uint32_t = libc::c_uint;
|
||||
pub type uint8_t = libc::c_uchar;
|
||||
pub type uint16_t = libc::c_ushort;
|
||||
pub type uint64_t = libc::uint64_t;
|
||||
pub type uint64_t = u64;
|
||||
|
||||
Reference in New Issue
Block a user