[FFmpeg-cvslog] Merge commit 'e435beb1ea5380a90774dbf51fdc8c941e486551'

Clément Bœsch git at videolan.org
Fri May 5 14:10:41 EEST 2017


ffmpeg | branch: master | Clément Bœsch <cboesch at gopro.com> | Fri May  5 13:04:24 2017 +0200| [651ee9346105b9d492e01172ab447c04d03fa32e] | committer: Clément Bœsch

Merge commit 'e435beb1ea5380a90774dbf51fdc8c941e486551'

* commit 'e435beb1ea5380a90774dbf51fdc8c941e486551':
  crypto: consistently use size_t as type for length parameters

Merged-by: Clément Bœsch <cboesch at gopro.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=651ee9346105b9d492e01172ab447c04d03fa32e
---

 doc/APIchanges      | 4 ++++
 libavutil/md5.c     | 8 ++++++++
 libavutil/md5.h     | 9 +++++++++
 libavutil/sha.c     | 6 +++++-
 libavutil/sha.h     | 9 +++++++--
 libavutil/version.h | 3 +++
 6 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index b9d7b8b569..e8c08ca769 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2017-xx-xx - xxxxxxxxxx
+  Change av_sha_update() and av_md5_sum()/av_md5_update() length
+  parameter type to size_t at next major bump.
+
 2017-05-05 - xxxxxxxxxx - lavc 57.94.100 - avcodec.h
   The cuvid decoders now support AVCodecContext.hw_device_ctx, which removes
   the requirement to set an incomplete AVCodecContext.hw_frames_ctx only to
diff --git a/libavutil/md5.c b/libavutil/md5.c
index 1069ef1efe..31e69925ae 100644
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@ -150,7 +150,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, int len)
+#else
+void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
+#endif
 {
     const uint8_t *end;
     int j;
@@ -200,7 +204,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;
 
diff --git a/libavutil/md5.h b/libavutil/md5.h
index 9571c1fa46..ca72ccbf83 100644
--- a/libavutil/md5.h
+++ b/libavutil/md5.h
@@ -27,6 +27,7 @@
 #ifndef AVUTIL_MD5_H
 #define AVUTIL_MD5_H
 
+#include <stddef.h>
 #include <stdint.h>
 
 #include "attributes.h"
@@ -63,7 +64,11 @@ void av_md5_init(struct AVMD5 *ctx);
  * @param src input data to update hash with
  * @param len input data length
  */
+#if FF_API_CRYPTO_SIZE_T
 void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len);
+#else
+void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len);
+#endif
 
 /**
  * Finish hashing and output digest value.
@@ -80,7 +85,11 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
  * @param src The data to hash
  * @param len The length of the data, in bytes
  */
+#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
 
 /**
  * @}
diff --git a/libavutil/sha.c b/libavutil/sha.c
index 5b42ccf1b2..ef6fa44227 100644
--- a/libavutil/sha.c
+++ b/libavutil/sha.c
@@ -311,7 +311,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;
 
diff --git a/libavutil/sha.h b/libavutil/sha.h
index c7558a8964..c0180e5729 100644
--- a/libavutil/sha.h
+++ b/libavutil/sha.h
@@ -27,6 +27,7 @@
 #ifndef AVUTIL_SHA_H
 #define AVUTIL_SHA_H
 
+#include <stddef.h>
 #include <stdint.h>
 
 #include "attributes.h"
@@ -69,11 +70,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.
diff --git a/libavutil/version.h b/libavutil/version.h
index bba39e0180..e7a657971f 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -135,6 +135,9 @@
 #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
 
 
 /**


======================================================================

diff --cc doc/APIchanges
index b9d7b8b569,942337903f..e8c08ca769
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@@ -15,27 -13,25 +15,31 @@@ libavutil:     2015-08-2
  
  API changes, most recent first:
  
 -2016-xx-xx - xxxxxxx
++2017-xx-xx - xxxxxxxxxx
+   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.
 +2017-05-05 - xxxxxxxxxx - lavc 57.94.100 - avcodec.h
 +  The cuvid decoders now support AVCodecContext.hw_device_ctx, which removes
 +  the requirement to set an incomplete AVCodecContext.hw_frames_ctx only to
 +  set the Cuda device handle.
  
 -2016-xx-xx - xxxxxxx - lavu 55.30.0 - spherical.h
 -  Add AV_FRAME_DATA_SPHERICAL value, av_spherical_alloc() API and
 -  AVSphericalMapping type to export and describe spherical video properties.
 +2017-04-11 - 8378466507 - lavu 55.61.100 - avstring.h
 +  Add av_strireplace().
  
 -2016-xx-xx - xxxxxxx - lavf 57.10.0 - avformat.h
 -  Add av_stream_add_side_data().
 +2016-04-06 - 157e57a181 - lavc 57.92.100 - avcodec.h
 +  Add AV_PKT_DATA_CONTENT_LIGHT_LEVEL packet side data.
  
 -2016-xx-xx - xxxxxxx - lavu 55.28.0 - pixfmt.h
 -  Add AV_PIX_FMT_GRAY12(LE/BE).
 +2016-04-06 - b378f5bd64 - lavu 55.60.100 - mastering_display_metadata.h
 +  Add AV_FRAME_DATA_CONTENT_LIGHT_LEVEL value, av_content_light_metadata_alloc()
 +  and av_content_light_metadata_create_side_data() API, and AVContentLightMetadata
 +  type to export content light level video properties.
 +
 +2017-03-31 - 9033e8723c - lavu 55.57.100 - spherical.h
 +  Add av_spherical_projection_name().
 +  Add av_spherical_from_name().
  
 -2016-xx-xx - xxxxxxx - lavu 55.27.0 - hwcontext.h
 +2017-03-30 - 4cda23f1f1 - lavu 55.53.100 / 55.27.0 - hwcontext.h
    Add av_hwframe_map() and associated AV_HWFRAME_MAP_* flags.
    Add av_hwframe_ctx_create_derived().
  
diff --cc libavutil/md5.c
index 1069ef1efe,1946d78317..31e69925ae
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@@ -150,10 -146,13 +150,14 @@@ 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)
 +void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len)
+ #else
+ void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
+ #endif
  {
 -    int i, j;
 +    const uint8_t *end;
 +    int j;
  
      j         = ctx->len & 63;
      ctx->len += len;
diff --cc libavutil/md5.h
index 9571c1fa46,55e7c23417..ca72ccbf83
--- a/libavutil/md5.h
+++ b/libavutil/md5.h
@@@ -40,47 -33,18 +41,55 @@@
   * @{
   */
  
 +extern const int av_md5_size;
 +
  struct AVMD5;
  
 +/**
 + * Allocate an AVMD5 context.
 + */
  struct AVMD5 *av_md5_alloc(void);
 +
 +/**
 + * Initialize MD5 hashing.
 + *
 + * @param ctx pointer to the function context (of size av_md5_size)
 + */
  void av_md5_init(struct AVMD5 *ctx);
 +
 +/**
 + * Update hash value.
 + *
 + * @param ctx hash function context
 + * @param src input data to update hash with
 + * @param len input data length
 + */
++#if FF_API_CRYPTO_SIZE_T
 +void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len);
++#else
++void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len);
++#endif
 +
 +/**
 + * Finish hashing and output digest value.
 + *
 + * @param ctx hash function context
 + * @param dst buffer where output digest value is stored
 + */
  void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
 +
 +/**
 + * Hash an array of data.
 + *
 + * @param dst The output buffer to write the digest into
 + * @param src The data to hash
 + * @param len The length of the data, in bytes
 + */
+ #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
  
  /**
   * @}



More information about the ffmpeg-cvslog mailing list