X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=db.c;h=9db622bca3ca6447fcc1659a0c270d49d2b36f60;hp=a1cc1aebc09e18c01d2685919bd6c407447d4c8b;hb=8b2c02c8d6255583982e767374d39375b3380c4d;hpb=1f556ae88bd8c85d4452f689f532f5a6abeabe92 diff --git a/db.c b/db.c index a1cc1aeb..9db622bc 100644 --- a/db.c +++ b/db.c @@ -28,28 +28,6 @@ #include "error.h" #include "string.h" -/* - * return 1 if name matches any supported audio format - */ -static int match_audio_file_name(char *name) -{ - int i, len = strlen(name); - const char *pattern[] = {SUPPORTED_AUDIO_FORMATS_ARRAY}; - - for (i = 0; pattern[i]; i++) { - const char *p = pattern[i]; - int plen = strlen(p); - if (len < plen + 1) - continue; - if (name[len - plen - 1] != '.') - continue; - if (strcasecmp(name + len - plen, p)) - continue; - return 1; - } - return 0; -} - /** * traverse the given directory recursively * @@ -102,7 +80,7 @@ int find_audio_files(const char *dirname, int (*f)(const char *, const char *)) if (!S_ISREG(m) && !S_ISDIR(m)) /* skip links, sockets, ... */ continue; if (S_ISREG(m)) { /* regular file */ - if (!match_audio_file_name(entry->d_name)) + if (guess_audio_format(entry->d_name) < 0) continue; if (f(dirname, entry->d_name) < 0) goto out; @@ -123,6 +101,6 @@ out: ret = -E_CHDIR; close(cwd_fd); if (ret < 0) - PARA_ERROR_LOG("ret = %x\n", -ret); + PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret)); return ret; }