diff mbox series

[FFmpeg-devel] avformat/avio: avio_tell() only errors if the context is NULL

Message ID 20240711094937.696960-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avformat/avio: avio_tell() only errors if the context is NULL | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer July 11, 2024, 9:49 a.m. UTC
Found by code review related to coverity

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/avio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anton Khirnov July 17, 2024, 6:47 a.m. UTC | #1
Quoting Michael Niedermayer (2024-07-11 11:49:37)
> Found by code review related to coverity
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/avio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/avio.h b/libavformat/avio.h
> index ebf611187dc..3be91e4b8a7 100644
> --- a/libavformat/avio.h
> +++ b/libavformat/avio.h
> @@ -489,7 +489,7 @@ int64_t avio_skip(AVIOContext *s, int64_t offset);
>  
>  /**
>   * ftell() equivalent for AVIOContext.
> - * @return position or AVERROR.
> + * @return position or AVERROR in case s is NULL.

It seems weird to document an invalid call.
Michael Niedermayer July 22, 2024, 10:41 p.m. UTC | #2
On Wed, Jul 17, 2024 at 08:47:45AM +0200, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2024-07-11 11:49:37)
> > Found by code review related to coverity
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/avio.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/avio.h b/libavformat/avio.h
> > index ebf611187dc..3be91e4b8a7 100644
> > --- a/libavformat/avio.h
> > +++ b/libavformat/avio.h
> > @@ -489,7 +489,7 @@ int64_t avio_skip(AVIOContext *s, int64_t offset);
> >  
> >  /**
> >   * ftell() equivalent for AVIOContext.
> > - * @return position or AVERROR.
> > + * @return position or AVERROR in case s is NULL.
> 
> It seems weird to document an invalid call.

its mainly a reminder that this doesnt return AVERROR arbitrarily and thus
doesnt need to be checked

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/avio.h b/libavformat/avio.h
index ebf611187dc..3be91e4b8a7 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -489,7 +489,7 @@  int64_t avio_skip(AVIOContext *s, int64_t offset);
 
 /**
  * ftell() equivalent for AVIOContext.
- * @return position or AVERROR.
+ * @return position or AVERROR in case s is NULL.
  */
 static av_always_inline int64_t avio_tell(AVIOContext *s)
 {