diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-10-03 04:12:15 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-10-03 04:12:15 +0300 |
commit | 318559056f22352d57145b36e1292941ae7353cd (patch) | |
tree | 059ae9b0695385dc522e3016feeda7aee2047880 /osdep | |
parent | 377ae044e2044000477fe1adf3209c02638bacc7 (diff) |
getch2.c: fix negative keycodes returned for non-ascii
getch2.c read data into a "char" array, and returned values other than
escape sequences directly from there. This meant that it could return
negative values (except on platforms where "char" is unsigned) if the
input contained bytes >= 128. This would break later parsing in
input.c as the values would be interpreted as having the MP_KEY_DOWN
flag set, which would make the key binding code think a key is held
down (and never released). Fix by changing the buffer type to unsigned
char.
The bug itself was very old, but started triggering visible breakage
more easily after commit 82b8f89baea ("input: rework event reading and
command queuing"). Before that the key values would be passed through
the input.c "key read function" interface, which (mis)interpreted the
negative values as errors from the function, and in most cases
discarded them without much visible effect.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/getch2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/osdep/getch2.c b/osdep/getch2.c index 96fe45729a..81d13d9d7b 100644 --- a/osdep/getch2.c +++ b/osdep/getch2.c @@ -65,7 +65,7 @@ static struct termios tio_orig; #endif static int getch2_len=0; -static char getch2_buf[BUF_LEN]; +static unsigned char getch2_buf[BUF_LEN]; int screen_width=80; int screen_height=24; |