[vlc-devel] [PATCH 4/8] vout: display: Fix initialization
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Fri Dec 4 09:31:10 CET 2020
On Fri, Dec 4, 2020, at 8:14 AM, Steve Lhomme wrote:
> Looking for "= {}" in the code I found a few more to fix in modules. Or
> is it OK when the {} is not casted to a struct ?
>
> On 2020-12-03 16:16, Hugo Beauzée-Luyssen wrote:
> > ---
> > src/video_output/display.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/video_output/display.c b/src/video_output/display.c
> > index 1d304e2b32..bde914f48b 100644
> > --- a/src/video_output/display.c
> > +++ b/src/video_output/display.c
> > @@ -726,7 +726,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
> > vout_display_t *vd = &osys->display;
> > vd->source = &osys->source;
> > vd->fmt = &osys->display_fmt;
> > - vd->info = (vout_display_info_t){ };
> > + vd->info = (vout_display_info_t){ 0 };
> > vd->cfg = &osys->cfg;
> > vd->ops = NULL;
> > vd->sys = NULL;
When building C it might be an issue depending on the compiler's tolerance. It is not standard C though.
In C++ it should work (provided the values in the braces are matching the object's members) if the initialization is an aggregate initialization. A compound literal might work, but again, depending on the compiler's tolerance as it's not standard C++
There might be some other occurrences of empty braces indeed, I just fixed those I encountered during building so far.
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the vlc-devel
mailing list