From 4843f72b131388b3da1d4cbb8dc48800b8b0559e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 18 Dec 2023 16:04:25 +0200 Subject: libcamera: camera: Fix unused variable compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When compiling with gcc 8.4.0, the compiler was reported to throw an unused variable warning: ../src/libcamera/camera.cpp: In member function ‘libcamera::CameraConfiguration::Status libcamera::CameraConfiguration::validateColorSpaces(libcamera::CameraConfiguration::ColorSpaceFlags)’: ../src/libcamera/camera.cpp:497:19: error: unused variable ‘i’ [-Werror=unused-variable] for (auto [i, cfg] : utils::enumerate(config_)) { ^ The build environment may have been incorrect as the problem couldn't be reproduced with gcc 8.3.0 and 8.5.0. Nonetheless, the 'i' variable is indeed unused. It turns out that the code can be simplified, as the commit that removed usage of the variable kept the now unneeded utils::enumerate() call. Simplify the code and fix the warning in one go. Fixes: 13986d6ce3ab ("libcamera: camera: Fix validateColorSpaces to choose "main" colour space") Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/camera.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 0ad1a4b5..a71dc933 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -494,7 +494,7 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF std::optional colorSpace; Size size; - for (auto [i, cfg] : utils::enumerate(config_)) { + for (StreamConfiguration &cfg : config_) { if (!cfg.colorSpace) continue; -- cgit v1.2.1