[vlc-devel] [PATCH] playlist/directory: ignore case when sorting files

Francois Cartegnie fcvlcdev at free.fr
Thu Aug 20 15:30:55 CEST 2015


Le 20/08/2015 14:48, Thomas Guillem a écrit :
> +#ifdef HAVE_STRCOLL
> +    /* The program's LOCAL defines if case is ignored */
> +
> +    /* strxfrm(NULL, src, 0) returns the number of bytes required for the
> +     * transformation */
> +    char *psz_name1 = malloc( strxfrm( NULL, p1->psz_name, 0 ) + 1 );
> +    char *psz_name2 = malloc( strxfrm( NULL, p2->psz_name, 0 ) + 1 );
> +    if( !psz_name1 || !psz_name2 )
> +        return 0;
> +
> +    strxfrm( psz_name1, p1->psz_name, sizeof(psz_name1) );
> +    strxfrm( psz_name2, p2->psz_name, sizeof(psz_name2) );

man strxfrm:
 If the value returned is n or more, the contents of dest are
       indeterminate.

 The strxfrm() function may fail [...]


Francois


More information about the vlc-devel mailing list