PR #22291 opened by nico-zs URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22291 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22291.patch
Use PRIu32/PRIX32 format specifiers instead of %d/%u/%X for uint32_t variables in av_log calls to fix format string warnings when sizeof(int) != sizeof(uint32_t). Signed-off-by: zengshuang <[email protected]> >From ce02483eeca2737c64451432e1f2fb79070757d1 Mon Sep 17 00:00:00 2001 From: zengshuang <[email protected]> Date: Thu, 26 Feb 2026 16:17:47 +0800 Subject: [PATCH] avformat,avcodec: use PRI format macros for uint32_t in log messages Use PRIu32/PRIX32 format specifiers instead of %d/%u/%X for uint32_t variables in av_log calls to fix format string warnings when sizeof(int) != sizeof(uint32_t). Signed-off-by: zengshuang <[email protected]> --- libavcodec/mpegaudiodec_template.c | 2 +- libavformat/dump.c | 2 +- libavformat/flac_picture.c | 4 ++-- libavformat/mov.c | 4 ++-- libavformat/mov_chan.c | 4 ++-- libavformat/tls_mbedtls.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index fa2efa023f..08b79312c6 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -385,7 +385,7 @@ static int handle_crc(MPADecodeContext *s, int sec_len) crc_val = av_crc(crc_tab, crc_val, tmp_buf, 3); if (crc_val) { - av_log(s->avctx, AV_LOG_ERROR, "CRC mismatch %X!\n", crc_val); + av_log(s->avctx, AV_LOG_ERROR, "CRC mismatch %"PRIX32"!\n", crc_val); if (s->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } diff --git a/libavformat/dump.c b/libavformat/dump.c index 734a6e0bbf..66abc2af7e 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -457,7 +457,7 @@ static void dump_cropping(void *ctx, const AVPacketSideData *sd, int log_level) left = AV_RL32(sd->data + 8); right = AV_RL32(sd->data + 12); - av_log(ctx, log_level, "%d/%d/%d/%d", left, right, top, bottom); + av_log(ctx, log_level, "%"PRIu32"/%"PRIu32"/%"PRIu32"/%"PRIu32"", left, right, top, bottom); } static void dump_tdrdi(void *ctx, const AVPacketSideData *sd, int log_level) diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c index 46f0513214..a81eb71482 100644 --- a/libavformat/flac_picture.c +++ b/libavformat/flac_picture.c @@ -120,7 +120,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t **bufp, int buf_size, left = bytestream2_get_bytes_left(&g); if (len <= 0 || len > left) { if (len > MAX_TRUNC_PICTURE_SIZE || len >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { - av_log(s, AV_LOG_ERROR, "Attached picture metadata block too big %u\n", len); + av_log(s, AV_LOG_ERROR, "Attached picture metadata block too big %"PRIu32"\n", len); if (s->error_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; return 0; @@ -132,7 +132,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t **bufp, int buf_size, if (truncate_workaround && s->strict_std_compliance <= FF_COMPLIANCE_NORMAL && len > left && (len & 0xffffff) == left) { - av_log(s, AV_LOG_INFO, "Correcting truncated metadata picture size from %u to %u\n", left, len); + av_log(s, AV_LOG_INFO, "Correcting truncated metadata picture size from %"PRIu32" to %"PRIu32"\n", left, len); trunclen = len - left; } else { av_log(s, AV_LOG_ERROR, "Attached picture metadata block too short\n"); diff --git a/libavformat/mov.c b/libavformat/mov.c index 46dac965a2..d8cc19a742 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -567,7 +567,7 @@ retry: // UTF8 and 4 means "UTF8 sort". For any other type (UTF16 or e.g. // a picture), don't return it blindly in a string that is supposed // to be UTF8 text. - av_log(c->fc, AV_LOG_WARNING, "Skipping unhandled metadata %s of type %d\n", key, data_type); + av_log(c->fc, AV_LOG_WARNING, "Skipping unhandled metadata %s of type %"PRIu32"\n", key, data_type); av_free(str); return 0; } else { @@ -9254,7 +9254,7 @@ static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) width = avio_rb32(pb); height = avio_rb32(pb); - av_log(c->fc, AV_LOG_TRACE, "ispe: item_id %d, width %u, height %u\n", + av_log(c->fc, AV_LOG_TRACE, "ispe: item_id %d, width %"PRIu32", height %"PRIu32"\n", c->cur_item_id, width, height); item = get_heif_item(c, c->cur_item_id); diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 4484a22a10..67b22b048d 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -546,7 +546,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int nb_channels = ch_layout->nb_channels; if (!num_descr || num_descr < nb_channels) { - av_log(s, AV_LOG_ERROR, "got %d channel descriptions when at least %d were needed\n", + av_log(s, AV_LOG_ERROR, "got %"PRIu32" channel descriptions when at least %d were needed\n", num_descr, nb_channels); return AVERROR_INVALIDDATA; } @@ -554,7 +554,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, if (num_descr > nb_channels) { int strict = s->strict_std_compliance >= FF_COMPLIANCE_STRICT; av_log(s, strict ? AV_LOG_ERROR : AV_LOG_WARNING, - "got %d channel descriptions when number of channels is %d\n", + "got %"PRIu32" channel descriptions when number of channels is %d\n", num_descr, nb_channels); if (strict) return AVERROR_INVALIDDATA; diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index f13833b6ed..d2480ef25b 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -675,7 +675,7 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op // check the result of the certificate verification if ((verify_res_flags = mbedtls_ssl_get_verify_result(&tls_ctx->ssl_context)) != 0) { av_log(h, AV_LOG_ERROR, "mbedtls_ssl_get_verify_result reported problems "\ - "with the certificate verification, returned flags: %u\n", + "with the certificate verification, returned flags: %"PRIu32"\n", verify_res_flags); if (verify_res_flags & MBEDTLS_X509_BADCERT_NOT_TRUSTED) av_log(h, AV_LOG_ERROR, "The certificate is not correctly signed by the trusted CA.\n"); -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
