Remove LARGE_INTEGER
This commit is contained in:
parent
1d1cae1ba5
commit
91ba4ebcfd
3 changed files with 15 additions and 16 deletions
|
@ -8,7 +8,7 @@
|
|||
use crate::ffi::CStr;
|
||||
use crate::mem;
|
||||
pub use crate::os::raw::c_int;
|
||||
use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void};
|
||||
use crate::os::raw::{c_char, c_long, c_uint, c_ulong, c_ushort, c_void};
|
||||
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
|
||||
use crate::ptr;
|
||||
|
||||
|
@ -18,7 +18,6 @@ mod windows_sys;
|
|||
pub use windows_sys::*;
|
||||
|
||||
pub type DWORD = c_ulong;
|
||||
pub type LARGE_INTEGER = c_longlong;
|
||||
#[cfg_attr(target_vendor = "uwp", allow(unused))]
|
||||
pub type LONG = c_long;
|
||||
pub type UINT = c_uint;
|
||||
|
@ -270,7 +269,7 @@ pub unsafe fn NtReadFile(
|
|||
iostatusblock: &mut IO_STATUS_BLOCK,
|
||||
buffer: *mut crate::mem::MaybeUninit<u8>,
|
||||
length: ULONG,
|
||||
byteoffset: Option<&LARGE_INTEGER>,
|
||||
byteoffset: Option<&i64>,
|
||||
key: Option<&ULONG>,
|
||||
) -> NTSTATUS {
|
||||
windows_sys::NtReadFile(
|
||||
|
@ -293,7 +292,7 @@ pub unsafe fn NtWriteFile(
|
|||
iostatusblock: &mut IO_STATUS_BLOCK,
|
||||
buffer: *const u8,
|
||||
length: ULONG,
|
||||
byteoffset: Option<&LARGE_INTEGER>,
|
||||
byteoffset: Option<&i64>,
|
||||
key: Option<&ULONG>,
|
||||
) -> NTSTATUS {
|
||||
windows_sys::NtWriteFile(
|
||||
|
@ -452,7 +451,7 @@ compat_fn_with_fallback! {
|
|||
iostatusblock: &mut IO_STATUS_BLOCK,
|
||||
buffer: *mut crate::mem::MaybeUninit<u8>,
|
||||
length: ULONG,
|
||||
byteoffset: Option<&LARGE_INTEGER>,
|
||||
byteoffset: Option<&i64>,
|
||||
key: Option<&ULONG>
|
||||
) -> NTSTATUS {
|
||||
STATUS_NOT_IMPLEMENTED
|
||||
|
@ -466,7 +465,7 @@ compat_fn_with_fallback! {
|
|||
iostatusblock: &mut IO_STATUS_BLOCK,
|
||||
buffer: *const u8,
|
||||
length: ULONG,
|
||||
byteoffset: Option<&LARGE_INTEGER>,
|
||||
byteoffset: Option<&i64>,
|
||||
key: Option<&ULONG>
|
||||
) -> NTSTATUS {
|
||||
STATUS_NOT_IMPLEMENTED
|
||||
|
|
|
@ -495,7 +495,7 @@ impl File {
|
|||
SeekFrom::End(n) => (c::FILE_END, n),
|
||||
SeekFrom::Current(n) => (c::FILE_CURRENT, n),
|
||||
};
|
||||
let pos = pos as c::LARGE_INTEGER;
|
||||
let pos = pos as i64;
|
||||
let mut newpos = 0;
|
||||
cvt(unsafe { c::SetFilePointerEx(self.handle.as_raw_handle(), pos, &mut newpos, whence) })?;
|
||||
Ok(newpos as u64)
|
||||
|
@ -1417,10 +1417,10 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
|
|||
|
||||
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
||||
unsafe extern "system" fn callback(
|
||||
_TotalFileSize: c::LARGE_INTEGER,
|
||||
_TotalBytesTransferred: c::LARGE_INTEGER,
|
||||
_StreamSize: c::LARGE_INTEGER,
|
||||
StreamBytesTransferred: c::LARGE_INTEGER,
|
||||
_TotalFileSize: i64,
|
||||
_TotalBytesTransferred: i64,
|
||||
_StreamSize: i64,
|
||||
StreamBytesTransferred: i64,
|
||||
dwStreamNumber: c::DWORD,
|
||||
_dwCallbackReason: c::DWORD,
|
||||
_hSourceFile: c::HANDLE,
|
||||
|
|
|
@ -172,7 +172,7 @@ mod perf_counter {
|
|||
use crate::time::Duration;
|
||||
|
||||
pub struct PerformanceCounterInstant {
|
||||
ts: c::LARGE_INTEGER,
|
||||
ts: i64,
|
||||
}
|
||||
impl PerformanceCounterInstant {
|
||||
pub fn now() -> Self {
|
||||
|
@ -196,7 +196,7 @@ mod perf_counter {
|
|||
}
|
||||
}
|
||||
|
||||
fn frequency() -> c::LARGE_INTEGER {
|
||||
fn frequency() -> i64 {
|
||||
// Either the cached result of `QueryPerformanceFrequency` or `0` for
|
||||
// uninitialized. Storing this as a single `AtomicU64` allows us to use
|
||||
// `Relaxed` operations, as we are only interested in the effects on a
|
||||
|
@ -206,7 +206,7 @@ mod perf_counter {
|
|||
let cached = FREQUENCY.load(Ordering::Relaxed);
|
||||
// If a previous thread has filled in this global state, use that.
|
||||
if cached != 0 {
|
||||
return cached as c::LARGE_INTEGER;
|
||||
return cached as i64;
|
||||
}
|
||||
// ... otherwise learn for ourselves ...
|
||||
let mut frequency = 0;
|
||||
|
@ -218,8 +218,8 @@ mod perf_counter {
|
|||
frequency
|
||||
}
|
||||
|
||||
fn query() -> c::LARGE_INTEGER {
|
||||
let mut qpc_value: c::LARGE_INTEGER = 0;
|
||||
fn query() -> i64 {
|
||||
let mut qpc_value: i64 = 0;
|
||||
cvt(unsafe { c::QueryPerformanceCounter(&mut qpc_value) }).unwrap();
|
||||
qpc_value
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue