mirror of https://git.ffmpeg.org/ffmpeg.git
avutil/dict: Use av_dict_iterate in av_dict_get
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
9dad237928
commit
5f7c5a0bd7
|
@ -60,18 +60,14 @@ const AVDictionaryEntry *av_dict_iterate(const AVDictionary *m,
|
||||||
AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
|
AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
|
||||||
const AVDictionaryEntry *prev, int flags)
|
const AVDictionaryEntry *prev, int flags)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
const AVDictionaryEntry *entry = prev;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
if (!m || !key)
|
if (!key)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (prev)
|
while ((entry = av_dict_iterate(m, entry))) {
|
||||||
i = prev - m->elems + 1;
|
const char *s = entry->key;
|
||||||
else
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
for (; i < m->count; i++) {
|
|
||||||
const char *s = m->elems[i].key;
|
|
||||||
if (flags & AV_DICT_MATCH_CASE)
|
if (flags & AV_DICT_MATCH_CASE)
|
||||||
for (j = 0; s[j] == key[j] && key[j]; j++)
|
for (j = 0; s[j] == key[j] && key[j]; j++)
|
||||||
;
|
;
|
||||||
|
@ -82,7 +78,7 @@ AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
|
||||||
continue;
|
continue;
|
||||||
if (s[j] && !(flags & AV_DICT_IGNORE_SUFFIX))
|
if (s[j] && !(flags & AV_DICT_IGNORE_SUFFIX))
|
||||||
continue;
|
continue;
|
||||||
return &m->elems[i];
|
return (AVDictionaryEntry *)entry;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue