changeset 3945:0b93c2b0cd59

make filter_by_extension() case insensitive.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Fri, 16 Nov 2007 02:49:24 +0900
parents 1dcfe91e241d
children 081a8ee0c0ae
files src/audacious/playlist.c
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Thu Nov 15 13:04:32 2007 +0100
+++ b/src/audacious/playlist.c	Fri Nov 16 02:49:24 2007 +0900
@@ -3471,9 +3471,10 @@
 static gboolean
 filter_by_extension(const gchar *uri)
 {
-    gchar *base, *ext, *filename;
+    gchar *base, *ext, *lext, *filename;
     gchar *tmp = g_filename_from_uri(uri, NULL, NULL);
-    
+    gboolean rv;
+
     filename = g_strdup(tmp ? tmp : uri);
     g_free(tmp);
     
@@ -3486,17 +3487,23 @@
 #if 0
         if(g_file_test(filename, G_FILE_TEST_IS_REGULAR)) { //allow a file without extension.
             g_print("no ext file\n");
-            return TRUE;
+            rv = TRUE;
         }
         else
-            return FALSE;
+            rv = FALSE;
 #else
-        return FALSE; //disallow.
+        rv = FALSE; //disallow.
 #endif
+        return rv;
     }
 
-    if(g_hash_table_lookup(ext_hash, ext+1))
-        return TRUE;
+    lext = g_ascii_strdown(ext+1, -1);
+
+    if(g_hash_table_lookup(ext_hash, lext))
+        rv = TRUE;
     else
-        return FALSE;
+        rv = FALSE;
+
+    g_free(lext);
+    return rv;
 }