diff options
| author | bors <bors@rust-lang.org> | 2016-12-30 07:34:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-30 07:34:19 +0000 |
| commit | 7f2d2afa9196ba6314a29e58d5324dbd9923c75e (patch) | |
| tree | 483907141a5dcd2cfc7e4ea91f7234d77bddf83b /src/libstd/sys/windows | |
| parent | 75f5981d4500e52de767d61ec50a34b97be2a301 (diff) | |
| parent | e484197482698ee0bb83a66987a5f64c46ae306b (diff) | |
| download | rust-7f2d2afa9196ba6314a29e58d5324dbd9923c75e.tar.gz rust-7f2d2afa9196ba6314a29e58d5324dbd9923c75e.zip | |
Auto merge of #38697 - alexcrichton:rollup, r=alexcrichton
Rollup of 25 pull requests - Successful merges: #37149, #38491, #38517, #38559, #38587, #38609, #38611, #38622, #38628, #38630, #38631, #38632, #38635, #38647, #38649, #38655, #38659, #38660, #38662, #38665, #38671, #38674, #38676, #38693, #38695 - Failed merges: #38657, #38680
Diffstat (limited to 'src/libstd/sys/windows')
| -rw-r--r-- | src/libstd/sys/windows/handle.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/libstd/sys/windows/handle.rs b/src/libstd/sys/windows/handle.rs index 10b86ba44bc..fdb9483fe1c 100644 --- a/src/libstd/sys/windows/handle.rs +++ b/src/libstd/sys/windows/handle.rs @@ -19,7 +19,6 @@ use ptr; use sys::c; use sys::cvt; use sys_common::io::read_to_end_uninitialized; -use u32; /// An owned container for `HANDLE` object, closing them on Drop. /// @@ -83,9 +82,7 @@ impl RawHandle { pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> { let mut read = 0; - // ReadFile takes a DWORD (u32) for the length so it only supports - // reading u32::MAX bytes at a time. - let len = cmp::min(buf.len(), u32::MAX as usize) as c::DWORD; + let len = cmp::min(buf.len(), <c::DWORD>::max_value() as usize) as c::DWORD; let res = cvt(unsafe { c::ReadFile(self.0, buf.as_mut_ptr() as c::LPVOID, len, &mut read, ptr::null_mut()) @@ -181,9 +178,7 @@ impl RawHandle { pub fn write(&self, buf: &[u8]) -> io::Result<usize> { let mut amt = 0; - // WriteFile takes a DWORD (u32) for the length so it only supports - // writing u32::MAX bytes at a time. - let len = cmp::min(buf.len(), u32::MAX as usize) as c::DWORD; + let len = cmp::min(buf.len(), <c::DWORD>::max_value() as usize) as c::DWORD; cvt(unsafe { c::WriteFile(self.0, buf.as_ptr() as c::LPVOID, len, &mut amt, ptr::null_mut()) |
