mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-29 16:41:33 +00:00
Improve portability of code by using c_char
This commit is contained in:
@ -7,6 +7,7 @@ use libc::{
|
|||||||
accept,
|
accept,
|
||||||
access,
|
access,
|
||||||
bind,
|
bind,
|
||||||
|
c_char,
|
||||||
c_int,
|
c_int,
|
||||||
c_ulong,
|
c_ulong,
|
||||||
c_void,
|
c_void,
|
||||||
@ -1063,14 +1064,14 @@ pub fn ___syscall220(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 {
|
|||||||
let upper_bound = std::cmp::min((*dirent).d_reclen, 255) as usize;
|
let upper_bound = std::cmp::min((*dirent).d_reclen, 255) as usize;
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < upper_bound {
|
while i < upper_bound {
|
||||||
*(dirp.add(pos + 11 + i) as *mut i8) = (*dirent).d_name[i] as _;
|
*(dirp.add(pos + 11 + i) as *mut c_char) = (*dirent).d_name[i] as c_char;
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
// We set the termination string char
|
// We set the termination string char
|
||||||
*(dirp.add(pos + 11 + i) as *mut i8) = 0 as i8;
|
*(dirp.add(pos + 11 + i) as *mut c_char) = 0 as c_char;
|
||||||
debug!(
|
debug!(
|
||||||
" => file {}",
|
" => file {}",
|
||||||
CStr::from_ptr(dirp.add(pos + 11) as *const i8)
|
CStr::from_ptr(dirp.add(pos + 11) as *const c_char)
|
||||||
.to_str()
|
.to_str()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user