[vlc-devel] [PATCH 02/11] input/subtitles: refactor subtitles_Detect

Thomas Guillem thomas at gllm.fr
Wed May 4 13:41:54 CEST 2016



On Wed, May 4, 2016, at 10:50, Denis Charmet wrote:
> On 2016-05-03 19:01, Thomas Guillem wrote:
> > On Sat, Apr 2, 2016, at 11:31, Rémi Denis-Courmont wrote:
> >> On Friday 01 April 2016 10:31:01 Thomas Guillem wrote:
> >>> +
> >>> +    if( p_slave0->i_priority > p_slave1->i_priority )
> >>> +        return -1;
> >>> +
> >>> +    if( p_slave0->i_priority < p_slave1->i_priority )
> >>> +        return 1;
> >>> +
> >>> +#ifdef HAVE_STRCOLL
> >>> +    return strcoll( p_slave0->psz_uri, p_slave1->psz_uri );
> >>> +#else
> >>> +    return strcmp( p_slave0->psz_uri, p_slave1->psz_uri );
> >>> +#endif
> >> 
> >> This does not make any sense to me.
> > 
> > I don't see why this doesn't make senses. This part of code was copied
> > from subtitles.c
> > 
> 
> Just because legacy code does weird stuff doesn't mean that new code 
> should :)
> 
> Using the return of strcmp/strcoll only makes sense if it's zero all 
> the other cases are completely arbitrary... While I agree that it's a 
> "stable way" to order them it feels wrong to order them using uri 
> instead of order of insertion.
> 
> Regards,

In fact, we should only sort by priority.

There is also the case of upnp subtitles where the url doesn't contain
any filename.

> -- 
> Denis Charmet - TypX
> Le mauvais esprit est un art de vivre
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list