diff mbox series

[FFmpeg-devel,4/9] avformat/aviobuf: Make ffio_set_buf_size() static

Message ID AM7PR03MB6660B74C77E66E720DC704F18FF29@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 530ac6aa305aeda631c77f8a17e96c14c7ab1a1c
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:42 a.m. UTC
Possible since 9c3adb7ce23522dcceb264bc0bffd3592dd3e1a5.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
It seems that despite the warning this function is called
after having performed I/O; and that this is intended.

Btw: Shall I move the functions around to avoid the forward
declarations?

 libavformat/avio_internal.h | 3 ---
 libavformat/aviobuf.c       | 8 +++++---
 2 files changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 2c6d00b5ff..de95b43bdb 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -83,9 +83,6 @@  uint64_t ffio_read_varlen(AVIOContext *bc);
  */
 int ffio_read_size(AVIOContext *s, unsigned char *buf, int size);
 
-/** @warning must be called before any I/O */
-int ffio_set_buf_size(AVIOContext *s, int buf_size);
-
 /**
  * Reallocate a given buffer for AVIOContext.
  *
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 9322ed38bc..1f0819b328 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -74,6 +74,8 @@  const AVClass ff_avio_class = {
 
 static void fill_buffer(AVIOContext *s);
 static int url_resetbuf(AVIOContext *s, int flags);
+/** @warning must be called before any I/O */
+static int set_buf_size(AVIOContext *s, int buf_size);
 
 int ffio_init_context(AVIOContext *s,
                   unsigned char *buffer,
@@ -543,7 +545,7 @@  static void fill_buffer(AVIOContext *s)
     /* make buffer smaller in case it ended up large after probing */
     if (s->read_packet && s->orig_buffer_size && s->buffer_size > s->orig_buffer_size && len >= s->orig_buffer_size) {
         if (dst == s->buffer && s->buf_ptr != dst) {
-            int ret = ffio_set_buf_size(s, s->orig_buffer_size);
+            int ret = set_buf_size(s, s->orig_buffer_size);
             if (ret < 0)
                 av_log(s, AV_LOG_WARNING, "Failed to decrease buffer size\n");
 
@@ -1040,7 +1042,7 @@  int ffio_limit(AVIOContext *s, int size)
     return size;
 }
 
-int ffio_set_buf_size(AVIOContext *s, int buf_size)
+static int set_buf_size(AVIOContext *s, int buf_size)
 {
     uint8_t *buffer;
     buffer = av_malloc(buf_size);
@@ -1062,7 +1064,7 @@  int ffio_realloc_buf(AVIOContext *s, int buf_size)
     int data_size;
 
     if (!s->buffer_size)
-        return ffio_set_buf_size(s, buf_size);
+        return set_buf_size(s, buf_size);
 
     if (buf_size <= s->buffer_size)
         return 0;