[FFmpeg-devel] [PATCH 14/17] Update types after the FF_API_BUFFER_SIZE_T change.
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Apr 5 18:09:27 EEST 2021
Anton Khirnov:
> ---
> fftools/ffprobe.c | 2 +-
> libavcodec/decode.c | 2 +-
> libavcodec/mpeg12enc.c | 2 +-
> libavcodec/mscc.c | 2 +-
> libavfilter/af_ashowinfo.c | 2 +-
> libavfilter/vf_showinfo.c | 6 +++---
> libavformat/dump.c | 2 +-
> libavformat/framecrcenc.c | 2 +-
> libavformat/hashenc.c | 2 +-
> 9 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 38462e1ff3..c136562afe 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -2165,7 +2165,7 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
> pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
>
> if (pkt->side_data_elems) {
> - int size;
> + size_t size;
> const uint8_t *side_metadata;
>
> side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 0956a6ac6f..49b21ff43b 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -2101,7 +2101,7 @@ int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
> memcpy(dst, pal, AVPALETTE_SIZE);
> return 1;
> } else if (pal) {
> - av_log(logctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
> + av_log(logctx, AV_LOG_ERROR, "Palette size %zu is wrong\n", size);
> }
> return 0;
> }
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index 5676caef87..7d51278749 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -574,7 +574,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
> put_bits(&s->pb, 8, 0xff); // marker_bits
> } else {
> av_log(s->avctx, AV_LOG_WARNING,
> - "Warning Closed Caption size (%d) can not exceed 93 bytes "
> + "Warning Closed Caption size (%zu) can not exceed 93 bytes "
> "and must be a multiple of 3\n", side_data->size);
> }
> }
> diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
> index fe02649623..d392363fa9 100644
> --- a/libavcodec/mscc.c
> +++ b/libavcodec/mscc.c
> @@ -160,7 +160,7 @@ static int decode_frame(AVCodecContext *avctx,
> for (j = 0; j < 256; j++)
> s->pal[j] = 0xFF000000 | AV_RL32(pal + j * 4);
> } else if (pal) {
> - av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
> + av_log(avctx, AV_LOG_ERROR, "Palette size %zu is wrong\n", size);
> }
> memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
> }
> diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
> index 9046e8d84a..1ac4c432ed 100644
> --- a/libavfilter/af_ashowinfo.c
> +++ b/libavfilter/af_ashowinfo.c
> @@ -170,7 +170,7 @@ static void dump_audio_service_type(AVFilterContext *ctx, AVFrameSideData *sd)
>
> static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)
> {
> - av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %d bytes", sd->type, sd->size);
> + av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %zu bytes", sd->type, sd->size);
> }
>
> static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> index 6208892005..69d1076079 100644
> --- a/libavfilter/vf_showinfo.c
> +++ b/libavfilter/vf_showinfo.c
> @@ -314,7 +314,7 @@ static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const AVFrameSi
> int i;
>
> if (sd->size < uuid_size) {
> - av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))\n", sd->size, uuid_size);
> + av_log(ctx, AV_LOG_ERROR, "invalid data(%zu < UUID(%d-bytes))\n", sd->size, uuid_size);
> return;
> }
>
> @@ -472,7 +472,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> av_log(ctx, AV_LOG_INFO, "pan/scan");
> break;
> case AV_FRAME_DATA_A53_CC:
> - av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", sd->size);
> + av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%zu bytes)", sd->size);
> break;
> case AV_FRAME_DATA_SPHERICAL:
> dump_spherical(ctx, frame, sd);
> @@ -516,7 +516,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> dump_sei_unregistered_metadata(ctx, sd);
> break;
> default:
> - av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)\n",
> + av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%zu bytes)\n",
> sd->type, sd->size);
> break;
> }
> diff --git a/libavformat/dump.c b/libavformat/dump.c
> index 62ef5e9852..b89b3c63f3 100644
> --- a/libavformat/dump.c
> +++ b/libavformat/dump.c
> @@ -496,7 +496,7 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
> break;
> default:
> av_log(ctx, AV_LOG_INFO,
> - "unknown side data type %d (%d bytes)", sd->type, sd->size);
> + "unknown side data type %d (%zu bytes)", sd->type, sd->size);
> break;
> }
>
> diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
> index 1fbe4aa4ee..0339056603 100644
> --- a/libavformat/framecrcenc.c
> +++ b/libavformat/framecrcenc.c
> @@ -119,7 +119,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
> default:
> side_data_crc = av_adler32_update(0, data, sd->size);
> }
> - av_strlcatf(buf, sizeof(buf), ", %8d, 0x%08"PRIx32, pkt->side_data[i].size, side_data_crc);
> + av_strlcatf(buf, sizeof(buf), ", %8zu, 0x%08"PRIx32, pkt->side_data[i].size, side_data_crc);
> }
> }
> av_strlcatf(buf, sizeof(buf), "\n");
> diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
> index 1e9faf372a..4553ede011 100644
> --- a/libavformat/hashenc.c
> +++ b/libavformat/hashenc.c
> @@ -309,7 +309,7 @@ static int framehash_write_packet(struct AVFormatContext *s, AVPacket *pkt)
> }
> } else
> av_hash_update(c->hashes[0], pkt->side_data[i].data, pkt->side_data[i].size);
> - snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1), ", %8d, ", pkt->side_data[i].size);
> + snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1), ", %8zu, ", pkt->side_data[i].size);
> len = strlen(buf);
> av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len);
> avio_write(s->pb, buf, strlen(buf));
>
Your changes for framecrcenc and hashenc are not enough; one also needs
to switch the loop variables for the big-endian loops to size_t, see
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210318034314.1531570-1-andreas.rheinhardt@gmail.com/
Furthermore, we don't use zu for size_t, because MSVC doesn't like it.
Use SIZE_SPECIFIER.
(The changes to ffprobe were intentionally missing in that patch because
it mustn't use anything from internal.h.)
- Andreas
More information about the ffmpeg-devel
mailing list