[vlc-devel] [PATCH] display: fix a few warnings

Johan Gunnarsson johan.gunnarsson at gmail.com
Wed Jan 16 22:02:56 CET 2019


Den ons 16 jan. 2019 kl 21:32 skrev Rémi Denis-Courmont <remi at remlab.net>:
>
> Le keskiviikkona 16. tammikuuta 2019, 22.26.15 EET Johan Gunnarsson a écrit :
> > video_output/display.c: In function ‘VoutDisplayCreateRender’:
> > video_output/display.c:341:9: warning: ‘ret’ may be used uninitialized in
> > this function [-Wmaybe-uninitialized] int ret;
> >          ^~~
> > video_output/display.c: In function ‘vout_display_TranslateMouseState’:
> > video_output/display.c:262:23: warning: ‘y’ may be used uninitialized in
> > this function [-Wmaybe-uninitialized] + (int64_t)(y - place.y) *
> > vd->source.i_visible_height / place.height; ~~~^~~~~~~~~~
> > video_output/display.c:260:23: warning: ‘x’ may be used uninitialized in
> > this function [-Wmaybe-uninitialized] + (int64_t)(x - place.x) *
> > vd->source.i_visible_width / place.width; ~~~^~~~~~~~~~
> > ---
> >  src/video_output/display.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/video_output/display.c b/src/video_output/display.c
> > index be744e0b98..471bbd0b3b 100644
> > --- a/src/video_output/display.c
> > +++ b/src/video_output/display.c
> > @@ -219,7 +219,7 @@ void vout_display_TranslateMouseState(vout_display_t
> > *vd, vlc_mouse_t *video, }
> >
> >      const int wx = window->i_x, wy = window->i_y;
> > -    int x, y;
> > +    int x = wx, y = wy;
>
> Assigned value is never used (and I don't see any warnings), but you may want
> to mark the default switch case unreachable.

Yeah, this is a better solution.

>
> >
> >      switch (vd->source.orientation) {
> >          case ORIENT_TOP_LEFT:
> > @@ -338,7 +338,7 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
> >      es_format_InitFromVideo(&src, &v_src);
> >
> >      /* */
> > -    int ret;
> > +    int ret = -1;
>
> Assigned value is never used, and I don't see a warning.

Hmm, I see the warning with GCC 8.0 but not with Clang 6. I'll skip
this part of the patch since it's obvious that Clang is right here.

>
> Maybe a do/while would work around your deficient compiler analysis passes.
>
> >
> >      for (int i = 0; i < 1 + (v_dst_cmp.i_chroma != v_dst.i_chroma); i++) {
> >          es_format_t dst;
>
>
> --
> Реми Дёни-Курмон
> http://www.remlab.net/
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list