From patchwork Thu Oct 6 23:07:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17558 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 72FD7BD16B for ; Thu, 6 Oct 2022 23:08:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2913262D07; Fri, 7 Oct 2022 01:08:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1665097681; bh=5RD1PXUGvhzpLRYGfkbmlyL16KVADQxTMpFINfHZAxg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=1AAIcKCXjmFB+RcraLJ94GmG61nxMlZkfuA9hhwSLVaUuAyFlbzPXy2PKSp06j0kB llPcwJGPeiy6DWdbDviuR8o7orSyO0xI8RfpoxsV1izpWCbm1LXnNqiU+yLYMfWqFF q/YnkVWkWRJiRVPOKoaQIQVhwkuqADecZYl6c/CzaucOfIms8DFVxoZbxQ5iXLfmLo gUpoj+S+KAdVP8QWaIK/cycZTijVrKAMecyN3BFw/+A1IcapzKVdXmT3z0EyrjBS5+ Ven85p01WoLXKRGn5racEDeIVsXc2qeWfEPxXSFeNW0JgbXTLGZJGC6GjEzulWpD15 AtsZlUfrtUCSA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3AC2962D07 for ; Fri, 7 Oct 2022 01:07:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qaIHJQyI"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B39906D6; Fri, 7 Oct 2022 01:07:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1665097679; bh=5RD1PXUGvhzpLRYGfkbmlyL16KVADQxTMpFINfHZAxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qaIHJQyIBIiq+SPCXnN/fMHwRjCvQ4to7Pwfm5CJtn4VJoOMVRE0zgfYx12ldaJoK WmQg0S5zC4KCaoIejl3ogrVpqhPd3gB8wDI7goVQJlfsgRdgz6DVXb7/3jilUvjHPP sp6iyzuxepc+PxhL2nFHHzka2wW60Dnr/lekMHqM= To: libcamera-devel@lists.libcamera.org Date: Fri, 7 Oct 2022 02:07:46 +0300 Message-Id: <20221006230747.11688-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221006230747.11688-1-laurent.pinchart@ideasonboard.com> References: <20221006230747.11688-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/4] libcamera: controls: Construct Span with size for array controls X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 +++--- src/libcamera/controls.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 38d0a3e8360a..cf94205577a5 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; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index bc3db4f69388..6dbf9b348709 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -970,7 +970,7 @@ bool ControlList::contains(unsigned int id) const */ /** - * \fn ControlList::set(const Control &ctrl, const std::initializer_list &value) + * \fn ControlList::set(const Control> &ctrl, const std::initializer_list &value) * \copydoc ControlList::set(const Control &ctrl, const V &value) */