diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2019-12-10 22:59:53 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-12-12 19:25:33 +0100 |
commit | c1e439d7e9abab3cebdc937636393b1656e095d9 (patch) | |
tree | be0ae941a23b62c42b152e2b9aa0a22f8c793d4e /libavformat/mpc8.c | |
parent | cb88cdf7730e309df22ddbbc1ae4ebcd9ebc529e (diff) | |
download | ffmpeg-c1e439d7e9abab3cebdc937636393b1656e095d9.tar.gz |
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/mpc8.c')
-rw-r--r-- | libavformat/mpc8.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index e452cd6878..dd13bbd0a4 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -212,7 +212,7 @@ static int mpc8_read_header(AVFormatContext *s) MPCContext *c = s->priv_data; AVIOContext *pb = s->pb; AVStream *st; - int tag = 0; + int tag = 0, ret; int64_t size, pos; c->header_pos = avio_tell(pb); @@ -253,8 +253,8 @@ static int mpc8_read_header(AVFormatContext *s) st->codecpar->codec_id = AV_CODEC_ID_MUSEPACK8; st->codecpar->bits_per_coded_sample = 16; - if (ff_get_extradata(s, st->codecpar, pb, 2) < 0) - return AVERROR(ENOMEM); + if ((ret = ff_get_extradata(s, st->codecpar, pb, 2)) < 0) + return ret; st->codecpar->channels = (st->codecpar->extradata[1] >> 4) + 1; st->codecpar->sample_rate = mpc8_rate[st->codecpar->extradata[0] >> 5]; @@ -277,7 +277,7 @@ static int mpc8_read_header(AVFormatContext *s) static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) { MPCContext *c = s->priv_data; - int tag; + int tag, ret; int64_t pos, size; while(!avio_feof(s->pb)){ @@ -291,8 +291,8 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) if (size < 0) return -1; if(tag == TAG_AUDIOPACKET){ - if(av_get_packet(s->pb, pkt, size) < 0) - return AVERROR(ENOMEM); + if ((ret = av_get_packet(s->pb, pkt, size)) < 0) + return ret; pkt->stream_index = 0; pkt->duration = 1; return 0; |