diff mbox series

[FFmpeg-devel] avformat/aacdec: strictly conform to K&R style

Message ID 20240518153536.25607-1-marcus@marcusspencer.xyz
State Accepted
Commit 8b8b555de008213894a29e453f27bf9de1c990dc
Headers show
Series [FFmpeg-devel] avformat/aacdec: strictly conform to K&R style | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marcus B Spencer May 18, 2024, 3:35 p.m. UTC
In the K&R style, a single-statement block does not have braces.
Edit the code to conform to this rule.

It is FFmpeg's code formatting convention to use K&R style.

Signed-off-by: Marcus B Spencer <marcus@marcusspencer.xyz>
---
 libavformat/aacdec.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Lynne May 18, 2024, 11:27 p.m. UTC | #1
On 18/05/2024 17:35, Marcus B Spencer wrote:
> In the K&R style, a single-statement block does not have braces.
> Edit the code to conform to this rule.
> 
> It is FFmpeg's code formatting convention to use K&R style.
> 
> Signed-off-by: Marcus B Spencer <marcus@marcusspencer.xyz>
> ---
>   libavformat/aacdec.c | 12 ++++--------
>   1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
> index e267886e1a..d5324df4d5 100644
> --- a/libavformat/aacdec.c
> +++ b/libavformat/aacdec.c
> @@ -143,9 +143,8 @@ static int handle_id3(AVFormatContext *s, AVPacket *pkt)
>       int ret;
>   
>       ret = av_append_packet(s->pb, pkt, ff_id3v2_tag_len(pkt->data) - pkt->size);
> -    if (ret < 0) {
> +    if (ret < 0)
>           return ret;
> -    }
>   
>       ffio_init_read_context(&pb, pkt->data, pkt->size);
>       ff_id3v2_read_dict(&pb.pub, &metadata, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
> @@ -175,9 +174,8 @@ retry:
>       if (ret < 0)
>           return ret;
>   
> -    if (ret < ADTS_HEADER_SIZE) {
> +    if (ret < ADTS_HEADER_SIZE)
>           return AVERROR(EIO);
> -    }
>   
>       if ((AV_RB16(pkt->data) >> 4) != 0xfff) {
>           // Parse all the ID3 headers between frames
> @@ -185,9 +183,8 @@ retry:
>   
>           av_assert2(append > 0);
>           ret = av_append_packet(s->pb, pkt, append);
> -        if (ret != append) {
> +        if (ret != append)
>               return AVERROR(EIO);
> -        }
>           if (!ff_id3v2_match(pkt->data, ID3v2_DEFAULT_MAGIC)) {
>               av_packet_unref(pkt);
>               ret = adts_aac_resync(s);
> @@ -200,9 +197,8 @@ retry:
>       }
>   
>       fsize = (AV_RB32(pkt->data + 3) >> 13) & 0x1FFF;
> -    if (fsize < ADTS_HEADER_SIZE) {
> +    if (fsize < ADTS_HEADER_SIZE)
>           return AVERROR_INVALIDDATA;
> -    }
>   
>       ret = av_append_packet(s->pb, pkt, fsize - pkt->size);
>   

Pushed, thanks.
diff mbox series

Patch

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index e267886e1a..d5324df4d5 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -143,9 +143,8 @@  static int handle_id3(AVFormatContext *s, AVPacket *pkt)
     int ret;
 
     ret = av_append_packet(s->pb, pkt, ff_id3v2_tag_len(pkt->data) - pkt->size);
-    if (ret < 0) {
+    if (ret < 0)
         return ret;
-    }
 
     ffio_init_read_context(&pb, pkt->data, pkt->size);
     ff_id3v2_read_dict(&pb.pub, &metadata, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
@@ -175,9 +174,8 @@  retry:
     if (ret < 0)
         return ret;
 
-    if (ret < ADTS_HEADER_SIZE) {
+    if (ret < ADTS_HEADER_SIZE)
         return AVERROR(EIO);
-    }
 
     if ((AV_RB16(pkt->data) >> 4) != 0xfff) {
         // Parse all the ID3 headers between frames
@@ -185,9 +183,8 @@  retry:
 
         av_assert2(append > 0);
         ret = av_append_packet(s->pb, pkt, append);
-        if (ret != append) {
+        if (ret != append)
             return AVERROR(EIO);
-        }
         if (!ff_id3v2_match(pkt->data, ID3v2_DEFAULT_MAGIC)) {
             av_packet_unref(pkt);
             ret = adts_aac_resync(s);
@@ -200,9 +197,8 @@  retry:
     }
 
     fsize = (AV_RB32(pkt->data + 3) >> 13) & 0x1FFF;
-    if (fsize < ADTS_HEADER_SIZE) {
+    if (fsize < ADTS_HEADER_SIZE)
         return AVERROR_INVALIDDATA;
-    }
 
     ret = av_append_packet(s->pb, pkt, fsize - pkt->size);