[libcamera-devel] [PATCH 2/2] Explicit cast to int

Utkarsh Tiwari utkarsh02t at gmail.com
Thu Apr 21 19:25:49 CEST 2022


After introduction of float values to options the conversion of unsigned int to int or vice versa is regarded as the same rank as conversion to and from float. Fix this by using an explicit cast
---
 src/cam/stream_options.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cam/stream_options.cpp b/src/cam/stream_options.cpp
index 150bd27c..83d216b7 100644
--- a/src/cam/stream_options.cpp
+++ b/src/cam/stream_options.cpp
@@ -90,8 +90,8 @@ int StreamKeyValueParser::updateConfiguration(CameraConfiguration *config,
 		StreamConfiguration &cfg = config->at(i++);
 
 		if (opts.isSet("width") && opts.isSet("height")) {
-			cfg.size.width = opts["width"];
-			cfg.size.height = opts["height"];
+			cfg.size.width = static_cast<int>(opts["width"]);
+			cfg.size.height = static_cast<int>(opts["height"]);
 		}
 
 		if (opts.isSet("pixelformat"))
-- 
2.25.1



More information about the libcamera-devel mailing list