[libcamera-devel,1/5] libcamera: geometry: Don't default-initialize Size unnecessarily

Message ID 20200714234009.16596-2-laurent.pinchart@ideasonboard.com
State Accepted
Commit 120cbd802463803165d342a0206f820bd1e11e6c
Headers show
Series
  • libcamera: Various improvements to geometry classes
Related show

Commit Message

Laurent Pinchart July 14, 2020, 11:40 p.m. UTC
Size has a default constructor, there's no need to default-initialize
instances explicitly. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Niklas Söderlund July 15, 2020, 6:20 a.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2020-07-15 02:40:05 +0300, Laurent Pinchart wrote:
> Size has a default constructor, there's no need to default-initialize
> instances explicitly. Fix it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index c6cb84e0b0c9..009e502b288c 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -418,7 +418,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
>  
>  	unsigned int rawCount = 0, outCount = 0, count = 0, maxIndex = 0;
>  	std::pair<int, Size> outSize[2];
> -	Size maxSize = {};
> +	Size maxSize;
>  	for (StreamConfiguration &cfg : config_) {
>  		if (isRaw(cfg.pixelFormat)) {
>  			/*
> @@ -621,7 +621,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
>  	for (auto const stream : data->streams_)
>  		stream->reset();
>  
> -	Size maxSize = {}, sensorSize = {};
> +	Size maxSize, sensorSize;
>  	unsigned int maxIndex = 0;
>  	bool rawStream = false;
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index c6cb84e0b0c9..009e502b288c 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -418,7 +418,7 @@  CameraConfiguration::Status RPiCameraConfiguration::validate()
 
 	unsigned int rawCount = 0, outCount = 0, count = 0, maxIndex = 0;
 	std::pair<int, Size> outSize[2];
-	Size maxSize = {};
+	Size maxSize;
 	for (StreamConfiguration &cfg : config_) {
 		if (isRaw(cfg.pixelFormat)) {
 			/*
@@ -621,7 +621,7 @@  int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
 	for (auto const stream : data->streams_)
 		stream->reset();
 
-	Size maxSize = {}, sensorSize = {};
+	Size maxSize, sensorSize;
 	unsigned int maxIndex = 0;
 	bool rawStream = false;