diff mbox series

[FFmpeg-devel] lavf/sga: Fix several format specifiers

Message ID CAB0OVGrXQMXj=n-5zu63g8UDG78xL8AfzwM7hq2_==dNg6X7MQ@mail.gmail.com
State Accepted
Commit b6fe10fa39bbbb2f186c3f2a4adefc3b387774ef
Headers show
Series [FFmpeg-devel] lavf/sga: Fix several format specifiers | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Carl Eugen Hoyos March 4, 2021, 7:37 p.m. UTC
Hi,

attached patch fixes a few warnings when compiling for 32bit.

Please comment, Carl Eugen
Subject: [PATCH] lavf/sga: Silence several warnings because of wrong format
 specifiers.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes warnings like:
warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument n has type ‘uint64_t’
---
 libavformat/sga.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Paul B Mahol March 4, 2021, 8:04 p.m. UTC | #1
lgtm
Moritz Barsnick March 4, 2021, 9:18 p.m. UTC | #2
On Thu, Mar 04, 2021 at 20:37:26 +0100, Carl Eugen Hoyos wrote:
> attached patch fixes a few warnings when compiling for 32bit.

>      av_log(s, AV_LOG_DEBUG, "START %s\n", where);
> -    av_log(s, AV_LOG_DEBUG, "pos: %lX\n", avio_tell(s->pb));
> +    av_log(s, AV_LOG_DEBUG, "pos: %"PRIX64"\n", avio_tell(s->pb));

#include <inttypes.h>

Moritz
Carl Eugen Hoyos March 4, 2021, 9:47 p.m. UTC | #3
Am Do., 4. März 2021 um 22:23 Uhr schrieb Moritz Barsnick <barsnick@gmx.net>:
>
> On Thu, Mar 04, 2021 at 20:37:26 +0100, Carl Eugen Hoyos wrote:
> > attached patch fixes a few warnings when compiling for 32bit.
>
> >      av_log(s, AV_LOG_DEBUG, "START %s\n", where);
> > -    av_log(s, AV_LOG_DEBUG, "pos: %lX\n", avio_tell(s->pb));
> > +    av_log(s, AV_LOG_DEBUG, "pos: %"PRIX64"\n", avio_tell(s->pb));
>
> #include <inttypes.h>

It is included through common.h - do we add it to every C file
that would need it if common.h were not included?

Carl Eugen
Moritz Barsnick March 4, 2021, 11:08 p.m. UTC | #4
On Thu, Mar 04, 2021 at 22:47:57 +0100, Carl Eugen Hoyos wrote:
> > #include <inttypes.h>
>
> It is included through common.h - do we add it to every C file
> that would need it if common.h were not included?

Okay, that's quite indirectly and implicitly via libavutil/internal.h.
I don't know the policy on this. You're probably right.

Moritz
Anton Khirnov March 8, 2021, 8:22 a.m. UTC | #5
Quoting Carl Eugen Hoyos (2021-03-04 22:47:57)
> Am Do., 4. März 2021 um 22:23 Uhr schrieb Moritz Barsnick <barsnick@gmx.net>:
> >
> > On Thu, Mar 04, 2021 at 20:37:26 +0100, Carl Eugen Hoyos wrote:
> > > attached patch fixes a few warnings when compiling for 32bit.
> >
> > >      av_log(s, AV_LOG_DEBUG, "START %s\n", where);
> > > -    av_log(s, AV_LOG_DEBUG, "pos: %lX\n", avio_tell(s->pb));
> > > +    av_log(s, AV_LOG_DEBUG, "pos: %"PRIX64"\n", avio_tell(s->pb));
> >
> > #include <inttypes.h>
> 
> It is included through common.h - do we add it to every C file
> that would need it if common.h were not included?

Yes, every file should explicitly include all the headers it directly
uses. There was a recent discussion about this.
Paul B Mahol March 8, 2021, 9:53 a.m. UTC | #6
On Mon, Mar 8, 2021 at 9:22 AM Anton Khirnov <anton@khirnov.net> wrote:

> Quoting Carl Eugen Hoyos (2021-03-04 22:47:57)
> > Am Do., 4. März 2021 um 22:23 Uhr schrieb Moritz Barsnick <
> barsnick@gmx.net>:
> > >
> > > On Thu, Mar 04, 2021 at 20:37:26 +0100, Carl Eugen Hoyos wrote:
> > > > attached patch fixes a few warnings when compiling for 32bit.
> > >
> > > >      av_log(s, AV_LOG_DEBUG, "START %s\n", where);
> > > > -    av_log(s, AV_LOG_DEBUG, "pos: %lX\n", avio_tell(s->pb));
> > > > +    av_log(s, AV_LOG_DEBUG, "pos: %"PRIX64"\n", avio_tell(s->pb));
> > >
> > > #include <inttypes.h>
> >
> > It is included through common.h - do we add it to every C file
> > that would need it if common.h were not included?
>
> Yes, every file should explicitly include all the headers it directly
> uses. There was a recent discussion about this.
>

That would make bunch of headers needed to be added to every single file.

I do not remember such discussion ever take place.


> --
> Anton Khirnov
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/sga.c b/libavformat/sga.c
index 20da423ebf..e7a41e91ea 100644
--- a/libavformat/sga.c
+++ b/libavformat/sga.c
@@ -232,11 +232,11 @@  static void print_stats(AVFormatContext *s, const char *where)
     SGADemuxContext *sga = s->priv_data;
 
     av_log(s, AV_LOG_DEBUG, "START %s\n", where);
-    av_log(s, AV_LOG_DEBUG, "pos: %lX\n", avio_tell(s->pb));
+    av_log(s, AV_LOG_DEBUG, "pos: %"PRIX64"\n", avio_tell(s->pb));
     av_log(s, AV_LOG_DEBUG, "idx: %X\n", sga->idx);
     av_log(s, AV_LOG_DEBUG, "packet_type: %X\n", sga->packet_type);
     av_log(s, AV_LOG_DEBUG, "payload_size: %X\n", sga->payload_size);
-    av_log(s, AV_LOG_DEBUG, "SECTOR: %016lX\n", AV_RB64(sga->sector));
+    av_log(s, AV_LOG_DEBUG, "SECTOR: %016"PRIX64"\n", AV_RB64(sga->sector));
     av_log(s, AV_LOG_DEBUG, "stream: %X\n", sga->sector[1]);
     av_log(s, AV_LOG_DEBUG, "END %s\n", where);
 }
@@ -300,7 +300,7 @@  static int sga_video_packet(AVFormatContext *s, AVPacket *pkt)
     sga->flags = 0;
     update_type_size(s);
 
-    av_log(s, AV_LOG_DEBUG, "VIDEO PACKET: %d:%016lX i:%X\n", pkt->size, AV_RB64(sga->sector), sga->idx);
+    av_log(s, AV_LOG_DEBUG, "VIDEO PACKET: %d:%016"PRIX64" i:%X\n", pkt->size, AV_RB64(sga->sector), sga->idx);
 
     return 0;
 }
@@ -347,7 +347,7 @@  static int sga_audio_packet(AVFormatContext *s, AVPacket *pkt)
     sga->flags = 0;
     update_type_size(s);
 
-    av_log(s, AV_LOG_DEBUG, "AUDIO PACKET: %d:%016lX i:%X\n", pkt->size, AV_RB64(sga->sector), sga->idx);
+    av_log(s, AV_LOG_DEBUG, "AUDIO PACKET: %d:%016"PRIX64" i:%X\n", pkt->size, AV_RB64(sga->sector), sga->idx);
 
     return 0;
 }