From 242cf488f136d2fe7dd986a4f0e6a0ad172f7456 Mon Sep 17 00:00:00 2001 From: dam Date: Thu, 28 Sep 2023 01:11:21 +0100 Subject: Fixed OS_read_input on Windows. --- TUI/windows.jai | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TUI/windows.jai b/TUI/windows.jai index 85dab0b..036b33b 100644 --- a/TUI/windows.jai +++ b/TUI/windows.jai @@ -171,9 +171,10 @@ OS_set_input_mode :: (mode: Input_Mode) { } OS_read_input :: (buffer: *u8, bytes_to_read: s64) -> bytes_read: s64, error: bool = false, error_message: string = "" { + assert(bytes_to_read <= 0x7fff_ffff, "The Windows API only allows to read up to s32 bytes from the standard input."); bytes_read: s32; - error := ReadConsoleA(stdin, buffer, bytes_to_read, *bytes_read); - if error { + success := ReadConsoleA(stdin, buffer, cast(s32)bytes_to_read, *bytes_read); + if success == false { _, error_message := get_error_value_and_string(); return -1, true, error_message; } -- cgit v1.2.3