Remove DWORD · model-checking/verify-rust-std@a1a1c6a (original) (raw)
`@@ -28,21 +28,21 @@ pub struct File {
`
28
28
``
29
29
`#[derive(Clone)]
`
30
30
`pub struct FileAttr {
`
31
``
`-
attributes: c::DWORD,
`
``
31
`+
attributes: u32,
`
32
32
`creation_time: c::FILETIME,
`
33
33
`last_access_time: c::FILETIME,
`
34
34
`last_write_time: c::FILETIME,
`
35
35
`file_size: u64,
`
36
``
`-
reparse_tag: c::DWORD,
`
``
36
`+
reparse_tag: u32,
`
37
37
`volume_serial_number: Option,
`
38
38
`number_of_links: Option,
`
39
39
`file_index: Option,
`
40
40
`}
`
41
41
``
42
42
`#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
`
43
43
`pub struct FileType {
`
44
``
`-
attributes: c::DWORD,
`
45
``
`-
reparse_tag: c::DWORD,
`
``
44
`+
attributes: u32,
`
``
45
`+
reparse_tag: u32,
`
46
46
`}
`
47
47
``
48
48
`pub struct ReadDir {
`
`@@ -75,16 +75,16 @@ pub struct OpenOptions {
`
75
75
`create_new: bool,
`
76
76
`// system-specific
`
77
77
`custom_flags: u32,
`
78
``
`-
access_mode: Option<c::DWORD>,
`
79
``
`-
attributes: c::DWORD,
`
80
``
`-
share_mode: c::DWORD,
`
81
``
`-
security_qos_flags: c::DWORD,
`
``
78
`+
access_mode: Option,
`
``
79
`+
attributes: u32,
`
``
80
`+
share_mode: u32,
`
``
81
`+
security_qos_flags: u32,
`
82
82
`security_attributes: *mut c::SECURITY_ATTRIBUTES,
`
83
83
`}
`
84
84
``
85
85
`#[derive(Clone, PartialEq, Eq, Debug)]
`
86
86
`pub struct FilePermissions {
`
87
``
`-
attrs: c::DWORD,
`
``
87
`+
attrs: u32,
`
88
88
`}
`
89
89
``
90
90
`#[derive(Copy, Clone, Debug, Default)]
`
`@@ -245,7 +245,7 @@ impl OpenOptions {
`
245
245
`self.security_attributes = attrs;
`
246
246
`}
`
247
247
``
248
``
`-
fn get_access_mode(&self) -> io::Result<c::DWORD> {
`
``
248
`+
fn get_access_mode(&self) -> io::Result {
`
249
249
`match (self.read, self.write, self.append, self.access_mode) {
`
250
250
`(.., Some(mode)) => Ok(mode),
`
251
251
`(true, false, false, None) => Ok(c::GENERIC_READ),
`
`@@ -261,7 +261,7 @@ impl OpenOptions {
`
261
261
`}
`
262
262
`}
`
263
263
``
264
``
`-
fn get_creation_mode(&self) -> io::Result<c::DWORD> {
`
``
264
`+
fn get_creation_mode(&self) -> io::Result {
`
265
265
`match (self.write, self.append) {
`
266
266
`(true, false) => {}
`
267
267
`(false, false) => {
`
`@@ -287,7 +287,7 @@ impl OpenOptions {
`
287
287
`})
`
288
288
`}
`
289
289
``
290
``
`-
fn get_flags_and_attributes(&self) -> c::DWORD {
`
``
290
`+
fn get_flags_and_attributes(&self) -> u32 {
`
291
291
`self.custom_flags
`
292
292
` | self.attributes
`
293
293
` | self.security_qos_flags
`
`@@ -397,21 +397,21 @@ impl File {
`
397
397
`self.handle.as_raw_handle(),
`
398
398
` c::FileBasicInfo,
`
399
399
` core::ptr::addr_of_mut!(info) as *mut c_void,
`
400
``
`-
size as c::DWORD,
`
``
400
`+
size as u32,
`
401
401
`))?;
`
402
402
`let mut attr = FileAttr {
`
403
403
`attributes: info.FileAttributes,
`
404
404
`creation_time: c::FILETIME {
`
405
``
`-
dwLowDateTime: info.CreationTime as c::DWORD,
`
406
``
`-
dwHighDateTime: (info.CreationTime >> 32) as c::DWORD,
`
``
405
`+
dwLowDateTime: info.CreationTime as u32,
`
``
406
`+
dwHighDateTime: (info.CreationTime >> 32) as u32,
`
407
407
`},
`
408
408
`last_access_time: c::FILETIME {
`
409
``
`-
dwLowDateTime: info.LastAccessTime as c::DWORD,
`
410
``
`-
dwHighDateTime: (info.LastAccessTime >> 32) as c::DWORD,
`
``
409
`+
dwLowDateTime: info.LastAccessTime as u32,
`
``
410
`+
dwHighDateTime: (info.LastAccessTime >> 32) as u32,
`
411
411
`},
`
412
412
`last_write_time: c::FILETIME {
`
413
``
`-
dwLowDateTime: info.LastWriteTime as c::DWORD,
`
414
``
`-
dwHighDateTime: (info.LastWriteTime >> 32) as c::DWORD,
`
``
413
`+
dwLowDateTime: info.LastWriteTime as u32,
`
``
414
`+
dwHighDateTime: (info.LastWriteTime >> 32) as u32,
`
415
415
`},
`
416
416
`file_size: 0,
`
417
417
`reparse_tag: 0,
`
`@@ -425,7 +425,7 @@ impl File {
`
425
425
`self.handle.as_raw_handle(),
`
426
426
` c::FileStandardInfo,
`
427
427
` core::ptr::addr_of_mut!(info) as *mut c_void,
`
428
``
`-
size as c::DWORD,
`
``
428
`+
size as u32,
`
429
429
`))?;
`
430
430
` attr.file_size = info.AllocationSize as u64;
`
431
431
` attr.number_of_links = Some(info.NumberOfLinks);
`
`@@ -511,7 +511,7 @@ impl File {
`
511
511
`fn reparse_point(
`
512
512
`&self,
`
513
513
`space: &mut Align8<[MaybeUninit]>,
`
514
``
`-
) -> io::Result<(c::DWORD, *mut c::REPARSE_DATA_BUFFER)> {
`
``
514
`+
) -> io::Result<(u32, *mut c::REPARSE_DATA_BUFFER)> {
`
515
515
`unsafe {
`
516
516
`let mut bytes = 0;
`
517
517
`cvt({
`
`@@ -524,7 +524,7 @@ impl File {
`
524
524
` ptr::null_mut(),
`
525
525
`0,
`
526
526
` space.0.as_mut_ptr().cast(),
`
527
``
`-
len as c::DWORD,
`
``
527
`+
len as u32,
`
528
528
`&mut bytes,
`
529
529
` ptr::null_mut(),
`
530
530
`)
`
`@@ -609,8 +609,7 @@ impl File {
`
609
609
`"Cannot set file timestamp to 0",
`
610
610
`));
`
611
611
`}
`
612
``
`-
let is_max =
`
613
``
`-
|t: c::FILETIME| t.dwLowDateTime == c::DWORD::MAX && t.dwHighDateTime == c::DWORD::MAX;
`
``
612
`+
let is_max = |t: c::FILETIME| t.dwLowDateTime == u32::MAX && t.dwHighDateTime == u32::MAX;
`
614
613
`if times.accessed.map_or(false, is_max)
`
615
614
` || times.modified.map_or(false, is_max)
`
616
615
` || times.created.map_or(false, is_max)
`
`@@ -641,7 +640,7 @@ impl File {
`
641
640
`self.handle.as_raw_handle(),
`
642
641
` c::FileBasicInfo,
`
643
642
` core::ptr::addr_of_mut!(info) as *mut c_void,
`
644
``
`-
size as c::DWORD,
`
``
643
`+
size as u32,
`
645
644
`))?;
`
646
645
`Ok(info)
`
647
646
`}
`
`@@ -1020,7 +1019,7 @@ impl FileTimes {
`
1020
1019
`}
`
1021
1020
``
1022
1021
`impl FileType {
`
1023
``
`-
fn new(attrs: c::DWORD, reparse_tag: c::DWORD) -> FileType {
`
``
1022
`+
fn new(attrs: u32, reparse_tag: u32) -> FileType {
`
1024
1023
`FileType { attributes: attrs, reparse_tag }
`
1025
1024
`}
`
1026
1025
`pub fn is_dir(&self) -> bool {
`
`@@ -1421,12 +1420,12 @@ pub fn copy(from: &Path, to: &Path) -> io::Result {
`
1421
1420
`_TotalBytesTransferred: i64,
`
1422
1421
`_StreamSize: i64,
`
1423
1422
`StreamBytesTransferred: i64,
`
1424
``
`-
dwStreamNumber: c::DWORD,
`
1425
``
`-
_dwCallbackReason: c::DWORD,
`
``
1423
`+
dwStreamNumber: u32,
`
``
1424
`+
_dwCallbackReason: u32,
`
1426
1425
`_hSourceFile: c::HANDLE,
`
1427
1426
`_hDestinationFile: c::HANDLE,
`
1428
1427
`lpData: *const c_void,
`
1429
``
`-
) -> c::DWORD {
`
``
1428
`+
) -> u32 {
`
1430
1429
`if dwStreamNumber == 1 {
`
1431
1430
`*(lpData as *mut i64) = StreamBytesTransferred;
`
1432
1431
`}
`