mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-07 18:24:20 +01:00
Merge 'Fix platform specific FFI C pointer type casts' from Preston Thorpe
Fixes #1159 Closes #1170
This commit is contained in:
@@ -65,7 +65,7 @@ pub(crate) unsafe extern "C" fn register_vfs(
|
||||
if name.is_null() || vfs.is_null() {
|
||||
return ResultCode::Error;
|
||||
}
|
||||
let c_str = unsafe { CString::from_raw(name as *mut i8) };
|
||||
let c_str = unsafe { CString::from_raw(name as *mut _) };
|
||||
let name_str = match c_str.to_str() {
|
||||
Ok(s) => s.to_string(),
|
||||
Err(_) => return ResultCode::Error,
|
||||
@@ -116,7 +116,7 @@ pub fn add_builtin_vfs_extensions(
|
||||
}
|
||||
let vfsimpl = unsafe { &**vfs };
|
||||
let name = unsafe {
|
||||
CString::from_raw(vfsimpl.name as *mut i8)
|
||||
CString::from_raw(vfsimpl.name as *mut _)
|
||||
.to_str()
|
||||
.map_err(|_| {
|
||||
LimboError::ExtensionError("unable to register vfs extension".to_string())
|
||||
|
||||
@@ -68,7 +68,7 @@ pub(crate) unsafe extern "C" fn register_vtab_module(
|
||||
if name.is_null() || ctx.is_null() {
|
||||
return ResultCode::Error;
|
||||
}
|
||||
let c_str = unsafe { CString::from_raw(name as *mut i8) };
|
||||
let c_str = unsafe { CString::from_raw(name as *mut _) };
|
||||
let name_str = match c_str.to_str() {
|
||||
Ok(s) => s.to_string(),
|
||||
Err(_) => return ResultCode::Error,
|
||||
|
||||
@@ -48,7 +48,7 @@ impl IO for VfsMod {
|
||||
unsafe {
|
||||
let vfs = &*self.ctx;
|
||||
let chars = (vfs.current_time)();
|
||||
let cstr = CString::from_raw(chars as *mut i8);
|
||||
let cstr = CString::from_raw(chars as *mut _);
|
||||
cstr.to_string_lossy().into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user