Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4eaaf7d

Browse files
committedJul 15, 2024
Remove LARGE_INTEGER
1 parent aa45985 commit 4eaaf7d

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed
 

‎std/src/sys/pal/windows/c.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use crate::ffi::CStr;
99
use crate::mem;
1010
pub use crate::os::raw::c_int;
11-
use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void};
11+
use crate::os::raw::{c_char, c_long, c_uint, c_ulong, c_ushort, c_void};
1212
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
1313
use crate::ptr;
1414

@@ -18,7 +18,6 @@ mod windows_sys;
1818
pub use windows_sys::*;
1919

2020
pub type DWORD = c_ulong;
21-
pub type LARGE_INTEGER = c_longlong;
2221
#[cfg_attr(target_vendor = "uwp", allow(unused))]
2322
pub type LONG = c_long;
2423
pub type UINT = c_uint;
@@ -270,7 +269,7 @@ pub unsafe fn NtReadFile(
270269
iostatusblock: &mut IO_STATUS_BLOCK,
271270
buffer: *mut crate::mem::MaybeUninit<u8>,
272271
length: ULONG,
273-
byteoffset: Option<&LARGE_INTEGER>,
272+
byteoffset: Option<&i64>,
274273
key: Option<&ULONG>,
275274
) -> NTSTATUS {
276275
windows_sys::NtReadFile(
@@ -293,7 +292,7 @@ pub unsafe fn NtWriteFile(
293292
iostatusblock: &mut IO_STATUS_BLOCK,
294293
buffer: *const u8,
295294
length: ULONG,
296-
byteoffset: Option<&LARGE_INTEGER>,
295+
byteoffset: Option<&i64>,
297296
key: Option<&ULONG>,
298297
) -> NTSTATUS {
299298
windows_sys::NtWriteFile(
@@ -452,7 +451,7 @@ compat_fn_with_fallback! {
452451
iostatusblock: &mut IO_STATUS_BLOCK,
453452
buffer: *mut crate::mem::MaybeUninit<u8>,
454453
length: ULONG,
455-
byteoffset: Option<&LARGE_INTEGER>,
454+
byteoffset: Option<&i64>,
456455
key: Option<&ULONG>
457456
) -> NTSTATUS {
458457
STATUS_NOT_IMPLEMENTED
@@ -466,7 +465,7 @@ compat_fn_with_fallback! {
466465
iostatusblock: &mut IO_STATUS_BLOCK,
467466
buffer: *const u8,
468467
length: ULONG,
469-
byteoffset: Option<&LARGE_INTEGER>,
468+
byteoffset: Option<&i64>,
470469
key: Option<&ULONG>
471470
) -> NTSTATUS {
472471
STATUS_NOT_IMPLEMENTED

‎std/src/sys/pal/windows/fs.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl File {
495495
SeekFrom::End(n) => (c::FILE_END, n),
496496
SeekFrom::Current(n) => (c::FILE_CURRENT, n),
497497
};
498-
let pos = pos as c::LARGE_INTEGER;
498+
let pos = pos as i64;
499499
let mut newpos = 0;
500500
cvt(unsafe { c::SetFilePointerEx(self.handle.as_raw_handle(), pos, &mut newpos, whence) })?;
501501
Ok(newpos as u64)
@@ -1417,10 +1417,10 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
14171417

14181418
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
14191419
unsafe extern "system" fn callback(
1420-
_TotalFileSize: c::LARGE_INTEGER,
1421-
_TotalBytesTransferred: c::LARGE_INTEGER,
1422-
_StreamSize: c::LARGE_INTEGER,
1423-
StreamBytesTransferred: c::LARGE_INTEGER,
1420+
_TotalFileSize: i64,
1421+
_TotalBytesTransferred: i64,
1422+
_StreamSize: i64,
1423+
StreamBytesTransferred: i64,
14241424
dwStreamNumber: c::DWORD,
14251425
_dwCallbackReason: c::DWORD,
14261426
_hSourceFile: c::HANDLE,

‎std/src/sys/pal/windows/time.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ mod perf_counter {
172172
use crate::time::Duration;
173173

174174
pub struct PerformanceCounterInstant {
175-
ts: c::LARGE_INTEGER,
175+
ts: i64,
176176
}
177177
impl PerformanceCounterInstant {
178178
pub fn now() -> Self {
@@ -196,7 +196,7 @@ mod perf_counter {
196196
}
197197
}
198198

199-
fn frequency() -> c::LARGE_INTEGER {
199+
fn frequency() -> i64 {
200200
// Either the cached result of `QueryPerformanceFrequency` or `0` for
201201
// uninitialized. Storing this as a single `AtomicU64` allows us to use
202202
// `Relaxed` operations, as we are only interested in the effects on a
@@ -206,7 +206,7 @@ mod perf_counter {
206206
let cached = FREQUENCY.load(Ordering::Relaxed);
207207
// If a previous thread has filled in this global state, use that.
208208
if cached != 0 {
209-
return cached as c::LARGE_INTEGER;
209+
return cached as i64;
210210
}
211211
// ... otherwise learn for ourselves ...
212212
let mut frequency = 0;
@@ -218,8 +218,8 @@ mod perf_counter {
218218
frequency
219219
}
220220

221-
fn query() -> c::LARGE_INTEGER {
222-
let mut qpc_value: c::LARGE_INTEGER = 0;
221+
fn query() -> i64 {
222+
let mut qpc_value: i64 = 0;
223223
cvt(unsafe { c::QueryPerformanceCounter(&mut qpc_value) }).unwrap();
224224
qpc_value
225225
}

0 commit comments

Comments
 (0)
Failed to load comments.