Update emscripten functions declarations
This commit is contained in:
parent
01008e4cd6
commit
6de4924b6c
@ -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>
|
||||
{
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user