[MPlayer-dev-eng] [PATCH] Silence one warning in osdep/getch2.c

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Sep 15 18:48:45 CEST 2007


Hello,
On Sat, Sep 15, 2007 at 03:49:17PM +0300, Ivan Kalvachev wrote:
> 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 think it's nearly obvious even without the specs.

[...]
> I'm going to commit the proper fix really soon.

Please do it. Or tell me and I'll do it at once.

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list