[FFmpeg-devel] [PATCH 6/6] avutil/adler32: Switch av_adler32_update() to size_t on bump

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Thu Mar 18 05:43:14 EET 2021


av_adler32_update() is used by av_hash_update() which will be switched
to size_t at the next bump. So it also has to be made to use size_t.
This is also necessary for framecrcenc.c, because the size of side data
will become a size_t, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 doc/APIchanges      |  5 +++++
 libavutil/adler32.c |  4 ++++
 libavutil/adler32.h | 16 ++++++++++++++--
 libavutil/version.h |  2 +-
 4 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 849d95a7ed..1782ae83fe 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,11 @@ libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2021-03-18 - xxxxxxxxxx - lavu 56.69.100 - adler32.h
+  av_adler32_update() will be changed to use uint32_t
+  for the Adler-32 checksums and size_t for the length
+  if the input buffer at the next bump.
+
 2021-03-xx - xxxxxxxxxx - lavc 58.133.100 - codec.h
   Deprecated av_init_packet(). Once removed, sizeof(AVPacket) will
   no longer be a part of the public ABI.
diff --git a/libavutil/adler32.c b/libavutil/adler32.c
index c87d5e261c..5ed5ff55a3 100644
--- a/libavutil/adler32.c
+++ b/libavutil/adler32.c
@@ -41,8 +41,12 @@
 #define DO4(buf)  DO1(buf); DO1(buf); DO1(buf); DO1(buf);
 #define DO16(buf) DO4(buf); DO4(buf); DO4(buf); DO4(buf);
 
+#if FF_API_CRYPTO_SIZE_T
 unsigned long av_adler32_update(unsigned long adler, const uint8_t * buf,
                                 unsigned int len)
+#else
+AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, size_t len)
+#endif
 {
     unsigned long s1 = adler & 0xffff;
     unsigned long s2 = adler >> 16;
diff --git a/libavutil/adler32.h b/libavutil/adler32.h
index a1f035b734..e7a8f83729 100644
--- a/libavutil/adler32.h
+++ b/libavutil/adler32.h
@@ -27,8 +27,10 @@
 #ifndef AVUTIL_ADLER32_H
 #define AVUTIL_ADLER32_H
 
+#include <stddef.h>
 #include <stdint.h>
 #include "attributes.h"
+#include "version.h"
 
 /**
  * @defgroup lavu_adler32 Adler-32
@@ -38,6 +40,12 @@
  * @{
  */
 
+#if FF_API_CRYPTO_SIZE_T
+typedef unsigned long AVAdler;
+#else
+typedef uint32_t AVAdler;
+#endif
+
 /**
  * Calculate the Adler32 checksum of a buffer.
  *
@@ -50,8 +58,12 @@
  * @param len   size of input buffer
  * @return      updated checksum
  */
-unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
-                                unsigned int len) av_pure;
+AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf,
+#if FF_API_CRYPTO_SIZE_T
+                          unsigned int len) av_pure;
+#else
+                          size_t len) av_pure;
+#endif
 
 /**
  * @}
diff --git a/libavutil/version.h b/libavutil/version.h
index 9a290d57e7..f357f6165e 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  68
+#define LIBAVUTIL_VERSION_MINOR  69
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.27.0



More information about the ffmpeg-devel mailing list