mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 03:16:29 +03:00
feat: use libsqlite3-sys
This commit is contained in:
@@ -17,5 +17,5 @@ pub unsafe extern "C" fn dc_add_to_keyhistory(
|
||||
mut addr: *const libc::c_char,
|
||||
mut fingerprint: *const libc::c_char,
|
||||
) {
|
||||
unimplemented!()
|
||||
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ pub struct dc_sqlite3_t {
|
||||
pub context: *mut dc_context_t,
|
||||
}
|
||||
|
||||
pub type sqlite3_destructor_type = Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_sqlite3_new(mut context: *mut dc_context_t) -> *mut dc_sqlite3_t {
|
||||
let mut sql: *mut dc_sqlite3_t = 0 as *mut dc_sqlite3_t;
|
||||
@@ -963,7 +961,8 @@ pub unsafe extern "C" fn dc_sqlite3_log_error(
|
||||
if sql.is_null() || msg_format.is_null() {
|
||||
return;
|
||||
}
|
||||
msg = sqlite3_vmprintf(msg_format, va);
|
||||
// FIXME: evil transmute
|
||||
msg = sqlite3_vmprintf(msg_format, std::mem::transmute(va));
|
||||
dc_log_error(
|
||||
(*sql).context,
|
||||
0i32,
|
||||
|
||||
@@ -6,18 +6,17 @@ use crate::dc_imap::dc_imap_t;
|
||||
use crate::dc_sqlite3::dc_sqlite3_t;
|
||||
use crate::x::*;
|
||||
|
||||
pub use libsqlite3_sys::*;
|
||||
|
||||
extern "C" {
|
||||
pub type __sFILEX;
|
||||
|
||||
pub type _telldir;
|
||||
pub type mailstream_cancel;
|
||||
pub type sqlite3;
|
||||
pub type sqlite3_stmt;
|
||||
}
|
||||
|
||||
pub type sqlite_int64 = libc::c_longlong;
|
||||
pub type sqlite3_int64 = sqlite_int64;
|
||||
pub type sqlite3_destructor_type = Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>;
|
||||
|
||||
pub type useconds_t = __darwin_useconds_t;
|
||||
pub type int32_t = libc::c_int;
|
||||
|
||||
58
src/x.rs
58
src/x.rs
@@ -641,62 +641,4 @@ extern "C" {
|
||||
|
||||
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;
|
||||
|
||||
// -- Sqlite3
|
||||
|
||||
pub fn sqlite3_bind_blob(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_void,
|
||||
n: libc::c_int,
|
||||
_: Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_bind_int64(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: sqlite3_int64,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_bind_text(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_char,
|
||||
_: libc::c_int,
|
||||
_: Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_step(_: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn sqlite3_column_int(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_column_int64(_: *mut sqlite3_stmt, iCol: libc::c_int) -> sqlite3_int64;
|
||||
pub fn sqlite3_column_text(_: *mut sqlite3_stmt, iCol: libc::c_int) -> *const libc::c_uchar;
|
||||
pub fn sqlite3_column_type(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_finalize(pStmt: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn sqlite3_bind_int(_: *mut sqlite3_stmt, _: libc::c_int, _: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_column_blob(_: *mut sqlite3_stmt, iCol: libc::c_int) -> *const libc::c_void;
|
||||
pub fn sqlite3_column_bytes(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_reset(pStmt: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn sqlite3_mprintf(_: *const libc::c_char, _: ...) -> *mut libc::c_char;
|
||||
pub fn sqlite3_free(_: *mut libc::c_void);
|
||||
pub fn sqlite3_bind_double(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: libc::c_double,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_column_double(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_double;
|
||||
pub fn sqlite3_threadsafe() -> libc::c_int;
|
||||
pub fn sqlite3_close(_: *mut sqlite3) -> libc::c_int;
|
||||
pub fn sqlite3_busy_timeout(_: *mut sqlite3, ms: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_vmprintf(_: *const libc::c_char, _: ::std::ffi::VaList) -> *mut libc::c_char;
|
||||
pub fn sqlite3_open_v2(
|
||||
filename: *const libc::c_char,
|
||||
ppDb: *mut *mut sqlite3,
|
||||
flags: libc::c_int,
|
||||
zVfs: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_errmsg(_: *mut sqlite3) -> *const libc::c_char;
|
||||
pub fn sqlite3_prepare_v2(
|
||||
db: *mut sqlite3,
|
||||
zSql: *const libc::c_char,
|
||||
nByte: libc::c_int,
|
||||
ppStmt: *mut *mut sqlite3_stmt,
|
||||
pzTail: *mut *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user