Commit e12a7324 authored by Roman Fietze's avatar Roman Fietze Committed by Michael Niedermayer

dict: const pointers to dictionary where possible

This avoids temporaries or ugly casting in the calling code where
const dictionaries are used. Esp. helpful when writing C++ wrappers
for an AVDictionary having const member functions and CTORs with const
references.
Signed-off-by: 's avatarRoman Fietze <roman.fietze@telemotive.de>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent fd2bcfc4
...@@ -35,7 +35,7 @@ int av_dict_count(const AVDictionary *m) ...@@ -35,7 +35,7 @@ int av_dict_count(const AVDictionary *m)
return m ? m->count : 0; return m ? m->count : 0;
} }
AVDictionaryEntry *av_dict_get(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; unsigned int i, j;
...@@ -181,7 +181,7 @@ void av_dict_free(AVDictionary **pm) ...@@ -181,7 +181,7 @@ void av_dict_free(AVDictionary **pm)
av_freep(pm); av_freep(pm);
} }
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags) void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
{ {
AVDictionaryEntry *t = NULL; AVDictionaryEntry *t = NULL;
......
...@@ -98,7 +98,7 @@ typedef struct AVDictionary AVDictionary; ...@@ -98,7 +98,7 @@ typedef struct AVDictionary AVDictionary;
* @return found entry or NULL in case no matching entry was found in the dictionary * @return found entry or NULL in case no matching entry was found in the dictionary
*/ */
AVDictionaryEntry * AVDictionaryEntry *
av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
/** /**
* Get number of entries in dictionary. * Get number of entries in dictionary.
...@@ -148,7 +148,7 @@ int av_dict_parse_string(AVDictionary **pm, const char *str, ...@@ -148,7 +148,7 @@ int av_dict_parse_string(AVDictionary **pm, const char *str,
* @param flags flags to use when setting entries in *dst * @param flags flags to use when setting entries in *dst
* @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
*/ */
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
/** /**
* Free all the memory allocated for an AVDictionary struct * Free all the memory allocated for an AVDictionary struct
......
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