[MPlayer-cvslog] r23245 - in trunk: cfg-mplayer.h libmenu/menu.c

Rich Felker dalias at aerifal.cx
Thu May 10 17:05:12 CEST 2007


On Mon, May 07, 2007 at 06:33:30PM +0200, Reimar Döffinger wrote:
> Hello,
> On Mon, May 07, 2007 at 05:55:59PM +0200, ben wrote:
> [...]
> > +static int get_next_char(char **txt)
> > +{
> > +  int c;
> > +  c = (unsigned char)*(*txt)++;
> > +  if (c >= 0x80) {
> > +    if (menu_utf8){
> > +      if ((c & 0xe0) == 0xc0)    /* 2 bytes U+00080..U+0007FF*/
> > +        c = (c & 0x1f)<<6 | ((unsigned char)*(*txt)++ & 0x3f);
> > +      else if((c & 0xf0) == 0xe0){ /* 3 bytes U+00800..U+00FFFF*/
> > +        c = (((c & 0x0f)<<6) | ((unsigned char)*(*txt)++ & 0x3f))<<6;
> > +        c |= ((unsigned char)*(*txt)++ & 0x3f);
> > +      }
> > +    } else if (menu_unicode)
> > +      c = (c<<8) + (unsigned char)*(*txt)++;
> > +  }
> > +  if (!c) c++; // avoid UCS 0
> > +  return c;
> 
> Please try to reuse utf8_get_char or libavutil GET_UTF8, this code is an
> ugly mess and probably also less robust.

Also this should not be a configure option, or at least the default
should be taken from the system configuration. Having to manually
"enable utf-8" in every application is utterly broken. Menu should use
whatever the configured internal charset of MPlayer is.

Also, calling UCS-2 "Unicode" is utterly brain-damaged and incorrect.
DO NOT DO THIS!!!

Rich



More information about the MPlayer-cvslog mailing list