From 935b5f8bc73eac221d973747cd9e12758877e768 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 28 Nov 2002 21:35:49 +0000 Subject: [PATCH] * slint.c (getch): Return -1, not SLANG_GETKEY_ERROR, otherwise get_key_code() crashes when calling isalpha(). --- src/ChangeLog | 3 +++ src/TODO | 2 -- src/slint.c | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0c13819eb..5b28ba11d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2002-11-28 Pavel Roskin + * slint.c (getch): Return -1, not SLANG_GETKEY_ERROR, otherwise + get_key_code() crashes when calling isalpha(). + * color.c (mc_init_pair) [HAVE_SLANG]: Pass "default", not NULL to SLtt_set_color() - it fixes transparency with the latest versions of S-Lang. Treat foreground like background. diff --git a/src/TODO b/src/TODO index 516628b83..f76a5aae8 100644 --- a/src/TODO +++ b/src/TODO @@ -1,8 +1,6 @@ Before 4.6.0-pre2 ================= -Crash in isalpha() in key.c is c=0xFFFF. - get_byte() in view.c produces warnings in Valgrind. Don't allow stdout and stderr from extfs scripts pollute the screen. diff --git a/src/slint.c b/src/slint.c index acade058d..12b5a37f8 100644 --- a/src/slint.c +++ b/src/slint.c @@ -493,7 +493,8 @@ load_terminfo_keys (void) do_define_key (key_table [i].key_code, key_table [i].key_name); } -int getch (void) +int +getch (void) { int c; if (no_slang_delay) @@ -502,11 +503,13 @@ int getch (void) c = SLang_getkey2 (); if (c == SLANG_GETKEY_ERROR) { - fprintf (stderr, "SLang_getkey returned SLANG_GETKEY_ERROR\n" - "Assuming EOF on stdin and exiting\n"); + fprintf (stderr, + "SLang_getkey returned SLANG_GETKEY_ERROR\n" + "Assuming EOF on stdin and exiting\n"); quiet_quit_cmd (); + return -1; } - return (c); + return c; } #else