[vlc-devel] [PATCH 4/5] subtitle demux: use qsort instead of bubblesort

Rémi Denis-Courmont remi at remlab.net
Sun Oct 4 09:59:14 CEST 2015


Le 2015-10-03 15:25, Ilkka Ollakka a écrit :
> Most likely no major speed difference with low amount of subtitles.
> ---
>  modules/demux/subtitle.c | 32 ++++++--------------------------
>  1 file changed, 6 insertions(+), 26 deletions(-)
>
> diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
> index 59b8e02..0afb9d1 100644
> --- a/modules/demux/subtitle.c
> +++ b/modules/demux/subtitle.c
> @@ -758,40 +758,20 @@ static int Demux( demux_t *p_demux )
>      return 1;
>  }
>
> +
> +static int subtitle_cmp( const void *first, const void *second )
> +{
> +    return ((subtitle_t *)(first))->i_start - ((subtitle_t
> *)(second))->i_start;
> +}

Undefined signed overflow if i_start exceeds INT_MAX.

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list