[MPlayer-dev-eng] [PATCH] Silence one warning in osdep/getch2.c
Ivan Kalvachev
ikalvachev at gmail.com
Sat Sep 15 14:49:17 CEST 2007
2007/9/14, Carl Eugen Hoyos <cehoyos at ag.or.at>:
> Hi!
>
> Attached patch fixes the following warning when compiling osdep/getch2.c
> (Credits to Diego and deganews).
>
> getch2.c: In function 'getch2':
> getch2.c:203: warning: suggest parentheses around && within ||
>
> Carl Eugen
>
>
> Index: osdep/getch2.c
> ===================================================================
> --- osdep/getch2.c (Revision 24451)
> +++ osdep/getch2.c (Arbeitskopie)
> @@ -200,7 +200,7 @@
> goto found;
> }
> }
> - if (c == '[' || c == 'O' && getch2_len >= 3) {
> + if (c == '[' || (c == 'O' && getch2_len >= 3)) {
> int c = getch2_buf[2];
The patch is wrong. The warning is about real error.
The code that follows reads the 3'd element (position 2 starting from 0),
so you must be sure that there are at least 3 chars in the buffer.
Moreover ESC [ and ESC O seems to be alternative variations, at least
for cursor keys.
I have found some hints in :
http://www.ibiblio.org/pub/historic-linux/ftp-archives/tsx-11.mit.edu/Oct-07-1996/info/vt102.codes
http://bjh21.me.uk/all-escapes/all-escapes.txt
Quite:
--------------
Mode: ?1
Mnemonic: DECCKM
Description: Cursor key mode
This is a private parameter to the SM and RM control requences. This
mode is only effective when the terminal is in keypad application mode
(DECPAM) and the ANSI/VT52 mode (DECANM) is set. Under these
conditions, if this mode is reset, the cursor keys will send ANSI
cursor control commands. If setm the cursor keys will send application
function commands.
Source: <URL: http://www.cs.utk.edu/~shuford/terminal/vt100_codes_news.txt>
DECCKM (default off): When set, the cursor keys send an ESC O prefix,
rather than ESC [.
Source: Linux console_codes(4)
Status: DEC private; VT100
-----------------------------------
I'm going to commit the proper fix really soon.
More information about the MPlayer-dev-eng
mailing list