[vlc-devel] commit: playlist_sort: sort using the title and fallback to the name when the title is empty. ( Rémi Duraffort )

git version control git at videolan.org
Sat Apr 25 20:28:03 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Apr 25 20:25:10 2009 +0200| [832f2aa82f23ab4c481e3457dddd427eb097d66f] | committer: Rémi Duraffort 

playlist_sort: sort using the title and fallback to the name when the title is empty.
(this fix the sort which was buggy).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=832f2aa82f23ab4c481e3457dddd427eb097d66f
---

 src/playlist/sort.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/playlist/sort.c b/src/playlist/sort.c
index bc54f72..e9d1e43 100644
--- a/src/playlist/sort.c
+++ b/src/playlist/sort.c
@@ -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; \




More information about the vlc-devel mailing list