lavc/qsv_overlay: suppress code scan complain

Message ID 1530604454-15848-1-git-send-email-zhong.li@intel.com
State New
Headers show
Series
  • lavc/qsv_overlay: suppress code scan complain
Related show

Commit Message

Li, Zhong July 3, 2018, 7:54 a.m.
Suppress the complain "variables 'pix_fmt' is used but maybe
uninitialized".

Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 libavfilter/vf_overlay_qsv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maxym Dmytrychenko July 3, 2018, 8:18 a.m. | #1
should it be AV_PIX_FMT_NONE ?

On Tue, Jul 3, 2018 at 9:53 AM Zhong Li <zhong.li@intel.com> wrote:

> Suppress the complain "variables 'pix_fmt' is used but maybe
> uninitialized".
>
> Signed-off-by: Zhong Li <zhong.li@intel.com>
> ---
>  libavfilter/vf_overlay_qsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c
> index 89f2fb1..33d50a5 100644
> --- a/libavfilter/vf_overlay_qsv.c
> +++ b/libavfilter/vf_overlay_qsv.c
> @@ -162,7 +162,7 @@ release:
>
>  static int have_alpha_planar(AVFilterLink *link)
>  {
> -    enum AVPixelFormat pix_fmt;
> +    enum AVPixelFormat pix_fmt = link->format;
>      const AVPixFmtDescriptor *desc;
>      AVHWFramesContext *fctx;
>
> --
> 2.7.4
>
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
Li, Zhong July 4, 2018, 5:21 a.m. | #2
IMHO, if link format is QSV, should pass from sw_format, else should pass from link->format direct.
Initializing it to be AV_PIX_FMT_NONE is approximate to un-initialization for non QSV format case.

> -----Original Message-----
> From: libav-devel [mailto:libav-devel-bounces@libav.org] On Behalf Of
> Maxym Dmytrychenko
> Sent: Tuesday, July 3, 2018 4:18 PM
> To: libav development <libav-devel@libav.org>
> Subject: Re: [libav-devel] [PATCH] lavc/qsv_overlay: suppress code scan
> complain
> 
> should it be AV_PIX_FMT_NONE ?
> 
> On Tue, Jul 3, 2018 at 9:53 AM Zhong Li <zhong.li@intel.com> wrote:
> 
> > Suppress the complain "variables 'pix_fmt' is used but maybe
> > uninitialized".
> >
> > Signed-off-by: Zhong Li <zhong.li@intel.com>
> > ---
> >  libavfilter/vf_overlay_qsv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_overlay_qsv.c
> > b/libavfilter/vf_overlay_qsv.c index 89f2fb1..33d50a5 100644
> > --- a/libavfilter/vf_overlay_qsv.c
> > +++ b/libavfilter/vf_overlay_qsv.c
> > @@ -162,7 +162,7 @@ release:
> >
> >  static int have_alpha_planar(AVFilterLink *link)  {
> > -    enum AVPixelFormat pix_fmt;
> > +    enum AVPixelFormat pix_fmt = link->format;
> >      const AVPixFmtDescriptor *desc;
> >      AVHWFramesContext *fctx;
> >
> > --
> > 2.7.4
> >
> > _______________________________________________
> > libav-devel mailing list
> > libav-devel@libav.org
> > https://lists.libav.org/mailman/listinfo/libav-devel
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel

Patch

diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c
index 89f2fb1..33d50a5 100644
--- a/libavfilter/vf_overlay_qsv.c
+++ b/libavfilter/vf_overlay_qsv.c
@@ -162,7 +162,7 @@  release:
 
 static int have_alpha_planar(AVFilterLink *link)
 {
-    enum AVPixelFormat pix_fmt;
+    enum AVPixelFormat pix_fmt = link->format;
     const AVPixFmtDescriptor *desc;
     AVHWFramesContext *fctx;