[FFmpeg-devel] [PATCH] fix few compiler warnings

Michael Niedermayer michael at niedermayer.cc
Sat May 21 22:37:04 CEST 2016


On Sat, May 21, 2016 at 02:21:17PM +0000, Davinder Singh wrote:
> hi,
> 
> this patch fixes following compiler warnings:
> 
> libavcodec/cfhd.c:346:78: warning: format specifies type 'unsigned short'
> but the argument has type 'int' [-Wformat]
>             av_log(avctx, AV_LOG_DEBUG, "Small chunk length %"PRIu16"
> %s\n", data * 4, tag < 0 ? "optional" : "required");
>                                                             ~~
>   ^~~~~~~~
> libavcodec/cfhd.c:472:110: warning: format specifies type 'unsigned short'
> but the argument has type 'int' [-Wformat]
>             av_log(avctx, AV_LOG_DEBUG, "Start of lowpass coeffs component
> %"PRIu16" height:%d, width:%d\n", s->channel_num, lowpass_height,
> lowpass_width);
> 
>  ~~                                ^~~~~~~~~~~~~~
> libavcodec/cfhd.c:490:77: warning: format specifies type 'unsigned short'
> but the argument has type 'int' [-Wformat]
>             av_log(avctx, AV_LOG_DEBUG, "Lowpass coefficients %"PRIu16"\n",
> lowpass_width * lowpass_height);
>                                                               ~~
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> 
> libavcodec/dv_tablegen.c:30:60: warning: format specifies type 'char' but
> the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
>                    "{0x%"PRIx32", %"PRId8"}", data[i].vlc, data[i].size)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
> libavcodec/tableprint.h:37:29: note: expanded from macro
> 'WRITE_1D_FUNC_ARGV'
>        printf(" "fmtstr",", __VA_ARGS__);\
>                             ^~~~~~~~~~~
> libavcodec/dv_tablegen.c:30:60: warning: format specifies type 'char' but
> the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
>                    "{0x%"PRIx32", %"PRId8"}", data[i].vlc, data[i].size)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
> 
> 
> 
> libavfilter/af_hdcd.c:896:57: warning: shifting a negative signed value is
> undefined [-Wshift-negative-value]
>             state->readahead = readaheadtab[bits & ~(-1 << 8)];
> 
> 
> 
> libavfilter/vf_hwdownload.c:59:5: warning: ignoring return value of
> function declared with warn_unused_result attribute [-Wunused-result]
>     ff_formats_ref(infmts,  &avctx->inputs[0]->out_formats);
>     ^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> libavfilter/vf_hwdownload.c:60:5: warning: ignoring return value of
> function declared with warn_unused_result attribute [-Wunused-result]
>     ff_formats_ref(outfmts, &avctx->outputs[0]->in_formats);
>     ^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> 
> libavutil/opencl.c:456:17: warning: variable 'kernel_source' is used
> uninitialized whenever 'for' loop exits because its condition is false
> [-Wsometimes-uninitialized]
>     for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> libavutil/opencl.c:466:10: note: uninitialized use occurs here
>     if (!kernel_source) {
>          ^~~~~~~~~~~~~
> libavutil/opencl.c:456:17: note: remove the condition if it is always true
>     for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> libavutil/opencl.c:448:30: note: initialize the variable 'kernel_source' to
> silence this warning
>     const char *kernel_source;
>                              ^
>                               = NULL

>  libavcodec/cfhd.c           |    6 +++---
>  libavcodec/dv_tablegen.c    |    2 +-
>  libavfilter/af_hdcd.c       |    2 +-
>  libavfilter/vf_hwdownload.c |    6 ++++--
>  libavutil/opencl.c          |    2 +-

please split this patch
the fixed warnings are unrelated to each other and possibly differnt
developers would like to reply to different parts

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160521/20ad062a/attachment.sig>


More information about the ffmpeg-devel mailing list