[MPlayer-cvslog] r25326 - in trunk: libmpdemux/demux_mkv.c vobsub.c

Ulion ulion2002 at gmail.com
Mon Dec 10 05:37:42 CET 2007


2007/12/9, Ulion <ulion2002 at gmail.com>:
> 2007/12/9, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
> > > Modified: trunk/libmpdemux/demux_mkv.c
> > > ==============================================================================
> > > --- trunk/libmpdemux/demux_mkv.c      (original)
> > > +++ trunk/libmpdemux/demux_mkv.c      Sun Dec  9 07:58:57 2007
> > > @@ -356,13 +356,15 @@ vobsub_parse_custom_colors (sh_sub_t *sh
> > >            use_custom_colors ? "ON" : "OFF");
> > >     if ((start = strstr(start, "colors:")) != NULL)
> > >       {
> > > +       unsigned int tmp;
> > >         start += 7;
> > >         while (isspace(*start))
> > >           start++;
> > >         for (i = 0; i < 4; i++)
> > >           {
> > > -           if (sscanf(start, "%06x", &sh->colors[i]) != 1)
> > > +           if (sscanf(start, "%06x", &tmp) != 1)
> > >               break;
> > > +           sh->colors[i] = vobsub_rgb_to_yuv(tmp);
> >
> > I actually meant declaring tmp inside the block of the for loop,
> > there is no need for it to keep its value between iterations (and
> > I doubt that it is possible for the compiler to find this out in this
> > case).
> > Not that it matters much though.
>
> Oh, I missed that. How about this fix:
>
> Index: libmpdemux/demux_mkv.c
> ===================================================================
> --- libmpdemux/demux_mkv.c      (revision 25326)
> +++ libmpdemux/demux_mkv.c      (working copy)
> @@ -306,13 +306,14 @@
>  static int
>  vobsub_parse_palette (sh_sub_t *sh, const char *start)
>  {
> -  int i, tmp;
> +  int i;
>
>    start += 8;
>    while (isspace(*start))
>      start++;
>    for (i = 0; i < 16; i++)
>      {
> +      unsigned int tmp;
>        if (sscanf(start, "%06x", &tmp) != 1)
>          break;
>        sh->palette[i] = vobsub_palette_to_yuv(tmp);
> @@ -356,12 +357,12 @@
>            use_custom_colors ? "ON" : "OFF");
>     if ((start = strstr(start, "colors:")) != NULL)
>       {
> -       unsigned int tmp;
>         start += 7;
>         while (isspace(*start))
>           start++;
>         for (i = 0; i < 4; i++)
>           {
> +           unsigned int tmp;
>             if (sscanf(start, "%06x", &tmp) != 1)
>               break;
>             sh->colors[i] = vobsub_rgb_to_yuv(tmp);

Done.

-- 
Ulion



More information about the MPlayer-cvslog mailing list