From f9c28992a9f591124db24b44d94b88ff4ca294f8 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 11 Aug 2022 03:50:01 +0300 Subject: libcamera: controls: Construct Span with size for array controls The ControlList::set() function overload used for array controls constructs a Span from an initializer list. It doesn't specify the Span size explicitly, which results in a dynamic extent Span being constructed. That causes a compilation failure for fixed-size array controls, as they are defined as Control with T being a fixed-extent Span, and conversion from a dynamic-extent to fixed-extent Span when calling ControlValue::set() can't be implicit. Fix this by constructing the Span using the size of the control, which resolves to a fixed-extent and dynamic-extent Span for fixed-size and dynamic-size array controls respectively. The ControlList::set() function that takes an initializer list can then be used for fixed-size array controls. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain --- include/libcamera/controls.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 38d0a3e8..cf942055 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -393,14 +393,14 @@ public: val->set(value); } - template - void set(const Control &ctrl, const std::initializer_list &value) + template + void set(const Control> &ctrl, const std::initializer_list &value) { ControlValue *val = find(ctrl.id()); if (!val) return; - val->set(Span>{ value.begin(), value.size() }); + val->set(Span, Size>{ value.begin(), value.size() }); } const ControlValue &get(unsigned int id) const; -- cgit v1.2.1