Fix compilation errors

This commit is contained in:
gwenn
2020-02-09 12:08:25 +01:00
parent 9e17a0b28e
commit 4d58a43b38
2 changed files with 23 additions and 14 deletions

View File

@@ -59,7 +59,11 @@ impl InnerConnection {
}
}
pub fn open_with_flags(c_path: &CString, flags: OpenFlags, vfs: Option(&CString)) -> Result<InnerConnection> {
pub fn open_with_flags(
c_path: &CString,
flags: OpenFlags,
vfs: Option<&CString>,
) -> Result<InnerConnection> {
#[cfg(not(feature = "bundled"))]
ensure_valid_sqlite_version();
ensure_safe_sqlite_threading_mode()?;
@@ -79,15 +83,14 @@ impl InnerConnection {
));
}
z_vfs = match(vfs) {
let z_vfs = match vfs {
Some(c_vfs) => c_vfs.as_ptr(),
None => ptr::null()
}
None => ptr::null(),
};
unsafe {
let mut db = MaybeUninit::uninit();
let r =
ffi::sqlite3_open_v2(c_path.as_ptr(), db.as_mut_ptr(), flags.bits(), z_vfs);
let r = ffi::sqlite3_open_v2(c_path.as_ptr(), db.as_mut_ptr(), flags.bits(), z_vfs);
let db: *mut ffi::sqlite3 = db.assume_init();
if r != ffi::SQLITE_OK {
let e = if db.is_null() {