Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH]lavf/hevc: Fix type specifiers
@ 2022-09-02 21:00 Carl Eugen Hoyos
  2022-09-02 21:56 ` Andreas Rheinhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Carl Eugen Hoyos @ 2022-09-02 21:00 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 70 bytes --]

Hi!

Attached patch fixes a few warnings.

Please comment, Carl Eugen

[-- Attachment #2: 0001-lavf-hevc-Fix-type-specifiers-missed-in-8b5d1553.patch --]
[-- Type: application/octet-stream, Size: 1736 bytes --]

[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH]lavf/hevc: Fix type specifiers
  2022-09-02 21:00 [FFmpeg-devel] [PATCH]lavf/hevc: Fix type specifiers Carl Eugen Hoyos
@ 2022-09-02 21:56 ` Andreas Rheinhardt
  2022-09-02 22:05   ` Carl Eugen Hoyos
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Rheinhardt @ 2022-09-02 21:56 UTC (permalink / raw)
  To: ffmpeg-devel

Carl Eugen Hoyos:
> Fixes several warnings:
> warning: format specifies type 'unsigned char' but the argument has type 'unsigned int'
> ---
>  libavformat/hevc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/hevc.c b/libavformat/hevc.c
> index 1841dd5785..ca5187a92e 100644
> --- a/libavformat/hevc.c
> +++ b/libavformat/hevc.c
> @@ -848,15 +848,15 @@ static int hvcc_write(AVIOContext *pb, HEVCDecoderConfigurationRecord *hvcc)
>          if (array->numNalus == 0)
>              continue;
>  
> -        av_log(NULL, AV_LOG_TRACE, "array_completeness[%"PRIu8"]:               %"PRIu8"\n",
> +        av_log(NULL, AV_LOG_TRACE, "array_completeness[%u]:               %"PRIu8"\n",
>                 j, array->array_completeness);
> -        av_log(NULL, AV_LOG_TRACE, "NAL_unit_type[%"PRIu8"]:                    %"PRIu8"\n",
> +        av_log(NULL, AV_LOG_TRACE, "NAL_unit_type[%u]:                    %"PRIu8"\n",
>                 j, array->NAL_unit_type);
> -        av_log(NULL, AV_LOG_TRACE, "numNalus[%"PRIu8"]:                         %"PRIu16"\n",
> +        av_log(NULL, AV_LOG_TRACE, "numNalus[%u]:                         %"PRIu16"\n",
>                 j, array->numNalus);
>          for (unsigned k = 0; k < array->numNalus; k++)
>              av_log(NULL, AV_LOG_TRACE,
> -                    "nalUnitLength[%"PRIu8"][%"PRIu16"]:                 %"PRIu16"\n",
> +                    "nalUnitLength[%u][%u]:                 %"PRIu16"\n",
>                     j, k, array->nalUnitLength[k]);
>          j++;
>      }
> -- 

I didn't catch this, as I didn't get a warning at all. The reason for
this is that it is actually not problematic:
"The ellipsis notation in a function prototype declarator causes

argument type conversion to stop after the last declared parameter. The
default argument
 promotions are performed on trailing arguments." The default argument
promotions include promoting integral types of conversion rank < int to
int. So av_log() has to read an int/unsigned even when one uses a
%"PRIu8". And so my inttypes.h contains this:

# define PRIu8		"u"
# define PRIu16		"u"
# define PRIu32		"u"

No wonder neither GCC nor Clang warned about this.
Anyway, patch LGTM.

- Andreas
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH]lavf/hevc: Fix type specifiers
  2022-09-02 21:56 ` Andreas Rheinhardt
@ 2022-09-02 22:05   ` Carl Eugen Hoyos
  0 siblings, 0 replies; 3+ messages in thread
From: Carl Eugen Hoyos @ 2022-09-02 22:05 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Am Fr., 2. Sept. 2022 um 23:56 Uhr schrieb Andreas Rheinhardt
<andreas.rheinhardt@outlook.com>:
>
> Carl Eugen Hoyos:
> > Fixes several warnings:
> > warning: format specifies type 'unsigned char' but the argument has type 'unsigned int'
> > ---
> >  libavformat/hevc.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavformat/hevc.c b/libavformat/hevc.c
> > index 1841dd5785..ca5187a92e 100644
> > --- a/libavformat/hevc.c
> > +++ b/libavformat/hevc.c
> > @@ -848,15 +848,15 @@ static int hvcc_write(AVIOContext *pb, HEVCDecoderConfigurationRecord *hvcc)
> >          if (array->numNalus == 0)
> >              continue;
> >
> > -        av_log(NULL, AV_LOG_TRACE, "array_completeness[%"PRIu8"]:               %"PRIu8"\n",
> > +        av_log(NULL, AV_LOG_TRACE, "array_completeness[%u]:               %"PRIu8"\n",
> >                 j, array->array_completeness);
> > -        av_log(NULL, AV_LOG_TRACE, "NAL_unit_type[%"PRIu8"]:                    %"PRIu8"\n",
> > +        av_log(NULL, AV_LOG_TRACE, "NAL_unit_type[%u]:                    %"PRIu8"\n",
> >                 j, array->NAL_unit_type);
> > -        av_log(NULL, AV_LOG_TRACE, "numNalus[%"PRIu8"]:                         %"PRIu16"\n",
> > +        av_log(NULL, AV_LOG_TRACE, "numNalus[%u]:                         %"PRIu16"\n",
> >                 j, array->numNalus);
> >          for (unsigned k = 0; k < array->numNalus; k++)
> >              av_log(NULL, AV_LOG_TRACE,
> > -                    "nalUnitLength[%"PRIu8"][%"PRIu16"]:                 %"PRIu16"\n",
> > +                    "nalUnitLength[%u][%u]:                 %"PRIu16"\n",
> >                     j, k, array->nalUnitLength[k]);
> >          j++;
> >      }
> > --
>
> I didn't catch this, as I didn't get a warning at all. The reason for
> this is that it is actually not problematic:
> "The ellipsis notation in a function prototype declarator causes
> argument type conversion to stop after the last declared parameter. The
> default argument
>  promotions are performed on trailing arguments." The default argument
> promotions include promoting integral types of conversion rank < int to
> int. So av_log() has to read an int/unsigned even when one uses a
> %"PRIu8". And so my inttypes.h contains this:
>
> # define PRIu8          "u"

On Windows where clang shows a warning it is
#define PRIu8        "hhu"

See "Size Prefixes" in
https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions

> # define PRIu16         "u"
> # define PRIu32         "u"
>
> No wonder neither GCC nor Clang warned about this.

> Anyway, patch LGTM.

Please push, I currently have no access to my development system.

Thank you, Carl Eugen
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-02 22:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-02 21:00 [FFmpeg-devel] [PATCH]lavf/hevc: Fix type specifiers Carl Eugen Hoyos
2022-09-02 21:56 ` Andreas Rheinhardt
2022-09-02 22:05   ` Carl Eugen Hoyos

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