Skip to content

Commit

Permalink
Bump windows-sys to 0.59
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenn committed Aug 3, 2024
1 parent ee77be6 commit ff2a9e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ termios = { version = "0.3.3", optional = true }
buffer-redux = { version = "1.0", optional = true, default-features = false }

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.52.0", features = ["Win32_Foundation", "Win32_System_Console", "Win32_Security", "Win32_System_Threading", "Win32_UI_Input_KeyboardAndMouse"] }
windows-sys = { version = "0.59.0", features = ["Win32_Foundation", "Win32_System_Console", "Win32_Security", "Win32_System_Threading", "Win32_UI_Input_KeyboardAndMouse"] }
clipboard-win = "5.0"

[dev-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions src/tty/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn get_std_handle(fd: console::STD_HANDLE) -> Result<HANDLE> {
fn check_handle(handle: HANDLE) -> Result<HANDLE> {
if handle == foundation::INVALID_HANDLE_VALUE {
Err(io::Error::last_os_error())?;
} else if handle == 0 {
} else if handle.is_null() {
Err(io::Error::new(
io::ErrorKind::Other,
"no stdio handle available for this process",
Expand Down Expand Up @@ -332,7 +332,7 @@ impl ConsoleRenderer {
fn clear(&mut self, length: u32, pos: console::COORD, attr: u16) -> Result<()> {
let mut _count = 0;
check(unsafe {
console::FillConsoleOutputCharacterA(self.conout, b' ', length, pos, &mut _count)
console::FillConsoleOutputCharacterA(self.conout, b' ' as i8, length, pos, &mut _count)
})?;
Ok(check(unsafe {
console::FillConsoleOutputAttribute(self.conout, attr, length, pos, &mut _count)
Expand Down Expand Up @@ -604,7 +604,7 @@ fn write_all(handle: HANDLE, mut data: &[u16]) -> Result<()> {
check(unsafe {
console::WriteConsoleW(
handle,
slice.as_ptr().cast::<std::ffi::c_void>(),
slice.as_ptr(),
slice.len() as u32,
&mut written,
ptr::null_mut(),
Expand Down Expand Up @@ -708,9 +708,9 @@ impl Term for Console {

Ok(Console {
conin_isatty,
conin: conin.unwrap_or(0),
conin: conin.unwrap_or(ptr::null_mut()),
conout_isatty,
conout: conout.unwrap_or(0),
conout: conout.unwrap_or(ptr::null_mut()),
close_on_drop,
color_mode,
ansi_colors_supported: false,
Expand Down Expand Up @@ -843,7 +843,7 @@ impl Term for Console {
Err(io::Error::from(io::ErrorKind::Other))?; // FIXME
}
let event = unsafe { threading::CreateEventW(ptr::null_mut(), TRUE, FALSE, ptr::null()) };
if event == 0 {
if event.is_null() {
Err(io::Error::last_os_error())?;
}
let (sender, receiver) = sync_channel(1);
Expand Down

0 comments on commit ff2a9e6

Please sign in to comment.