[libcamera-devel] [PATCH 02/10] qcam: main_window: Re-use existing variable

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Oct 14 14:22:37 CEST 2020


Hi Kieran,

On 2020-10-13 16:12:33 +0100, Kieran Bingham wrote:
> The queueRequest function creates FrameBuffer pointer which aliases the
> existing and passed in buffer pointer.
> 
> When the captureRaw_ scope is executed, the original FrameBuffer *buffer
> is not used any more.
> 
> Re-use it rather than creating a new variable with the same name.

I know this is bikeshedding, but I really don't like reusing a function 
argument. Specially not for a new use-case like this where the 'buffer' 
argument passed in represents the viewfinder buffer ands the 'buffer' 
variable used here is the raw buffer. Would it not make more sens to 
rename this buffer rawBuffer or something similar?

> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  src/qcam/main_window.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> index 0cbdab9a6bce..0e50768aa386 100644
> --- a/src/qcam/main_window.cpp
> +++ b/src/qcam/main_window.cpp
> @@ -769,7 +769,7 @@ void MainWindow::queueRequest(FrameBuffer *buffer)
>  	request->addBuffer(vfStream_, buffer);
>  
>  	if (captureRaw_) {
> -		FrameBuffer *buffer = nullptr;
> +		buffer = nullptr;
>  
>  		{
>  			QMutexLocker locker(&mutex_);
> -- 
> 2.25.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list