[libcamera-devel] [PATCH 16/23] libcamera: controls: Don't convert 32-bit and 64-bit implicitly

Jacopo Mondi jacopo at jmondi.org
Mon Jan 13 17:42:38 CET 2020


From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

The ControlValue::get<T>() method verifies that the T type corresponds
to the ControlValue type. It however accepts int32_t as a return type
for 64-bit integer controls, and int64_t as a return type for 32-bit
integer controls. There's no reason to do so anymore, make the type
check stricter.

Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/libcamera/controls.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index 7718a53911e6..c311ab1d6af1 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -255,7 +255,7 @@ Span<bool> ControlValue::get<Span<bool>>() const
 template<>
 int32_t ControlValue::get<int32_t>() const
 {
-	ASSERT(type_ == ControlTypeInteger32 || type_ == ControlTypeInteger64);
+	ASSERT(type_ == ControlTypeInteger32);
 
 	return integer32_;
 }
@@ -272,7 +272,7 @@ Span<int32_t> ControlValue::get<Span<int32_t>>() const
 template<>
 int64_t ControlValue::get<int64_t>() const
 {
-	ASSERT(type_ == ControlTypeInteger32 || type_ == ControlTypeInteger64);
+	ASSERT(type_ == ControlTypeInteger64);
 
 	return integer64_;
 }
-- 
2.24.0



More information about the libcamera-devel mailing list