summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-10-14 14:01:11 +0200
committerHendrik Leppkes <h.leppkes@gmail.com>2015-10-14 14:01:11 +0200
commitb994788353ec39677d9f751da5cf754ef6247773 (patch)
tree9bb1153a5bb5680fc5bc7d1385d832ee70266026
parentfcfb66ba9b6e8e8026fa38ea99e0458b31321217 (diff)
parent11c5f438ff83da5040e85bfa6299f56b321d32ef (diff)
Merge commit '11c5f438ff83da5040e85bfa6299f56b321d32ef'
* commit '11c5f438ff83da5040e85bfa6299f56b321d32ef': dict: Change return type of av_dict_copy() Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r--doc/APIchanges4
-rw-r--r--libavutil/dict.c11
-rw-r--r--libavutil/dict.h4
-rw-r--r--libavutil/version.h2
4 files changed, 16 insertions, 5 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 67605dca75..71b847d925 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2015-08-28
API changes, most recent first:
+2015-10-14 - xxxxxxx - lavu 55.4.100 / lavu 55.2.0 - dict.h
+ Change return type of av_dict_copy() from void to int, so that a proper
+ error code can be reported.
+
2015-09-29 - xxxxxxx - lavc 57.3.100 / lavc 57.2.0 - avcodec.h
Change type of AVPacket.duration from int to int64_t.
diff --git a/libavutil/dict.c b/libavutil/dict.c
index 6ff1af5215..8bb65a13fe 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -210,12 +210,17 @@ 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;
}
int av_dict_get_string(const AVDictionary *m, char **buffer,
diff --git a/libavutil/dict.h b/libavutil/dict.h
index f2df687c03..5b8d003396 100644
--- a/libavutil/dict.h
+++ b/libavutil/dict.h
@@ -162,8 +162,10 @@ 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. If dst was allocated
+ * by this function, callers should free the associated memory.
*/
-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
diff --git a/libavutil/version.h b/libavutil/version.h
index e39034dfc4..827f17829e 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -56,7 +56,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 3
+#define LIBAVUTIL_VERSION_MINOR 4
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \