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

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon May 7 18:33:30 CEST 2007


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.

Greetings,
Reimar Döffinger



More information about the MPlayer-cvslog mailing list