[FFmpeg-devel] [PATCH] lavc/qsv: suppress code scan complain

Mark Thompson sw at jkqxz.net
Wed May 9 17:38:36 EEST 2018


On 09/05/18 07:13, Zhong Li wrote:
> Suppress the complain "variables 'type' is used but maybe uninitialized".
> 
> Signed-off-by: Zhong Li <zhong.li at intel.com>
> ---
>  libavcodec/qsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 45e1c25..b578da0 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -197,7 +197,7 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame)
>  
>  enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type)
>  {
> -    enum AVPictureType type;
> +    enum AVPictureType type = AV_PICTURE_TYPE_NONE;
>      switch (mfx_pic_type & 0x7) {
>      case MFX_FRAMETYPE_I:
>          if (mfx_pic_type & MFX_FRAMETYPE_S)
> 

Might it be better to add a default case to the switch and assert that it's never reached?  I think if the pic type doesn't hit one of the existing cases then something must be very broken.

- Mark


More information about the ffmpeg-devel mailing list