[libcamera-devel] [PATCH] qcam: viewfinder_gl: selectColorSpace: fix maybe uninitialized warning

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Sep 2 16:18:03 CEST 2022


Hi Marco,

Thank you for the patch.

On Fri, Sep 02, 2022 at 04:11:36PM +0200, Marco Felsch via libcamera-devel wrote:
> Fix gcc11 warning introduced in commit 251f0534 ("qcam: viewfinder_gl:
> Take color space into account for YUV rendering"). Fix it by making the
> full range as default.

What exact compiler version are you using ? gcc 11.3.0 compiles the code
fine here. It seems to be a false positive, but if it causes breakages,
we of course want to fix/work around the problem.

> Fixes: 251f0534 ("qcam: viewfinder_gl: Take color space into account for YUV rendering")
> Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
> ---
>  src/qcam/viewfinder_gl.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp
> index e2aa2470..501c5bae 100644
> --- a/src/qcam/viewfinder_gl.cpp
> +++ b/src/qcam/viewfinder_gl.cpp
> @@ -367,6 +367,7 @@ void ViewFinderGL::selectColorSpace(const libcamera::ColorSpace &colorSpace)
>  	double offset;
>  
>  	switch (colorSpace.range) {
> +	default: /* Avoid gcc11 maybe-uninitialized warning */
>  	case libcamera::ColorSpace::Range::Full:
>  		offset = 0.0;
>  		break;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list