[libcamera-devel] [PATCH v2 08/11] test: v4l2_videodevice: Prevent variable aliasing of format

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Oct 16 00:37:47 CEST 2020


Rename the scoped usage of the variable format while iterating the formats
as it aliases the outer scoped format which is used for specific testing.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 test/v4l2_videodevice/formats.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/v4l2_videodevice/formats.cpp b/test/v4l2_videodevice/formats.cpp
index 043732dcaba1..e3283cf92bff 100644
--- a/test/v4l2_videodevice/formats.cpp
+++ b/test/v4l2_videodevice/formats.cpp
@@ -55,10 +55,10 @@ protected:
 			{ V4L2_PIX_FMT_Y16_BE, "Y16 -BE" }
 		};
 
-		for (const auto &format : formats) {
-			if (V4L2PixelFormat(format.first).toString() != format.second) {
+		for (const auto &fmt : formats) {
+			if (V4L2PixelFormat(fmt.first).toString() != fmt.second) {
 				cerr << "Failed to convert V4L2PixelFormat"
-				     << utils::hex(format.first) << "to string"
+				     << utils::hex(fmt.first) << "to string"
 				     << endl;
 				return TestFail;
 			}
-- 
2.25.1



More information about the libcamera-devel mailing list