diff mbox series

[FFmpeg-devel,1/9] avformat/aviobuf: Avoid calling function twice due to FFMAX()

Message ID AM7PR03MB66603FEC3CC2A61D771F27278FF29@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 7cfff1512c41a95f50a020854d40c813b9a8b1ec
Headers show
Series [FFmpeg-devel,1/9] avformat/aviobuf: Avoid calling function twice due to FFMAX() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 5, 2021, 5:14 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/aviobuf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Aug. 23, 2021, 2:38 p.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/aviobuf.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 66fddf1433..164b07ae6a 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -274,8 +274,10 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
>          return AVERROR(EINVAL);
>  
>      short_seek = s->short_seek_threshold;
> -    if (s->short_seek_get)
> -        short_seek = FFMAX(s->short_seek_get(s->opaque), short_seek);
> +    if (s->short_seek_get) {
> +        int tmp = s->short_seek_get(s->opaque);
> +        short_seek = FFMAX(tmp, short_seek);
> +    }
>  
>      offset1 = offset - pos; // "offset1" is the relative offset from the beginning of s->buffer
>      s->buf_ptr_max = FFMAX(s->buf_ptr_max, s->buf_ptr);
> 
Ping. Will apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 66fddf1433..164b07ae6a 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -274,8 +274,10 @@  int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
         return AVERROR(EINVAL);
 
     short_seek = s->short_seek_threshold;
-    if (s->short_seek_get)
-        short_seek = FFMAX(s->short_seek_get(s->opaque), short_seek);
+    if (s->short_seek_get) {
+        int tmp = s->short_seek_get(s->opaque);
+        short_seek = FFMAX(tmp, short_seek);
+    }
 
     offset1 = offset - pos; // "offset1" is the relative offset from the beginning of s->buffer
     s->buf_ptr_max = FFMAX(s->buf_ptr_max, s->buf_ptr);