summaryrefslogtreecommitdiff
path: root/libavformat/asfenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-12-10 22:59:53 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-12 19:25:33 +0100
commitc1e439d7e9abab3cebdc937636393b1656e095d9 (patch)
treebe0ae941a23b62c42b152e2b9aa0a22f8c793d4e /libavformat/asfenc.c
parentcb88cdf7730e309df22ddbbc1ae4ebcd9ebc529e (diff)
avformat: Forward errors where possible
It is not uncommon to find code where the caller thinks to know better what the return value should be than the callee. E.g. something like "if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit changes several instances of this to instead forward the actual error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/asfenc.c')
-rw-r--r--libavformat/asfenc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 9f54173bf9..44e11fc763 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -357,12 +357,12 @@ static int asf_write_markers(AVFormatContext *s)
int64_t pres_time = av_rescale_q(c->start, c->time_base, scale);
uint64_t offset;
int32_t send_time = get_send_time(asf, pres_time, &offset);
- int len = 0;
+ int len = 0, ret;
uint8_t *buf;
AVIOContext *dyn_buf;
if (t) {
- if (avio_open_dyn_buf(&dyn_buf) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+ return ret;
avio_put_str16le(dyn_buf, t->value);
len = avio_close_dyn_buf(dyn_buf, &buf);
}
@@ -579,12 +579,12 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
/* title and other info */
if (has_title) {
- int len;
+ int len, ret;
uint8_t *buf;
AVIOContext *dyn_buf;
- if (avio_open_dyn_buf(&dyn_buf) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+ return ret;
hpos = put_header(pb, &ff_asf_comment_header);
@@ -714,10 +714,10 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
if (desc) {
AVIOContext *dyn_buf;
uint8_t *buf;
- int len;
+ int len, ret;
- if (avio_open_dyn_buf(&dyn_buf) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+ return ret;
avio_put_str16le(dyn_buf, desc);
len = avio_close_dyn_buf(dyn_buf, &buf);