[vlc-devel] commit: Commit the good version of the file. (Jean-Baptiste Kempf )

Jean-Paul Saman jpsaman at videolan.org
Mon May 12 19:31:56 CEST 2008


git version control wrote:
> vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon May 12 07:56:31 2008 -0700| [6f9ce7c339bad3306598e2ec77391c6ab27ef29f]
> 
> Commit the good version of the file.
> For the ones who wants to look at it, here is a complex script
> http://unicorn.us.com/jacosub/demo.txt
> 
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6f9ce7c339bad3306598e2ec77391c6ab27ef29f
> ---
> 
>  modules/demux/subtitle.c |   42 ++++++++++++++++++++----------------------
>  1 files changed, 20 insertions(+), 22 deletions(-)
> 
> diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
> index 8b23ed6..9a1580e 100644
> --- a/modules/demux/subtitle.c
> +++ b/modules/demux/subtitle.c
> @@ -1373,27 +1373,28 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
>  
>          if( !s )
>              return VLC_EGENERIC;
> -
> -        if( sscanf (s, "FORMAT=TIM%c", &p_dummy ) == 1 && p_dummy == 'E')
> +        if( strstr( s, "FORMAT" ) )
>          {
> -            mpsub_factor = 100.0;
> -            break;
> -        }
> +            if( sscanf (s, "FORMAT=TIM%c", &p_dummy ) == 1 && p_dummy == 'E')
> +            {
> +                mpsub_factor = 100.0;
> +                break;
> +            }
>  
> -        psz_temp = malloc( strlen(s) - 6 );
> -        if( sscanf( s, "FORMAT=%[^\r\n]", psz_temp ) )
> -        {
> -            float f_fps;
> -            f_fps = us_strtod( psz_temp, NULL );
> -            if( f_fps > 0.0 && var_GetFloat( p_demux, "sub-fps" ) <= 0.0 )
> -                var_SetFloat( p_demux, "sub-fps", f_fps );
> +            psz_temp = malloc( strlen(s) );

Please check malloc return value. Malloc can fail ! You don't want to 
override some other part of VLC's memory.

> +            if( sscanf( s, "FORMAT=%[^\r\n]", psz_temp ) )
> +            {
> +                float f_fps;
> +                f_fps = us_strtod( psz_temp, NULL );
> +                if( f_fps > 0.0 && var_GetFloat( p_demux, "sub-fps" ) <= 0.0 )
> +                    var_SetFloat( p_demux, "sub-fps", f_fps );
>  
> -            mpsub_factor = 1.0;
> +                mpsub_factor = 1.0;
> +                free( psz_temp );
> +                break;
> +            }
>              free( psz_temp );
> -            break;
>          }
> -        free( psz_temp );
> -
>          /* Data Lines */
>          if( sscanf (s, "%f %f", &f1, &f2 ) == 2 )
>          {
> @@ -1616,12 +1617,9 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
>  
>                      while ( *s2 == ' ' ) s2++;
>  
> -/*                    int i_len = strlen( psz_orig2 );
> -
> -
> -                    psz_orig2 = realloc( psz_orig2, strlen( s2 ) +  i_len + 1 );
> -
> -
> +                    /* Here to parse the second line, we should add s2 to
> +                       psz_text and go on the for( ) line 1556 in order to
> +                       parse the next line.
>                      */
>                  }
>              default:
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
> 

Gtz
Jean-Paul Saman.



More information about the vlc-devel mailing list