std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].

This commit is contained in:
Huon Wilson 2013-12-15 23:35:12 +11:00
parent f53292f7ee
commit 164f7a290e
22 changed files with 115 additions and 113 deletions

View file

@ -133,7 +133,7 @@ impl rtio::RtioFileStream for FileDesc {
self.inner_write(buf)
}
fn pread(&mut self, buf: &mut [u8], offset: u64) -> Result<int, IoError> {
return os_pread(self.fd, vec::raw::to_ptr(buf), buf.len(), offset);
return os_pread(self.fd, buf.as_ptr(), buf.len(), offset);
#[cfg(windows)]
fn os_pread(fd: c_int, buf: *u8, amt: uint, offset: u64) -> IoResult<int> {
@ -165,7 +165,7 @@ impl rtio::RtioFileStream for FileDesc {
}
}
fn pwrite(&mut self, buf: &[u8], offset: u64) -> Result<(), IoError> {
return os_pwrite(self.fd, vec::raw::to_ptr(buf), buf.len(), offset);
return os_pwrite(self.fd, buf.as_ptr(), buf.len(), offset);
#[cfg(windows)]
fn os_pwrite(fd: c_int, buf: *u8, amt: uint, offset: u64) -> IoResult<()> {
@ -700,7 +700,7 @@ pub fn readlink(p: &CString) -> IoResult<Path> {
}
let mut buf = vec::with_capacity::<u8>(len as uint);
match unsafe {
libc::readlink(p, vec::raw::to_ptr(buf) as *mut libc::c_char,
libc::readlink(p, buf.as_ptr() as *mut libc::c_char,
len as libc::size_t)
} {
-1 => Err(super::last_error()),