Skip to content

Commit 7b0f2af

Browse files
committed
Auto merge of #26102 - retep998:openoptionsext, r=alexcrichton
r? @alexcrichton
2 parents a9f50bd + b0d535b commit 7b0f2af

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/libstd/sys/windows/ext/fs.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,41 @@ use sys_common::{AsInnerMut, AsInner};
2525
pub trait OpenOptionsExt {
2626
/// Overrides the `dwDesiredAccess` argument to the call to `CreateFile`
2727
/// with the specified value.
28-
fn desired_access(&mut self, access: i32) -> &mut Self;
28+
fn desired_access(&mut self, access: u32) -> &mut Self;
2929

3030
/// Overrides the `dwCreationDisposition` argument to the call to
3131
/// `CreateFile` with the specified value.
3232
///
3333
/// This will override any values of the standard `create` flags, for
3434
/// example.
35-
fn creation_disposition(&mut self, val: i32) -> &mut Self;
35+
fn creation_disposition(&mut self, val: u32) -> &mut Self;
3636

3737
/// Overrides the `dwFlagsAndAttributes` argument to the call to
3838
/// `CreateFile` with the specified value.
3939
///
4040
/// This will override any values of the standard flags on the
4141
/// `OpenOptions` structure.
42-
fn flags_and_attributes(&mut self, val: i32) -> &mut Self;
42+
fn flags_and_attributes(&mut self, val: u32) -> &mut Self;
4343

4444
/// Overrides the `dwShareMode` argument to the call to `CreateFile` with
4545
/// the specified value.
4646
///
4747
/// This will override any values of the standard flags on the
4848
/// `OpenOptions` structure.
49-
fn share_mode(&mut self, val: i32) -> &mut Self;
49+
fn share_mode(&mut self, val: u32) -> &mut Self;
5050
}
5151

5252
impl OpenOptionsExt for OpenOptions {
53-
fn desired_access(&mut self, access: i32) -> &mut OpenOptions {
53+
fn desired_access(&mut self, access: u32) -> &mut OpenOptions {
5454
self.as_inner_mut().desired_access(access); self
5555
}
56-
fn creation_disposition(&mut self, access: i32) -> &mut OpenOptions {
56+
fn creation_disposition(&mut self, access: u32) -> &mut OpenOptions {
5757
self.as_inner_mut().creation_disposition(access); self
5858
}
59-
fn flags_and_attributes(&mut self, access: i32) -> &mut OpenOptions {
59+
fn flags_and_attributes(&mut self, access: u32) -> &mut OpenOptions {
6060
self.as_inner_mut().flags_and_attributes(access); self
6161
}
62-
fn share_mode(&mut self, access: i32) -> &mut OpenOptions {
62+
fn share_mode(&mut self, access: u32) -> &mut OpenOptions {
6363
self.as_inner_mut().share_mode(access); self
6464
}
6565
}

src/libstd/sys/windows/fs.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,17 @@ impl OpenOptions {
158158
pub fn append(&mut self, append: bool) { self.append = append; }
159159
pub fn create(&mut self, create: bool) { self.create = create; }
160160
pub fn truncate(&mut self, truncate: bool) { self.truncate = truncate; }
161-
pub fn creation_disposition(&mut self, val: i32) {
162-
self.creation_disposition = Some(val as libc::DWORD);
161+
pub fn creation_disposition(&mut self, val: u32) {
162+
self.creation_disposition = Some(val);
163163
}
164-
pub fn flags_and_attributes(&mut self, val: i32) {
165-
self.flags_and_attributes = Some(val as libc::DWORD);
164+
pub fn flags_and_attributes(&mut self, val: u32) {
165+
self.flags_and_attributes = Some(val);
166166
}
167-
pub fn desired_access(&mut self, val: i32) {
168-
self.desired_access = Some(val as libc::DWORD);
167+
pub fn desired_access(&mut self, val: u32) {
168+
self.desired_access = Some(val);
169169
}
170-
pub fn share_mode(&mut self, val: i32) {
171-
self.share_mode = Some(val as libc::DWORD);
170+
pub fn share_mode(&mut self, val: u32) {
171+
self.share_mode = Some(val);
172172
}
173173
pub fn security_attributes(&mut self, attrs: libc::LPSECURITY_ATTRIBUTES) {
174174
self.security_attributes = attrs as usize;
@@ -221,7 +221,7 @@ impl File {
221221
fn open_reparse_point(path: &Path) -> io::Result<File> {
222222
let mut opts = OpenOptions::new();
223223
opts.read(true);
224-
opts.flags_and_attributes(c::FILE_FLAG_OPEN_REPARSE_POINT as i32);
224+
opts.flags_and_attributes(c::FILE_FLAG_OPEN_REPARSE_POINT);
225225
File::open(path, &opts)
226226
}
227227

0 commit comments

Comments
 (0)