diff mbox

[FFmpeg-devel,3/3] avformat/aiffenc: Remove wrong and redundant check

Message ID 20191002040412.821-3-andreas.rheinhardt@gmail.com
State Accepted
Commit be0d3a2df1a1ec627ba50f535f61f7fcd359f6a4
Headers show

Commit Message

Andreas Rheinhardt Oct. 2, 2019, 4:04 a.m. UTC
The check "if (!pb->seekable & AVIO_SEEKABLE_NORMAL)" is wrong, because
! has higher precendence than &. But it is also redundant, because this
part of the code is only ever reached when the AVIO_SEEKABLE_NORMAL flag
is set for pb. So simply remove the check.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/aiffenc.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Matthieu Bouron Oct. 2, 2019, 7:09 a.m. UTC | #1
On Wed, Oct 02, 2019 at 06:04:12AM +0200, Andreas Rheinhardt wrote:
> The check "if (!pb->seekable & AVIO_SEEKABLE_NORMAL)" is wrong, because
> ! has higher precendence than &. But it is also redundant, because this
> part of the code is only ever reached when the AVIO_SEEKABLE_NORMAL flag
> is set for pb. So simply remove the check.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/aiffenc.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
> index 0b837cd264..d09c9afb95 100644
> --- a/libavformat/aiffenc.c
> +++ b/libavformat/aiffenc.c
> @@ -49,9 +49,6 @@ static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff)
>      AVIOContext *pb = s->pb;
>      AVPacketList *pict_list = aiff->pict_list;
>  
> -    if (!pb->seekable & AVIO_SEEKABLE_NORMAL)
> -        return 0;
> -
>      if (!s->metadata && !aiff->pict_list)
>          return 0;
>  
> -- 
> 2.21.0

LGTM.
Michael Niedermayer Oct. 3, 2019, 7:05 p.m. UTC | #2
On Wed, Oct 02, 2019 at 09:09:28AM +0200, Matthieu Bouron wrote:
> On Wed, Oct 02, 2019 at 06:04:12AM +0200, Andreas Rheinhardt wrote:
> > The check "if (!pb->seekable & AVIO_SEEKABLE_NORMAL)" is wrong, because
> > ! has higher precendence than &. But it is also redundant, because this
> > part of the code is only ever reached when the AVIO_SEEKABLE_NORMAL flag
> > is set for pb. So simply remove the check.
> > 
> > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> > ---
> >  libavformat/aiffenc.c | 3 ---
> >  1 file changed, 3 deletions(-)
> > 
> > diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
> > index 0b837cd264..d09c9afb95 100644
> > --- a/libavformat/aiffenc.c
> > +++ b/libavformat/aiffenc.c
> > @@ -49,9 +49,6 @@ static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff)
> >      AVIOContext *pb = s->pb;
> >      AVPacketList *pict_list = aiff->pict_list;
> >  
> > -    if (!pb->seekable & AVIO_SEEKABLE_NORMAL)
> > -        return 0;
> > -
> >      if (!s->metadata && !aiff->pict_list)
> >          return 0;
> >  
> > -- 
> > 2.21.0
> 
> LGTM.

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 0b837cd264..d09c9afb95 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -49,9 +49,6 @@  static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff)
     AVIOContext *pb = s->pb;
     AVPacketList *pict_list = aiff->pict_list;
 
-    if (!pb->seekable & AVIO_SEEKABLE_NORMAL)
-        return 0;
-
     if (!s->metadata && !aiff->pict_list)
         return 0;