[vlc-devel] [PATCH 2/3] Detect subtitles charset using uchardet

Jean-Baptiste Kempf jb at videolan.org
Tue Apr 9 13:10:52 CEST 2019


Hello,

On Sun, 7 Apr 2019, at 20:39, pertuleha at gmail.com wrote:
> +# define SUBTITLE_C_NEED_MERGE_TEXT

This is a very weird name for a define.

> +    for ( char *psz_line = TextGetLine( txt );
> +          NULL != psz_line;
> +          psz_line = TextGetLine( txt ) ) {
> +
> +        size_t i_line_len = strlen( psz_line );
> +
> +        psz_merged = realloc( psz_merged, i_merged_len + i_line_len + 
> 1 );
> +        if ( NULL == psz_merged ) {
> +            return NULL;
> +        }
> +
> +        /* strcat( (dst + dst_len), src ) instead of simple strcat( 
> dst, src )
> +           optimizes text concat to O(N) instead of O(N^2) */
> +        strcat( (psz_merged + i_merged_len), psz_line );
> +        i_merged_len += i_line_len;
> +    }
> +    TextResetLine( txt );

Are you sure you are not reinventing the wheel here?



-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list