diff options
| author | dam <dam@gudinoff> | 2023-09-28 01:11:21 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2023-09-28 01:11:21 +0100 |
| commit | 242cf488f136d2fe7dd986a4f0e6a0ad172f7456 (patch) | |
| tree | 6372233a8e070a4f22e928ab2cd499d776bb7c75 | |
| parent | 32621b9b18a285dfd5e9e225073809bc49b14f39 (diff) | |
| download | task-time-tracker-242cf488f136d2fe7dd986a4f0e6a0ad172f7456.tar.zst task-time-tracker-242cf488f136d2fe7dd986a4f0e6a0ad172f7456.zip | |
Fixed OS_read_input on Windows.
| -rw-r--r-- | TUI/windows.jai | 5 |
1 files 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; } |
