History

avcodec/packet: change side data related public function and struct size types to size_t

av_packet_add_side_data() already defines size as a size_t, so this makes it consistent across all side data functions

James Almer committed 5 years ago

Commit d79e0fe1 parent dbd47b74 files · +28 −4Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavcodec/avpacket.c +7 −3
  3. libavcodec/packet.h +16 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2017-10-21 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2021-03-10 - xxxxxxxxxx - lavc 58.130.100 - packet.h
19+ Change AVBufferRef related AVPacket function and struct size
20+ parameter and fields type to size_t at next major bump.
21+
1822 2021-03-10 - xxxxxxxxxx - lavu 56.68.100 - buffer.h frame.h
1923 Change AVBufferRef and relevant AVFrame function and struct size
2024 parameter and fields type to size_t at next major bump.
libavcodec/avpacket.c+7−3
@@ -330,12 +330,16 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 329 unmodified lines
330330
331331
332332 uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
333− int size)
333+ buffer_size_t size)
334334 {
335335 int ret;
336336 uint8_t *data;
337337
338+#if FF_API_BUFFER_SIZE_T
338339 if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
340+#else
341+ if (size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
342+#endif
339343 return NULL;
340344 data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
341345 if (!data)
@@ -351,7 +355,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 9 unmodified lines
351355 }
352356
353357 uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
354− int *size)
358+ buffer_size_t *size)
355359 {
356360 int i;
357361
@@ -554,7 +558,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **di · 196 unmodified lines
554558 }
555559
556560 int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
557− int size)
561+ buffer_size_t size)
558562 {
559563 int i;
560564
libavcodec/packet.h+16−0
@@ -305,7 +305,11 @@ enum AVPacketSideDataType { · 304 unmodified lines
305305
306306 typedef struct AVPacketSideData {
307307 uint8_t *data;
308+#if FF_API_BUFFER_SIZE_T
308309 int size;
310+#else
311+ size_t size;
312+#endif
309313 enum AVPacketSideDataType type;
310314 } AVPacketSideData;
311315
@@ -559,7 +563,11 @@ void av_free_packet(AVPacket *pkt); · 247 unmodified lines
559563 * @return pointer to fresh allocated data or NULL otherwise
560564 */
561565 uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
566+#if FF_API_BUFFER_SIZE_T
562567 int size);
568+#else
569+ size_t size);
570+#endif
563571
564572 /**
565573 * Wrap an existing array as a packet side data.
@@ -586,7 +594,11 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 20 unmodified lines
586594 * @return 0 on success, < 0 on failure
587595 */
588596 int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
597+#if FF_API_BUFFER_SIZE_T
589598 int size);
599+#else
600+ size_t size);
601+#endif
590602
591603 /**
592604 * Get side information from packet.
@@ -598,7 +610,11 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 5 unmodified lines
598610 * @return pointer to data if present or NULL otherwise
599611 */
600612 uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
613+#if FF_API_BUFFER_SIZE_T
601614 int *size);
615+#else
616+ size_t *size);
617+#endif
602618
603619 #if FF_API_MERGE_SD_API
604620 attribute_deprecated
libavcodec/version.h+1−1
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828 #include "libavutil/version.h"
2929
3030 #define LIBAVCODEC_VERSION_MAJOR 58
31−#define LIBAVCODEC_VERSION_MINOR 129
31+#define LIBAVCODEC_VERSION_MINOR 130
3232 #define LIBAVCODEC_VERSION_MICRO 100
3333
3434 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t