diff mbox

[FFmpeg-devel,05/11] avformat/apngdec: Remove goto fail that does nothing

Message ID 20191210215955.11178-5-andreas.rheinhardt@gmail.com
State Superseded
Headers show

Commit Message

Andreas Rheinhardt Dec. 10, 2019, 9:59 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/apngdec.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

Comments

Michael Niedermayer Jan. 11, 2020, 10:46 p.m. UTC | #1
On Tue, Dec 10, 2019 at 10:59:49PM +0100, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/apngdec.c | 31 ++++++++++++-------------------
>  1 file changed, 12 insertions(+), 19 deletions(-)

will apply

thx

[...]
Michael Niedermayer Jan. 11, 2020, 10:59 p.m. UTC | #2
On Sat, Jan 11, 2020 at 11:46:07PM +0100, Michael Niedermayer wrote:
> On Tue, Dec 10, 2019 at 10:59:49PM +0100, Andreas Rheinhardt wrote:
> > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> > ---
> >  libavformat/apngdec.c | 31 ++++++++++++-------------------
> >  1 file changed, 12 insertions(+), 19 deletions(-)
> 
> will apply

will apply but not yet as it depends on the previous apngdec patch which
is being reworked and wasnt approved yet.
... I didnt realize as i had it applied locally, and mkver reminded me
too
diff mbox

Patch

diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
index 6c58fd9d04..f66432f2d6 100644
--- a/libavformat/apngdec.c
+++ b/libavformat/apngdec.c
@@ -151,17 +151,17 @@  static int apng_read_header(AVFormatContext *s)
     uint32_t len, tag;
     AVStream *st;
     int acTL_found = 0;
-    int64_t ret = AVERROR_INVALIDDATA;
+    int64_t ret;
 
     /* verify PNGSIG */
     if (avio_rb64(pb) != PNGSIG)
-        return ret;
+        return AVERROR_INVALIDDATA;
 
     /* parse IHDR (must be first chunk) */
     len = avio_rb32(pb);
     tag = avio_rl32(pb);
     if (len != 13 || tag != MKTAG('I', 'H', 'D', 'R'))
-        return ret;
+        return AVERROR_INVALIDDATA;
 
     st = avformat_new_stream(s, NULL);
     if (!st)
@@ -186,18 +186,16 @@  static int apng_read_header(AVFormatContext *s)
     AV_WB32(st->codecpar->extradata+8,  st->codecpar->width);
     AV_WB32(st->codecpar->extradata+12, st->codecpar->height);
     if ((ret = avio_read(pb, st->codecpar->extradata+16, 9)) < 0)
-        goto fail;
+        return ret;
 
     while (!avio_feof(pb)) {
         if (acTL_found && ctx->num_play != 1) {
             int64_t size   = avio_size(pb);
             int64_t offset = avio_tell(pb);
             if (size < 0) {
-                ret = size;
-                goto fail;
+                return size;
             } else if (offset < 0) {
-                ret = offset;
-                goto fail;
+                return offset;
             } else if ((ret = ffio_ensure_seekback(pb, size - offset)) < 0) {
                 av_log(s, AV_LOG_WARNING, "Could not ensure seekback, will not loop\n");
                 ctx->num_play = 1;
@@ -205,12 +203,11 @@  static int apng_read_header(AVFormatContext *s)
         }
         if ((ctx->num_play == 1 || !acTL_found) &&
             ((ret = ffio_ensure_seekback(pb, 4 /* len */ + 4 /* tag */)) < 0))
-            goto fail;
+            return ret;
 
         len = avio_rb32(pb);
         if (len > 0x7fffffff) {
-            ret = AVERROR_INVALIDDATA;
-            goto fail;
+            return AVERROR_INVALIDDATA;
         }
 
         tag = avio_rl32(pb);
@@ -218,7 +215,7 @@  static int apng_read_header(AVFormatContext *s)
         case MKTAG('a', 'c', 'T', 'L'):
             if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 ||
                 (ret = append_extradata(st->codecpar, pb, len + 12)) < 0)
-                goto fail;
+                return ret;
             acTL_found = 1;
             ctx->num_frames = AV_RB32(st->codecpar->extradata + ret + 8);
             ctx->num_play   = AV_RB32(st->codecpar->extradata + ret + 12);
@@ -227,23 +224,19 @@  static int apng_read_header(AVFormatContext *s)
             break;
         case MKTAG('f', 'c', 'T', 'L'):
             if (!acTL_found) {
-               ret = AVERROR_INVALIDDATA;
-               goto fail;
+               return AVERROR_INVALIDDATA;
             }
             if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0)
-                goto fail;
+                return ret;
             return 0;
         default:
             if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 ||
                 (ret = append_extradata(st->codecpar, pb, len + 12)) < 0)
-                goto fail;
+                return ret;
         }
     }
 
     return AVERROR_EOF;
-
-fail:
-    return ret;
 }
 
 static int decode_fctl_chunk(AVFormatContext *s, APNGDemuxContext *ctx, AVPacket *pkt)