History

dict: Change return type of av_dict_copy()

av_dict_set() could return an error, so forward it appropriately.

Vittorio Giovara committed 11 years ago

Commit 11c5f431 parent c1aac394 files · +16 −5Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavutil/dict.c +8 −3
  3. libavutil/dict.h +3 −1
  4. libavutil/version.h +1 −1
doc/APIchanges+4−0
@@ -13,6 +13,10 @@ libavutil: 2015-08-28 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2015-xx-xx - xxxxxxx - lavu 55.2.0 - dict.h
17+ Change return type of av_dict_copy() from void to int, so that a proper
18+ error code can be reported.
19+
1620 2015-xx-xx - xxxxxxx - lavc 57.0.0 - avcodec.h
1721 Change type of AVPacket.duration from int to int64_t.
1822
libavutil/dict.c+8−3
@@ -186,10 +186,15 @@ void av_dict_free(AVDictionary **pm) · 185 unmodified lines
186186 av_freep(pm);
187187 }
188188
189−void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
189+int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
190190 {
191191 AVDictionaryEntry *t = NULL;
192192
193− while ((t = av_dict_get(src, "", t, AV_DICT_IGNORE_SUFFIX)))
194− av_dict_set(dst, t->key, t->value, flags);
193+ while ((t = av_dict_get(src, "", t, AV_DICT_IGNORE_SUFFIX))) {
194+ int ret = av_dict_set(dst, t->key, t->value, flags);
195+ if (ret < 0)
196+ return ret;
197+ }
198+
199+ return 0;
195200 }
libavutil/dict.h+3−1
@@ -130,8 +130,10 @@ int av_dict_parse_string(AVDictionary **pm, const char *str, · 129 unmodified lines
130130 * @param src pointer to source AVDictionary struct
131131 * @param flags flags to use when setting entries in *dst
132132 * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
133+ * @return 0 on success, negative AVERROR code on failure. If dst was allocated
134+ * by this function, callers should free the associated memory.
133135 */
134−void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
136+int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
135137
136138 /**
137139 * Free all the memory allocated for an AVDictionary struct
libavutil/version.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 */
5555
5656 #define LIBAVUTIL_VERSION_MAJOR 55
57−#define LIBAVUTIL_VERSION_MINOR 1
57+#define LIBAVUTIL_VERSION_MINOR 2
5858 #define LIBAVUTIL_VERSION_MICRO 0
5959
6060 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t