]> git.sesse.net Git - ffmpeg/commitdiff
crypto: consistently use size_t as type for length parameters
authorDiego Biurrun <diego@biurrun.de>
Thu, 15 Dec 2016 11:46:03 +0000 (12:46 +0100)
committerDiego Biurrun <diego@biurrun.de>
Mon, 9 Jan 2017 14:17:43 +0000 (15:17 +0100)
size_t is the correct type to use for sizes.

doc/APIchanges
libavutil/md5.c
libavutil/md5.h
libavutil/sha.c
libavutil/sha.h
libavutil/version.h

index 7633c99181378d423bc5f35b068ee3d0f15a2976..942337903f178f76497b1adf63da63ed1ad7051f 100644 (file)
@@ -13,6 +13,10 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxxxxxx
+  Change av_sha_update() and av_md5_sum()/av_md5_update() length
+  parameter type to size_t at next major bump.
+
 2016-xx-xx - xxxxxxx - lavc 57.29.0 - avcodec.h
   Add AV_PKT_DATA_SPHERICAL packet side data to export AVSphericalMapping
   information from containers.
index 94f068109c046a1fba49275ca2be8daff001ac50..1946d783172acf4a185824287cab00cc5b537342 100644 (file)
@@ -146,7 +146,11 @@ void av_md5_init(AVMD5 *ctx)
     ctx->ABCD[3] = 0x67452301;
 }
 
+#if FF_API_CRYPTO_SIZE_T
 void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len)
+#else
+void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
+#endif
 {
     int i, j;
 
@@ -177,7 +181,11 @@ void av_md5_final(AVMD5 *ctx, uint8_t *dst)
         AV_WL32(dst + 4 * i, ctx->ABCD[3 - i]);
 }
 
+#if FF_API_CRYPTO_SIZE_T
 void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len)
+#else
+void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len)
+#endif
 {
     AVMD5 ctx;
 
index c26318c01d9326ebb928a048ed095edcd7410c87..55e7c2341793fb1da96f830f22a5d8a5af0a332e 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef AVUTIL_MD5_H
 #define AVUTIL_MD5_H
 
+#include <stddef.h>
 #include <stdint.h>
 
 #include "attributes.h"
@@ -36,9 +37,14 @@ struct AVMD5;
 
 struct AVMD5 *av_md5_alloc(void);
 void av_md5_init(struct AVMD5 *ctx);
-void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len);
 void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
+#if FF_API_CRYPTO_SIZE_T
+void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len);
 void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
+#else
+void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len);
+void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len);
+#endif
 
 /**
  * @}
index 404effade2ebc5137bc535d7f8b735d8f59cfbaa..03f93aed8ce4393a07bcaeb73ccfc2780c454cf0 100644 (file)
@@ -290,7 +290,11 @@ av_cold int av_sha_init(AVSHA *ctx, int bits)
     return 0;
 }
 
-void av_sha_update(AVSHA* ctx, const uint8_t* data, unsigned int len)
+#if FF_API_CRYPTO_SIZE_T
+void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len)
+#else
+void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len)
+#endif
 {
     unsigned int i, j;
 
index 86ea0b065eaffb534409b6cf4886b5f602a92de3..c0c7cd1af15606ba27703b79a59d3c541289996c 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef AVUTIL_SHA_H
 #define AVUTIL_SHA_H
 
+#include <stddef.h>
 #include <stdint.h>
 
 #include "attributes.h"
@@ -51,11 +52,15 @@ int av_sha_init(struct AVSHA* context, int bits);
 /**
  * Update hash value.
  *
- * @param context hash function context
+ * @param ctx     hash function context
  * @param data    input data to update hash with
  * @param len     input data length
  */
-void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len);
+#if FF_API_CRYPTO_SIZE_T
+void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len);
+#else
+void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len);
+#endif
 
 /**
  * Finish hashing and output digest value.
index f1102312bacc73b3e0980e4bf23478bd8479ec49..3733fea8102241b173b0c1efae1a6b61f70d9142 100644 (file)
 #ifndef FF_API_PKT_PTS
 #define FF_API_PKT_PTS                  (LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_CRYPTO_SIZE_T
+#define FF_API_CRYPTO_SIZE_T            (LIBAVUTIL_VERSION_MAJOR < 56)
+#endif
 
 
 /**