Commit 3c0b98dc authored by Michael Niedermayer's avatar Michael Niedermayer

avutil/avstring: Reimplement av_match_list()

av_match_list() is only used for whitelists, fix it so it works with
multi-named formats like "mov,mp4,m4a,3gp,3g2,mj2"
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent cebe8c80
...@@ -404,22 +404,21 @@ end: ...@@ -404,22 +404,21 @@ end:
int av_match_list(const char *name, const char *list, char separator) int av_match_list(const char *name, const char *list, char separator)
{ {
const char *p; const char *p, *q;
char ext1[128], *q;
int i; for (p = name; p && *p; ) {
for (q = list; q && *q; ) {
p = list; int k;
for (i = 1;; i++) { for (k = 0; p[k] == q[k] || (p[k]*q[k] == 0 && p[k]+q[k] == ','); k++)
q = ext1; if (k && (!p[k] || p[k] == ','))
while (*p != '\0' && *p != separator && q - ext1 < sizeof(ext1) - 1) return 1;
*q++ = *p++; q = strchr(q, ',');
*q = '\0'; q += !!q;
if (!av_strcasecmp(ext1, name)) }
return i; p = strchr(p, ',');
if (*p == '\0') p += !!p;
break;
p++;
} }
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment