diff options
Diffstat (limited to 'ctr-std/src/sys/unix/fs.rs')
| -rw-r--r-- | ctr-std/src/sys/unix/fs.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/ctr-std/src/sys/unix/fs.rs b/ctr-std/src/sys/unix/fs.rs index f30b270..9dba863 100644 --- a/ctr-std/src/sys/unix/fs.rs +++ b/ctr-std/src/sys/unix/fs.rs @@ -177,7 +177,7 @@ impl Iterator for ReadDir { } } - let name = (*entry_ptr).d_name.as_ptr(); + let name = (*entry_ptr).d_name.as_ptr() as *const _; let namelen = libc::strlen(name) as usize; let ret = DirEntry { @@ -261,7 +261,7 @@ impl DirEntry { fn name_bytes(&self) -> &[u8] { unsafe { - CStr::from_ptr(self.entry.d_name.as_ptr()).to_bytes() + CStr::from_ptr(self.entry.d_name.as_ptr() as *const _).to_bytes() } } } @@ -338,7 +338,7 @@ impl File { opts.get_creation_mode()? | (opts.custom_flags as c_int & !libc::O_ACCMODE); let fd = cvt_r(|| unsafe { - open64(path.as_ptr(), flags, opts.mode as c_int) + open64(path.as_ptr() as *const _, flags, opts.mode as c_int) })?; let fd = FileDesc::new(fd); @@ -439,7 +439,7 @@ impl DirBuilder { pub fn mkdir(&self, p: &Path) -> io::Result<()> { let p = cstr(p)?; - cvt(unsafe { libc::mkdir(p.as_ptr(), self.mode) })?; + cvt(unsafe { libc::mkdir(p.as_ptr() as *const _, self.mode) })?; Ok(()) } @@ -475,7 +475,7 @@ impl fmt::Debug for File { // alternatives. If a better method is invented, it should be used // instead. let mut buf = vec![0;libc::PATH_MAX as usize]; - let n = unsafe { libc::fcntl(fd, libc::F_GETPATH, buf.as_ptr()) }; + let n = unsafe { libc::fcntl(fd, libc::F_GETPATH, buf.as_ptr() as *const _) }; if n == -1 { return None; } @@ -528,7 +528,7 @@ pub fn readdir(p: &Path) -> io::Result<ReadDir> { let root = Arc::new(p.to_path_buf()); let p = cstr(p)?; unsafe { - let ptr = libc::opendir(p.as_ptr()); + let ptr = libc::opendir(p.as_ptr() as *const _); if ptr.is_null() { Err(Error::last_os_error()) } else { @@ -539,26 +539,26 @@ pub fn readdir(p: &Path) -> io::Result<ReadDir> { pub fn unlink(p: &Path) -> io::Result<()> { let p = cstr(p)?; - cvt(unsafe { libc::unlink(p.as_ptr()) })?; + cvt(unsafe { libc::unlink(p.as_ptr() as *const _) })?; Ok(()) } pub fn rename(old: &Path, new: &Path) -> io::Result<()> { let old = cstr(old)?; let new = cstr(new)?; - cvt(unsafe { libc::rename(old.as_ptr(), new.as_ptr()) })?; + cvt(unsafe { libc::rename(old.as_ptr() as *const _, new.as_ptr() as *const _) })?; Ok(()) } pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> { let p = cstr(p)?; - cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) })?; + cvt_r(|| unsafe { libc::chmod(p.as_ptr() as *const _, perm.mode) })?; Ok(()) } pub fn rmdir(p: &Path) -> io::Result<()> { let p = cstr(p)?; - cvt(unsafe { libc::rmdir(p.as_ptr()) })?; + cvt(unsafe { libc::rmdir(p.as_ptr() as *const _) })?; Ok(()) } @@ -585,7 +585,7 @@ fn remove_dir_all_recursive(path: &Path) -> io::Result<()> { pub fn readlink(p: &Path) -> io::Result<PathBuf> { let c_path = cstr(p)?; - let p = c_path.as_ptr(); + let p = c_path.as_ptr() as *const _; let mut buf = Vec::with_capacity(256); @@ -612,14 +612,14 @@ pub fn readlink(p: &Path) -> io::Result<PathBuf> { pub fn symlink(src: &Path, dst: &Path) -> io::Result<()> { let src = cstr(src)?; let dst = cstr(dst)?; - cvt(unsafe { libc::symlink(src.as_ptr(), dst.as_ptr()) })?; + cvt(unsafe { libc::symlink(src.as_ptr() as *const _, dst.as_ptr() as *const _) })?; Ok(()) } pub fn link(src: &Path, dst: &Path) -> io::Result<()> { let src = cstr(src)?; let dst = cstr(dst)?; - cvt(unsafe { libc::link(src.as_ptr(), dst.as_ptr()) })?; + cvt(unsafe { libc::link(src.as_ptr() as *const _, dst.as_ptr() as *const _) })?; Ok(()) } @@ -627,7 +627,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> { let p = cstr(p)?; let mut stat: stat64 = unsafe { mem::zeroed() }; cvt(unsafe { - stat64(p.as_ptr(), &mut stat as *mut _ as *mut _) + stat64(p.as_ptr() as *const _, &mut stat as *mut _ as *mut _) })?; Ok(FileAttr { stat: stat }) } @@ -636,7 +636,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> { let p = cstr(p)?; let mut stat: stat64 = unsafe { mem::zeroed() }; cvt(unsafe { - lstat64(p.as_ptr(), &mut stat as *mut _ as *mut _) + lstat64(p.as_ptr() as *const _, &mut stat as *mut _ as *mut _) })?; Ok(FileAttr { stat: stat }) } @@ -645,11 +645,11 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> { let path = CString::new(p.as_os_str().as_bytes())?; let buf; unsafe { - let r = libc::realpath(path.as_ptr(), ptr::null_mut()); + let r = libc::realpath(path.as_ptr() as *const _, ptr::null_mut()); if r.is_null() { return Err(io::Error::last_os_error()) } - buf = CStr::from_ptr(r).to_bytes().to_vec(); + buf = CStr::from_ptr(r as *const _).to_bytes().to_vec(); libc::free(r as *mut _); } Ok(PathBuf::from(OsString::from_vec(buf))) |