aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-17 19:31:45 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-19 03:12:24 +0100
commita46d7819051e0e8c61017e75a0389389ae810ca4 (patch)
tree1279c1d1f15dc5b3b3a7a3eda9894026dfb8c8fe /libavcodec
parent04d001ca9bc510be5bd1c75f6c8fe13751337799 (diff)
downloadffmpeg-a46d7819051e0e8c61017e75a0389389ae810ca4.tar.gz
avcodec/packet: Also change av_packet_pack/unpack_dictionary to size_t
These are auxiliary side-data functions, so they should have been switched to size_t in d79e0fe65c51491f9bf8a470bbe36fb09f3e1280, but this has been forgotten. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avpacket.c13
-rw-r--r--libavcodec/packet.h10
2 files changed, 22 insertions, 1 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 8f0850fb00..b5bac5c5f2 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -507,7 +507,11 @@ int av_packet_split_side_data(AVPacket *pkt){
}
#endif
+#if FF_API_BUFFER_SIZE_T
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
+#else
+uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
+#endif
{
uint8_t *data = NULL;
*size = 0;
@@ -526,7 +530,11 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
if (pass)
memcpy(data + total_length, str, len);
+#if FF_API_BUFFER_SIZE_T
else if (len > INT_MAX - total_length)
+#else
+ else if (len > SIZE_MAX - total_length)
+#endif
return NULL;
total_length += len;
}
@@ -542,7 +550,12 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
return data;
}
+#if FF_API_BUFFER_SIZE_T
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
+#else
+int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
+ AVDictionary **dict)
+#endif
{
const uint8_t *end;
int ret;
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index da4377e09f..ca18ae631f 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -647,7 +647,11 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type);
* @param size pointer to store the size of the returned data
* @return pointer to data if successful, NULL otherwise
*/
+#if FF_API_BUFFER_SIZE_T
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
+#else
+uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
+#endif
/**
* Unpack a dictionary from side_data.
*
@@ -656,8 +660,12 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
* @param dict the metadata storage dictionary
* @return 0 on success, < 0 on failure
*/
+#if FF_API_BUFFER_SIZE_T
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
-
+#else
+int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
+ AVDictionary **dict);
+#endif
/**
* Convenience function to free all the side data stored.