Merge 'Fix platform specific FFI C pointer type casts' from Preston Thorpe

Fixes #1159

Closes #1170
This commit is contained in:
Pekka Enberg
2025-03-25 09:10:16 +02:00
3 changed files with 4 additions and 4 deletions

View File

@@ -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())

View File

@@ -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,

View File

@@ -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()
}
}