[vlc-devel] [PATCH] Introducing Intelligent Approximate playlist search

Francois Cartegnie fcvlcdev at free.fr
Sat Mar 16 19:59:29 CET 2013


Le 16/03/2013 19:08, Abhiram Ravi a écrit :

Some comments:

You're malloc'ing everywhere without any check.

> -#define PLAYLIST_DEBUG 1
>  //#undef PLAYLIST_DEBUG2
> +#define PLAYLIST_DEBUG 1

?

> +int levenshtein_distance ( const char* psz_string_1, const char* psz_string_2 )
> +{
> +    // Converting the strings to lower case
> +    for ( char *p = psz_string_1; *p; ++p ) *p=*p>0x40&&*p<0x5b?*p|0x60:*p;
> +    for ( char *p = psz_string_2; *p; ++p ) *p=*p>0x40&&*p<0x5b?*p|0x60:*p;

const char * is not to be modified.

Won't work with UTF8.

> +            iarray_distance [i] [j] = 10000000; //TODO:define this somewhere

Max is INT_MAX

> +static int split_into_words ( char*** psz_split_destination, const char* psz_sentence, const char* split_char_string )
> +{

In psz_, p means pointer. Re-read notation.
Same at multiple place.

Francois



More information about the vlc-devel mailing list