Skip to content

Commit c7b2363

Browse files
authored
Fix compilation on armv7-sony-vita-newlibeabihf. (#1350)
* Fix compilation on armv7-sony-vita-newlibeabihf. * Fix warnings.
1 parent 471935d commit c7b2363

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/backend/libc/fs/dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl Dir {
207207
#[cfg(any(freebsdlike, netbsdlike))]
208208
d_fileno: dirent.d_fileno,
209209

210-
name: CStr::from_ptr(dirent.d_name.as_ptr()).to_owned(),
210+
name: CStr::from_ptr(dirent.d_name.as_ptr().cast()).to_owned(),
211211
};
212212

213213
Some(Ok(result))

src/backend/libc/fs/syscalls.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ use crate::backend::c;
55
use crate::backend::conv::ret_usize;
66
use crate::backend::conv::{borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd};
77
use crate::fd::{BorrowedFd, OwnedFd};
8+
#[allow(unused_imports)]
9+
use crate::ffi;
10+
use crate::ffi::CStr;
811
#[cfg(all(apple, feature = "alloc"))]
912
use crate::ffi::CString;
10-
use crate::ffi::{self, CStr};
1113
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
1214
use crate::fs::Access;
1315
#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
@@ -273,13 +275,7 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
273275
#[cfg(feature = "alloc")]
274276
#[inline]
275277
pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
276-
unsafe {
277-
ret_usize(c::readlink(
278-
c_str(path),
279-
buf.as_mut_ptr().cast::<ffi::c_char>(),
280-
buf.len(),
281-
) as isize)
282-
}
278+
unsafe { ret_usize(c::readlink(c_str(path), buf.as_mut_ptr().cast(), buf.len()) as isize) }
283279
}
284280

285281
#[cfg(not(target_os = "redox"))]
@@ -293,7 +289,7 @@ pub(crate) fn readlinkat(
293289
ret_usize(c::readlinkat(
294290
borrowed_fd(dirfd),
295291
c_str(path),
296-
buf.as_mut_ptr().cast::<ffi::c_char>(),
292+
buf.as_mut_ptr().cast(),
297293
buf.len(),
298294
) as isize)
299295
}

0 commit comments

Comments
 (0)