keyfork-crossterm-ioctl-shim: use raw pointers when necessary

This commit is contained in:
Ryan Heywood 2025-08-21 05:45:15 -04:00
parent c15c4625a9
commit 2186c1ce86
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 5 additions and 5 deletions

View File

@ -55,7 +55,7 @@ impl TerminalIoctl {
fn get_termios(&self) -> Result<Termios> {
let mut termios = unsafe { std::mem::zeroed() };
assert_io(unsafe { libc::tcgetattr(self.fd, &mut termios) })?;
assert_io(unsafe { libc::tcgetattr(self.fd, &raw mut termios) })?;
Ok(termios)
}
@ -71,8 +71,8 @@ impl TerminalIoctl {
let mut termios = self.get_termios()?;
let original_mode_ios = termios;
unsafe { libc::cfmakeraw(&mut termios) };
assert_io(unsafe { libc::tcsetattr(self.fd, libc::TCSANOW, &termios) })?;
unsafe { libc::cfmakeraw(&raw mut termios) };
assert_io(unsafe { libc::tcsetattr(self.fd, libc::TCSANOW, &raw const termios) })?;
self.stored_termios = Some(original_mode_ios);
}
Ok(())
@ -87,7 +87,7 @@ impl TerminalIoctl {
/// The method may propagate errors encountered when interacting with the terminal.
pub fn disable_raw_mode(&mut self) -> Result<()> {
if let Some(termios) = self.stored_termios.take() {
assert_io(unsafe { libc::tcsetattr(self.fd, libc::TCSANOW, &termios) })?;
assert_io(unsafe { libc::tcsetattr(self.fd, libc::TCSANOW, &raw const termios) })?;
}
Ok(())
}
@ -107,7 +107,7 @@ impl TerminalIoctl {
ws_ypixel: 0,
};
assert_io(unsafe { libc::ioctl(self.fd, libc::TIOCGWINSZ, &mut size) })?;
assert_io(unsafe { libc::ioctl(self.fd, libc::TIOCGWINSZ, &raw mut size) })?;
Ok((size.ws_col, size.ws_row))
}
}