[vlc-devel] Possible bug
Rémi Denis-Courmont
remi at remlab.net
Tue Aug 11 09:19:46 CEST 2015
Le 2015-08-11 07:43, tony a écrit :
> In /source/vlc/src/input/input.c, in function LoadSubtitles,
> there's following code:
>
> if( i_attachment > 0 )
> var_Create( p_input, "sub-description", VLC_VAR_STRING );
> for( int i = 0; i < i_attachment; i++ )
> {
> input_attachment_t *a = pp_attachment[i];
> if( !a )
> continue;
> char *psz_mrl;
> if( a->psz_name[i] &&
> asprintf( &psz_mrl, "attachment://%s", a->psz_name ) >= 0
> )
> {
> var_SetString( p_input, "sub-description",
> a->psz_description ? a->psz_description : "");
>
> input_SubtitleAdd( p_input, psz_mrl, i_flags );
>
> i_flags = SUB_NOFLAG;
> free( psz_mrl );
> }
> vlc_input_attachment_Delete( a );
> }
> Now, a is the i th attachment, a->psz_name is just a c string,
> then why would we check a->psz_name[i]?
> If the string is zero length, shouldn't we check
> a->psz_name[0] instead?
> Since I don't fully understand it yet,
> I'm not entirely sure the author's intention.
It made sense before commit e331532c296a774d79a745acc8660e0d4bac8a1c.
It was probably accidentally left over.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list