diff mbox series

[FFmpeg-devel,1/3] avformat/webpenc: Return early to reduce indentation

Message ID AS8P250MB0744B198F01BF81A60ED7DD18FA5A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 18d7a97f9e061aff5d743aab62a5c26244e9629d
Headers show
Series [FFmpeg-devel,1/3] avformat/webpenc: Return early to reduce indentation | expand

Commit Message

Andreas Rheinhardt Nov. 3, 2023, 4:09 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/webpenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andreas Rheinhardt Dec. 7, 2023, 6:29 p.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/webpenc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
> index fb0cca3922..9ac353c967 100644
> --- a/libavformat/webpenc.c
> +++ b/libavformat/webpenc.c
> @@ -80,12 +80,13 @@ static int flush(AVFormatContext *s, int trailer, int64_t pts)
>  {
>      WebpContext *w = s->priv_data;
>      AVStream *st = s->streams[0];
> -
> -    if (w->last_pkt->size) {
>          int skip = 0;
>          unsigned flags = 0;
>          int vp8x = 0;
>  
> +    if (!w->last_pkt->size)
> +        return 0;
> +
>          if (AV_RL32(w->last_pkt->data) == AV_RL32("RIFF"))
>              skip = 12;
>  
> @@ -139,7 +140,6 @@ static int flush(AVFormatContext *s, int trailer, int64_t pts)
>          }
>          avio_write(s->pb, w->last_pkt->data + skip, w->last_pkt->size - skip);
>          av_packet_unref(w->last_pkt);
> -    }
>  
>      return 0;
>  }

Will apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index fb0cca3922..9ac353c967 100644
--- a/libavformat/webpenc.c
+++ b/libavformat/webpenc.c
@@ -80,12 +80,13 @@  static int flush(AVFormatContext *s, int trailer, int64_t pts)
 {
     WebpContext *w = s->priv_data;
     AVStream *st = s->streams[0];
-
-    if (w->last_pkt->size) {
         int skip = 0;
         unsigned flags = 0;
         int vp8x = 0;
 
+    if (!w->last_pkt->size)
+        return 0;
+
         if (AV_RL32(w->last_pkt->data) == AV_RL32("RIFF"))
             skip = 12;
 
@@ -139,7 +140,6 @@  static int flush(AVFormatContext *s, int trailer, int64_t pts)
         }
         avio_write(s->pb, w->last_pkt->data + skip, w->last_pkt->size - skip);
         av_packet_unref(w->last_pkt);
-    }
 
     return 0;
 }