Mercurial > audlegacy
comparison src/audacious/playlist.c @ 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 | e924c9ee3958 |
children | eb20411bb9e1 |
comparison
equal
deleted
inserted
replaced
3940:1dcfe91e241d | 3945:0b93c2b0cd59 |
---|---|
3469 } | 3469 } |
3470 | 3470 |
3471 static gboolean | 3471 static gboolean |
3472 filter_by_extension(const gchar *uri) | 3472 filter_by_extension(const gchar *uri) |
3473 { | 3473 { |
3474 gchar *base, *ext, *filename; | 3474 gchar *base, *ext, *lext, *filename; |
3475 gchar *tmp = g_filename_from_uri(uri, NULL, NULL); | 3475 gchar *tmp = g_filename_from_uri(uri, NULL, NULL); |
3476 | 3476 gboolean rv; |
3477 | |
3477 filename = g_strdup(tmp ? tmp : uri); | 3478 filename = g_strdup(tmp ? tmp : uri); |
3478 g_free(tmp); | 3479 g_free(tmp); |
3479 | 3480 |
3480 base = g_path_get_basename(filename); | 3481 base = g_path_get_basename(filename); |
3481 ext = strrchr(base, '.'); | 3482 ext = strrchr(base, '.'); |
3484 | 3485 |
3485 if(!ext) { | 3486 if(!ext) { |
3486 #if 0 | 3487 #if 0 |
3487 if(g_file_test(filename, G_FILE_TEST_IS_REGULAR)) { //allow a file without extension. | 3488 if(g_file_test(filename, G_FILE_TEST_IS_REGULAR)) { //allow a file without extension. |
3488 g_print("no ext file\n"); | 3489 g_print("no ext file\n"); |
3489 return TRUE; | 3490 rv = TRUE; |
3490 } | 3491 } |
3491 else | 3492 else |
3492 return FALSE; | 3493 rv = FALSE; |
3493 #else | 3494 #else |
3494 return FALSE; //disallow. | 3495 rv = FALSE; //disallow. |
3495 #endif | 3496 #endif |
3496 } | 3497 return rv; |
3497 | 3498 } |
3498 if(g_hash_table_lookup(ext_hash, ext+1)) | 3499 |
3499 return TRUE; | 3500 lext = g_ascii_strdown(ext+1, -1); |
3501 | |
3502 if(g_hash_table_lookup(ext_hash, lext)) | |
3503 rv = TRUE; | |
3500 else | 3504 else |
3501 return FALSE; | 3505 rv = FALSE; |
3502 } | 3506 |
3507 g_free(lext); | |
3508 return rv; | |
3509 } |