{"id":2131,"url":"https://patchwork.libcamera.org/api/1.1/patches/2131/?format=json","web_url":"https://patchwork.libcamera.org/patch/2131/","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":"<20191007224642.6597-4-laurent.pinchart@ideasonboard.com>","date":"2019-10-07T22:46:36","name":"[libcamera-devel,3/9] libcamera: controls: Store control name in ControlId","commit_ref":null,"pull_url":null,"state":"superseded","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/2131/mbox/","series":[{"id":526,"url":"https://patchwork.libcamera.org/api/1.1/series/526/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=526","date":"2019-10-07T22:46:33","name":"Use ControlList for both libcamera and V4L2 controls","version":1,"mbox":"https://patchwork.libcamera.org/series/526/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2131/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2131/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D38B76196D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Oct 2019 00:46:53 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(modemcable118.64-20-96.mc.videotron.ca [96.20.64.118])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DD8CDB2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Oct 2019 00:46:52 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1570488413;\n\tbh=Or7twWIOEHG3Sh66YjvPhV7jDAQxmDeF4WX3kjWOeBQ=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Q5pTExUdclVbmBhpwDorEfH+Db3swQRm6UexUvSbhOfy9wDh9Q7NWOUByer4HnSJ+\n\tBjlRcxuzy0vgZSvAa0mPCWNRbpFHtyr+ZdiKziejrM39wg1xTHl4JuIUJUPASO20u1\n\tD2qSPdB5HovAIi/3encaTisiBO8dbQwfB1fi4zwM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  8 Oct 2019 01:46:36 +0300","Message-Id":"<20191007224642.6597-4-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20191007224642.6597-1-laurent.pinchart@ideasonboard.com>","References":"<20191007224642.6597-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 3/9] libcamera: controls: Store control\n\tname 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":"Mon, 07 Oct 2019 22:46:54 -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>\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 49ff1a6f747f..a5a6a135ec16 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -54,11 +54,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@@ -68,7 +68,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 f862a09adef9..e528dd80a2a7 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -205,7 +205,7 @@ std::string ControlValue::toString() 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","3/9"]}