[libcamera-devel] [PATCH v2 1/2] libcamera: control: initialise control info to ControlTypeNone by default

Christian Rauch Rauch.Christian at gmx.de
Tue Aug 30 22:21:23 CEST 2022


The default ControlInfo constructor allows to partially initialised the
min/max/def values. Uninitialised values are assigned to 0 by default. This
implicit initialisation makes it impossible to distinguish between and
uninitialised and an explicitly 0-initialised ControlValue.

Default construct the ControlValue in the ControlInfo default contructor to
explicitly represent uninitialised values by the ControlTypeNone type.

Signed-off-by: Christian Rauch <Rauch.Christian at gmx.de>
---
 include/libcamera/controls.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index ebc168fc..38d0a3e8 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -268,9 +268,9 @@ private:
 class ControlInfo
 {
 public:
-	explicit ControlInfo(const ControlValue &min = 0,
-			     const ControlValue &max = 0,
-			     const ControlValue &def = 0);
+	explicit ControlInfo(const ControlValue &min = {},
+			     const ControlValue &max = {},
+			     const ControlValue &def = {});
 	explicit ControlInfo(Span<const ControlValue> values,
 			     const ControlValue &def = {});
 	explicit ControlInfo(std::set<bool> values, bool def);
--
2.34.1



More information about the libcamera-devel mailing list