[libcamera-devel] [PATCH] libcamera: stream: Initialise pixelFormat in StreamConfiguration()

Paul Elder paul.elder at ideasonboard.com
Tue Jul 16 09:27:33 CEST 2019


Hi Laurent,

Thanks for the patch.

On Tue, Jul 16, 2019 at 09:00:42AM +0300, Laurent Pinchart wrote:
> To avoid depending on unitialised values, set the pixelFormat field of
> the StreamConfiguration class to 0 in the constructor.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Looks good to me.

Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>

> ---
>  src/libcamera/stream.cpp | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> index de505d12c07a..c28b4cd669b2 100644
> --- a/src/libcamera/stream.cpp
> +++ b/src/libcamera/stream.cpp
> @@ -289,7 +289,7 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const
>   * handlers provied StreamFormats.
>   */
>  StreamConfiguration::StreamConfiguration()
> -	: memoryType(InternalMemory), stream_(nullptr)
> +	: pixelFormat(0), memoryType(InternalMemory), stream_(nullptr)
>  {
>  }
>  
> @@ -297,7 +297,8 @@ StreamConfiguration::StreamConfiguration()
>   * \brief Construct a configuration with stream formats
>   */
>  StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
> -	: memoryType(InternalMemory), stream_(nullptr), formats_(formats)
> +	: pixelFormat(0), memoryType(InternalMemory), stream_(nullptr),
> +	  formats_(formats)
>  {
>  }
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list