av_dict_set() could return an error, so forward it appropriately.
Signed-off-by: Vittorio Giovara <[email protected]>
---
libavutil/dict.c | 11 ++++++++---
libavutil/dict.h | 3 ++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/libavutil/dict.c b/libavutil/dict.c
index 4a9d50b..6a8a06e 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -188,10 +188,15 @@ void av_dict_free(AVDictionary **pm)
av_freep(pm);
}
-void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
+int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
{
AVDictionaryEntry *t = NULL;
- while ((t = av_dict_get(src, "", t, AV_DICT_IGNORE_SUFFIX)))
- av_dict_set(dst, t->key, t->value, flags);
+ while ((t = av_dict_get(src, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ int ret = av_dict_set(dst, t->key, t->value, flags);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
}
diff --git a/libavutil/dict.h b/libavutil/dict.h
index e4aee27..7579ea8 100644
--- a/libavutil/dict.h
+++ b/libavutil/dict.h
@@ -130,8 +130,9 @@ int av_dict_parse_string(AVDictionary **pm, const char *str,
* @param src pointer to source AVDictionary struct
* @param flags flags to use when setting entries in *dst
* @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
+ * @return 0 on success, negative AVERROR code on failure
*/
-void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
+int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
/**
* Free all the memory allocated for an AVDictionary struct
--
1.9.5 (Apple Git-50.3)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel