]> git.sesse.net Git - vlc/commitdiff
playlist_sort: sort using the title and fallback to the name when the title is empty.
authorRémi Duraffort <ivoire@videolan.org>
Sat, 25 Apr 2009 18:25:10 +0000 (20:25 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Sat, 25 Apr 2009 18:26:03 +0000 (20:26 +0200)
(this fix the sort which was buggy).

src/playlist/sort.c

index bc54f728f992a60c072e0ac651b0daf7d85f968a..e9d1e43482f2b8ca16e8a047aad2b45718e6fb39 100644 (file)
@@ -119,8 +119,10 @@ static int playlist_cmp(const void *first, const void *second)
 {
 
 #define META_STRCASECMP_NAME( ) { \
-    char *psz_i = input_item_GetName( (*(playlist_item_t **)first)->p_input ); \
-    char *psz_ismall = input_item_GetName( (*(playlist_item_t **)second)->p_input ); \
+    char *psz_i = input_item_GetTitle( (*(playlist_item_t **)first)->p_input ); \
+    char *psz_ismall = input_item_GetTitle( (*(playlist_item_t **)second)->p_input ); \
+    if(EMPTY_STR(psz_i)) {free(psz_i); psz_i = input_item_GetName( (*(playlist_item_t **)first)->p_input ); }\
+    if(EMPTY_STR(psz_ismall)) {free(psz_ismall); psz_ismall = input_item_GetName( (*(playlist_item_t **)second)->p_input ); }\
     if( psz_i != NULL && psz_ismall != NULL ) i_test = strcasecmp( psz_i, psz_ismall ); \
     else if ( psz_i == NULL && psz_ismall != NULL ) i_test = 1; \
     else if ( psz_ismall == NULL && psz_i != NULL ) i_test = -1; \