{"id":2167,"url":"https://patchwork.libcamera.org/api/1.1/patches/2167/?format=json","web_url":"https://patchwork.libcamera.org/patch/2167/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191012184407.31684-7-laurent.pinchart@ideasonboard.com>","date":"2019-10-12T18:43:59","name":"[libcamera-devel,v2,06/14] libcamera: controls: Store control name in ControlId","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"3f3d0a8c31d24d1a0824ce628b50608f1f5e7870","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2167/mbox/","series":[{"id":531,"url":"https://patchwork.libcamera.org/api/1.1/series/531/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=531","date":"2019-10-12T18:43:53","name":"Use ControlList for both libcamera and V4L2 controls","version":2,"mbox":"https://patchwork.libcamera.org/series/531/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2167/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2167/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 9FE1361978\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 12 Oct 2019 20:44:20 +0200 (CEST)","from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C527933A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 12 Oct 2019 20:44:19 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1570905860;\n\tbh=IA9VBgPUp8yRKmdQjnufsiRaJSC3uSX3RWPnb4Z3Y8U=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=CIhr+Qr3AYmprIMfS35pvzLj+9bTrX7l+XFT5Z45oRfOzxezRhY+X9f+gkhXF6IV5\n\todWZRt+95wFmf7BkcRz1bTLyLh4SiO21XqTHM1PbL6CAiFWef7vVwnHPYAS/lHZ0HA\n\tDLxMYwtSg8bmnGMFGPITBjWJanLhP5o5HzguSRMo=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 12 Oct 2019 21:43:59 +0300","Message-Id":"<20191012184407.31684-7-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20191012184407.31684-1-laurent.pinchart@ideasonboard.com>","References":"<20191012184407.31684-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 06/14] libcamera: controls: Store\n\tcontrol name in ControlId","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>","X-List-Received-Date":"Sat, 12 Oct 2019 18:44:20 -0000"},"content":"The ControlId class stores a pointer to the control name. This works\nfine for statically-defined controls, but requires code that allocates\ncontrols dynamically (for instance based on control discovery on a V4L2\ndevice) to keep a list of control names in separate storage. To ease\nusage of dynamically allocated controls, store a copy of the control\nname string in the ControlId class.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/controls.h | 6 +++---\n src/libcamera/controls.cpp   | 2 +-\n 2 files changed, 4 insertions(+), 4 deletions(-)","diff":"diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 12a13aacb198..999fcf7a3a62 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -60,11 +60,11 @@ class ControlId\n {\n public:\n \tunsigned int id() const { return id_; }\n-\tconst char *name() const { return name_; }\n+\tconst std::string &name() const { return name_; }\n \tControlType type() const { return type_; }\n \n protected:\n-\tControlId(unsigned int id, const char *name, ControlType type)\n+\tControlId(unsigned int id, const std::string &name, ControlType type)\n \t\t: id_(id), name_(name), type_(type)\n \t{\n \t}\n@@ -74,7 +74,7 @@ private:\n \tControlId &operator=(const ControlId &) = delete;\n \n \tunsigned int id_;\n-\tconst char *name_;\n+\tstd::string name_;\n \tControlType type_;\n };\n \ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex bfab177fc508..292e48cd6d25 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -232,7 +232,7 @@ bool ControlValue::operator==(const ControlValue &other) const\n  */\n \n /**\n- * \\fn ControlId::ControlId(unsigned int id, const char *name, ControlType type)\n+ * \\fn ControlId::ControlId(unsigned int id, const std::string &name, ControlType type)\n  * \\brief Construct a ControlId instance\n  * \\param[in] id The control numerical ID\n  * \\param[in] name The control name\n","prefixes":["libcamera-devel","v2","06/14"]}