From 0837ad5ab1804732e441d89161a97ad9a7d87f6c Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Sat, 29 Dec 2018 13:30:22 +0100 Subject: [PATCH] Fix TIOCGWINSZ type mismatch on DragonFly Below is the error message I got before this patch: error[E0308]: mismatched types --> src/sys/unix/size.rs:17:34 | 17 | cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut size as *mut _))?; | ^^^^^^^^^^ expected u64, found u32 help: you can cast an `u32` to `u64`, which will zero-extend the source value | 17 | cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut size as *mut _))?; | ^^^^^^^^^^^^^^^^^ --- src/sys/unix/size.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sys/unix/size.rs b/src/sys/unix/size.rs index 9979280..17f2515 100644 --- a/src/sys/unix/size.rs +++ b/src/sys/unix/size.rs @@ -14,7 +14,7 @@ struct TermSize { pub fn terminal_size() -> io::Result<(u16, u16)> { unsafe { let mut size: TermSize = mem::zeroed(); - cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut size as *mut _))?; + cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut size as *mut _))?; Ok((size.col as u16, size.row as u16)) } }