[{"id":24908,"web_url":"https://patchwork.libcamera.org/comment/24908/","msgid":"<20220903005225.GC113531@pyrite.rasen.tech>","date":"2022-09-03T00:52:25","subject":"Re: [libcamera-devel] [PATCH v3 2/2] libcamera: control: initialise\n\tcontrol info to ControlTypeNone by default","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"On Sat, Sep 03, 2022 at 12:49:39AM +0200, Christian Rauch via libcamera-devel wrote:\n> The default ControlInfo constructor allows to partially initialised the\n\ns/to partially initialised/partially initialising/\n\n> min/max/def values. Uninitialised values are assigned to 0 by default. This\n> implicit initialisation makes it impossible to distinguish between and\n\ns/and/an/\n\n> uninitialised and an explicitly 0-initialised ControlValue.\n> \n> Default construct the ControlValue in the ControlInfo default contructor to\n> explicitly represent uninitialised values by the ControlTypeNone type.\n> \n> Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  include/libcamera/controls.h   | 6 +++---\n>  test/controls/control_info.cpp | 4 ++--\n>  2 files changed, 5 insertions(+), 5 deletions(-)\n> \n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index ebc168fc..38d0a3e8 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -268,9 +268,9 @@ private:\n>  class ControlInfo\n>  {\n>  public:\n> -\texplicit ControlInfo(const ControlValue &min = 0,\n> -\t\t\t     const ControlValue &max = 0,\n> -\t\t\t     const ControlValue &def = 0);\n> +\texplicit ControlInfo(const ControlValue &min = {},\n> +\t\t\t     const ControlValue &max = {},\n> +\t\t\t     const ControlValue &def = {});\n>  \texplicit ControlInfo(Span<const ControlValue> values,\n>  \t\t\t     const ControlValue &def = {});\n>  \texplicit ControlInfo(std::set<bool> values, bool def);\n> diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> index 2827473b..56b4101f 100644\n> --- a/test/controls/control_info.cpp\n> +++ b/test/controls/control_info.cpp\n> @@ -26,8 +26,8 @@ protected:\n>  \t\t */\n>  \t\tControlInfo brightness;\n> \n> -\t\tif (brightness.min().get<int32_t>() != 0 ||\n> -\t\t    brightness.max().get<int32_t>() != 0) {\n> +\t\tif (brightness.min().type() != ControlType::ControlTypeNone ||\n> +\t\t    brightness.max().type() != ControlType::ControlTypeNone) {\n>  \t\t\tcout << \"Invalid control range for Brightness\" << endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\n> --\n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C6D58C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  3 Sep 2022 00:52:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8A37F62021;\n\tSat,  3 Sep 2022 02:52:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 672D462003\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  3 Sep 2022 02:52:48 +0200 (CEST)","from pyrite.rasen.tech (unknown [50.228.9.220])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD9FC6DD;\n\tSat,  3 Sep 2022 02:52:47 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662166369;\n\tbh=Buz92xrGpm0i7UYZexk1dMFnw0pKi4jMOg/IhjsCL1M=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=u/B+aZYSITlMuDyRqKDbX99ZuljAsg8okUH6U3sc0t/4wTvkuIoTs/QRgaNrwCyVP\n\tokPj75xe9FvwbOyO88pgeRNwHw1HVUjPDcapAokynuj7BJKcSWRLKe9aTfjVz+55sP\n\t8bcYl8QwbL26WurZ6+4AlvnoLftH8L7eUmziB0Hlvaeq7cAffHnR0yylAmNlU27qEl\n\trEf9wMNdrnX2HYed0ZR1gS1GxzV3yW1eBc1tRozM9PB0TWbSVhe8Sgm/2c8BT1ijjd\n\tb4z5kRrMtW+wGcRzZpy4kBPqFagWsz+eRPl9n3+0TqD0V8dj8r/dLsIJdN5KsbGI1f\n\tLIpgCjpbTIBJQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662166368;\n\tbh=Buz92xrGpm0i7UYZexk1dMFnw0pKi4jMOg/IhjsCL1M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=edhmR+loqC8lhzdb714vGPoUcvMLJ6vurna8cjaEEfykZPbMH1La4n4L5TmIQ7ucF\n\tgx/uFsVRf45S837clNJvwVd++9OAuDni/WEb61m/qwnSda9gmKxM0Gg/7YbgEjRD9T\n\tXvaUPqC1sXWZmGSoYAmtK+MJiuDuMiVht343OhHI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"edhmR+lo\"; dkim-atps=neutral","Date":"Fri, 2 Sep 2022 20:52:25 -0400","To":"Christian Rauch <Rauch.Christian@gmx.de>","Message-ID":"<20220903005225.GC113531@pyrite.rasen.tech>","References":"<20220902224939.111640-1-Rauch.Christian@gmx.de>\n\t<20220902224939.111640-2-Rauch.Christian@gmx.de>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20220902224939.111640-2-Rauch.Christian@gmx.de>","Subject":"Re: [libcamera-devel] [PATCH v3 2/2] libcamera: control: initialise\n\tcontrol info to ControlTypeNone by default","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"paul.elder@ideasonboard.com","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]