- if (((subfn*)a)->priority > ((subfn*)b)->priority) {
- return -1;
- } else if (((subfn*)a)->priority < ((subfn*)b)->priority) {
- return 1;
- } else {
- return strcoll(((subfn*)a)->psz_fname, ((subfn*)b)->psz_fname);
+ const vlc_subfn_t *p0 = a;
+ const vlc_subfn_t *p1 = b;
+
+ if( p0->priority > p1->priority )
+ return -1;
+
+ if( p0->priority < p1->priority )
+ return 1;
+
+#ifndef UNDER_CE
+ return strcoll( p0->psz_fname, p1->psz_fname);
+#else
+ return strcmp( p0->psz_fname, p1->psz_fname);
+#endif
+}
+
+/*
+ * Check if a file ends with a subtitle extension
+ */
+int subtitles_Filter( const char *psz_dir_content )
+{
+ const char *tmp = strrchr( psz_dir_content, '.');
+
+ if( !tmp )
+ return 0;
+ tmp++;
+
+ for( int i = 0; sub_exts[i][0]; i++ )
+ if( strcasecmp( sub_exts[i], tmp ) == 0 )
+ return 1;
+ return 0;
+}
+
+
+/**
+ * Convert a list of paths separated by ',' to a char**
+ */
+static char **paths_to_list( const char *psz_dir, char *psz_path )
+{
+ unsigned int i, k, i_nb_subdirs;
+ char **subdirs; /* list of subdirectories to look in */
+ char *psz_parser = psz_path;
+
+ if( !psz_dir || !psz_path )
+ return NULL;
+
+ for( k = 0, i_nb_subdirs = 1; psz_path[k] != '\0'; k++ )
+ {
+ if( psz_path[k] == ',' )
+ i_nb_subdirs++;