*/
-/** \file db.c functions common to all database tools. */
+/** \file db.c functions common to all audio file selectors */
#include "server.cmdline.h"
#include "server.h"
*/
static int match_audio_file_name(char *name)
{
- int i, len = strlen(name);
- const char *pattern[] = {SUPPORTED_AUDIO_FORMATS_ARRAY};
+ int i,j, len = strlen(name);
- 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;
+ FOR_EACH_AUDIO_FORMAT(i) {
+ for (j = 0; afl[i].suffixes[j]; j++) {
+ const char *p = afl[i].suffixes[j];
+ 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;
}
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;
}