[libcamera-devel] [PATCH v1] qcam: Remove redundant check

Jacopo Mondi jacopo.mondi at ideasonboard.com
Wed May 3 09:06:51 CEST 2023


Hi Barnabás

On Tue, May 02, 2023 at 05:55:53PM +0000, Barnabás Pőcze via libcamera-devel wrote:
> The switch statement checks `roles.size()` with cases for 1 and 2,
> so in the `default` branch, `role.size() > 2`, i.e. it is always
> different from 1, so the check is unnecessary.
>
> Signed-off-by: Barnabás Pőcze <pobrn at protonmail.com>

Indeed!
Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>

Thanks
  j

> ---
>  src/apps/qcam/main_window.cpp | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
> index fb2db4aa..680668df 100644
> --- a/src/apps/qcam/main_window.cpp
> +++ b/src/apps/qcam/main_window.cpp
> @@ -381,11 +381,8 @@ int MainWindow::startCapture()
>  		}
>  		break;
>  	default:
> -		if (roles.size() != 1) {
> -			qWarning() << "Unsupported stream configuration";
> -			return -EINVAL;
> -		}
> -		break;
> +		qWarning() << "Unsupported stream configuration";
> +		return -EINVAL;
>  	}
>
>  	/* Configure the camera. */
> --
> 2.40.1
>
>


More information about the libcamera-devel mailing list