[vlc-devel] [PATCH] libmp4: fix argument for formatting
Alexandre Janniaux
ajanni at videolabs.io
Fri Mar 27 17:07:58 CET 2020
On Fri, Mar 27, 2020 at 05:55:00PM +0200, Rémi Denis-Courmont wrote:
> Le perjantaina 27. maaliskuuta 2020, 17.45.16 EET Alexandre Janniaux a écrit :
> > i_profile_level is uint8_t but the bitwise operation is promoting it to
> > an int,
>
> That's *irrelevant*. Expression is promoted to integer rank regardless of the
> shift because it is a variadic argument.
>
> The current code is just fine. PRIu8 *expects* a promoted uint8_t value.
This is not what clang says with a uint8_t foo:
main.c:10:28: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]
printf("%" PRIu8 "\n", (foo & 0xF0) );
~~~~~~~~ ^~~~~~~~~~~~
But on the other side, no warnings here:
printf("%" PRIu8 "\n", foo);
$ clang -v
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Regards,
--
Alexandre Janniaux
Videolabs
More information about the vlc-devel
mailing list