Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: nico-zs via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: nico-zs <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] avformat,avcodec: use PRI format macros for uint32_t in log messages (PR #22291)
Date: Thu, 26 Feb 2026 08:38:22 -0000
Message-ID: <177209510312.25.11579823764511981896@29965ddac10e> (raw)

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 <zengshuang@xiaomi.com>


>From ce02483eeca2737c64451432e1f2fb79070757d1 Mon Sep 17 00:00:00 2001
From: zengshuang <zengshuang@xiaomi.com>
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 <zengshuang@xiaomi.com>
---
 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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-02-26  8:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=177209510312.25.11579823764511981896@29965ddac10e \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git