diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-11-02 16:23:22 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-11-09 22:55:50 -0800 |
| commit | 3d28b8b98e6e4f55ef4ecd8babf0a050f48a3d11 (patch) | |
| tree | 343087c9e62da65e2780db851682280697064c5b /src/libstd/sys/windows/stdio.rs | |
| parent | c8a29c2092cec369a751051a2bfed093522ff6e8 (diff) | |
| download | rust-3d28b8b98e6e4f55ef4ecd8babf0a050f48a3d11.tar.gz rust-3d28b8b98e6e4f55ef4ecd8babf0a050f48a3d11.zip | |
std: Migrate to the new libc
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself
* Update all references to use `libc` as a result.
* Update all references to the new flat namespace.
* Moves all windows bindings into sys::c
Diffstat (limited to 'src/libstd/sys/windows/stdio.rs')
| -rw-r--r-- | src/libstd/sys/windows/stdio.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index 356787d5bf0..8f37dc02e87 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -12,7 +12,6 @@ use prelude::v1::*; use io::prelude::*; use io::{self, Cursor}; -use libc; use ptr; use str; use sync::Mutex; @@ -34,9 +33,9 @@ pub struct Stdin { pub struct Stdout(Output); pub struct Stderr(Output); -pub fn get(handle: libc::DWORD) -> io::Result<Output> { +pub fn get(handle: c::DWORD) -> io::Result<Output> { let handle = unsafe { c::GetStdHandle(handle) }; - if handle == libc::INVALID_HANDLE_VALUE { + if handle == c::INVALID_HANDLE_VALUE { Err(io::Error::last_os_error()) } else if handle.is_null() { Err(io::Error::new(io::ErrorKind::Other, @@ -63,7 +62,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result<usize> { let mut written = 0; try!(cvt(unsafe { c::WriteConsoleW(handle, - utf16.as_ptr() as libc::LPCVOID, + utf16.as_ptr() as c::LPCVOID, utf16.len() as u32, &mut written, ptr::null_mut()) @@ -97,7 +96,7 @@ impl Stdin { let mut num = 0; try!(cvt(unsafe { c::ReadConsoleW(handle, - utf16.as_mut_ptr() as libc::LPVOID, + utf16.as_mut_ptr() as c::LPVOID, utf16.len() as u32, &mut num, ptr::null_mut()) @@ -147,7 +146,7 @@ impl io::Write for Stderr { } impl NoClose { - fn new(handle: libc::HANDLE) -> NoClose { + fn new(handle: c::HANDLE) -> NoClose { NoClose(Some(Handle::new(handle))) } |
