Update emscripten functions declarations

This commit is contained in:
Mateusz Mikuła 2019-10-17 12:09:11 +02:00
parent 01008e4cd6
commit 6de4924b6c
2 changed files with 2 additions and 34 deletions

View File

@ -71,22 +71,7 @@ pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
#[cfg(target_os = "android")]
use super::android::cvt_pread64;
#[cfg(target_os = "emscripten")]
unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64)
-> io::Result<isize>
{
use crate::convert::TryInto;
use libc::pread64;
// pread64 on emscripten actually takes a 32 bit offset
if let Ok(o) = offset.try_into() {
cvt(pread64(fd, buf, count, o))
} else {
Err(io::Error::new(io::ErrorKind::InvalidInput,
"cannot pread >2GB"))
}
}
#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
#[cfg(not(target_os = "android"))]
unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64)
-> io::Result<isize>
{
@ -128,22 +113,7 @@ pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
#[cfg(target_os = "android")]
use super::android::cvt_pwrite64;
#[cfg(target_os = "emscripten")]
unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64)
-> io::Result<isize>
{
use crate::convert::TryInto;
use libc::pwrite64;
// pwrite64 on emscripten actually takes a 32 bit offset
if let Ok(o) = offset.try_into() {
cvt(pwrite64(fd, buf, count, o))
} else {
Err(io::Error::new(io::ErrorKind::InvalidInput,
"cannot pwrite >2GB"))
}
}
#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
#[cfg(not(target_os = "android"))]
unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64)
-> io::Result<isize>
{

View File

@ -602,8 +602,6 @@ pub fn seek(&self, pos: SeekFrom) -> io::Result<u64> {
SeekFrom::End(off) => (libc::SEEK_END, off),
SeekFrom::Current(off) => (libc::SEEK_CUR, off),
};
#[cfg(target_os = "emscripten")]
let pos = pos as i32;
let n = cvt(unsafe { lseek64(self.0.raw(), pos, whence) })?;
Ok(n as u64)
}