From: Lzu Tao Date: Fri, 5 Jul 2019 18:47:55 +0000 (+0000) Subject: Correct definition of CONSOLE_SCREEN_BUFFER_INFO X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=05c1e92787d134c53a38c5eea7100caa7441fccd;p=rust.git Correct definition of CONSOLE_SCREEN_BUFFER_INFO --- diff --git a/src/libterm/win.rs b/src/libterm/win.rs index 14ea68d3788..f5c60ee3522 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -20,19 +20,36 @@ pub struct WinConsole { background: color::Color, } +type SHORT = i16; type WORD = u16; type DWORD = u32; type BOOL = i32; type HANDLE = *mut u8; +#[allow(non_snake_case)] +#[repr(C)] +struct SMALL_RECT { + Left: SHORT, + Top: SHORT, + Right: SHORT, + Bottom: SHORT, +} + +#[allow(non_snake_case)] +#[repr(C)] +struct COORD { + X: SHORT, + Y: SHORT, +} + #[allow(non_snake_case)] #[repr(C)] struct CONSOLE_SCREEN_BUFFER_INFO { - dwSize: [libc::c_short; 2], - dwCursorPosition: [libc::c_short; 2], + dwSize: COORD, + dwCursorPosition: COORD, wAttributes: WORD, - srWindow: [libc::c_short; 4], - dwMaximumWindowSize: [libc::c_short; 2], + srWindow: SMALL_RECT, + dwMaximumWindowSize: COORD, } #[allow(non_snake_case)]