{"id":16698,"url":"https://patchwork.libcamera.org/api/1.1/patches/16698/?format=json","web_url":"https://patchwork.libcamera.org/patch/16698/","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":"<20220720081534.26400-1-naush@raspberrypi.com>","date":"2022-07-20T08:15:34","name":"[libcamera-devel,v2] libcamera: controls: Suppress error message from ControlList::get()","commit_ref":"8b02645845bf404fba83910818b285b652f14f89","pull_url":null,"state":"accepted","archived":false,"hash":"a594b93c071a49e0707df647a368b4d837ed186e","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16698/mbox/","series":[{"id":3306,"url":"https://patchwork.libcamera.org/api/1.1/series/3306/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3306","date":"2022-07-20T08:15:34","name":"[libcamera-devel,v2] libcamera: controls: Suppress error message from ControlList::get()","version":2,"mbox":"https://patchwork.libcamera.org/series/3306/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16698/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16698/checks/","tags":{},"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 C5BE9BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Jul 2022 08:15:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F07A763313;\n\tWed, 20 Jul 2022 10:15:44 +0200 (CEST)","from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9D82260488\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jul 2022 10:15:43 +0200 (CEST)","by mail-wm1-x32f.google.com with SMTP id\n\th14-20020a1ccc0e000000b0039eff745c53so762076wmb.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jul 2022 01:15:43 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbp7-20020a5d5a87000000b0021d80f53324sm15555705wrb.7.2022.07.20.01.15.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 20 Jul 2022 01:15:42 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658304945;\n\tbh=s2VY5y0Lp8mjA4vzMVkyxNv/+lAUOnBtupHdG9moegc=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=AxhCDfQF8QwUNFp4RCBHRpH0h3OpQvQlVAn35rPmICmU2b70QjNhmbJ2g2aDuqhu1\n\tG4UDc2RL/ME9BM6MqPGkyod0BZgyVhJBcNd1+JFnZq8sP+27UDLxVD85bWrZ1oqXJs\n\tS1CShXpR5yCinmsczB/0poWQVt6oxgsYbnk15bYzSICDdlGNwh6eslNA2QmoNXVBBF\n\trjJNCxJPhXWca4W7nBvytGhlgRVbTLBbWY+Pj2TyCNOuDoTNVAURKXt2J90SxH8EqJ\n\tInLqZgydswbKbdxohi3C9tFxB6Gmo2DBO6BtUYQoWYQ+vDbdeDs9SkmqNVJAMGgJIR\n\tTnJ6hm1IKK5mg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=Frt4dA9IQ4++88nxAX3d5SWe2d3G3n6SLoaXZ+zXUhk=;\n\tb=DJk2+n1G511+L0PFoP3MD23WkhcDRDinBO6Cv1tjEzFeaTEuzj/rlib+yy7wZIcByT\n\toiemNSr+UO4b+chyC+BR+n6WpjYSvef753E9ODu3W9HdINJvzGgr5yH2KWQhnJPUyeZH\n\tPeak1a2hE1zHkZR92aeCMINGUKpBtUXq1uC61em/PjrDfjDEKEtykysJsCNMljzqKDNM\n\tzmyRDFnlvWPGColprHTPkMJZn75py8ZBnKAk7ISBz97aUmvGhB9+1ttL5dMkJWEtSco5\n\tlpnbRFDkDNh1dy1aeE6aNQhKgk8FyLW8TMV6FG+dg+zCFoE2LzT3BB2+R56nKVNGU+KZ\n\tSfyA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"DJk2+n1G\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=Frt4dA9IQ4++88nxAX3d5SWe2d3G3n6SLoaXZ+zXUhk=;\n\tb=xpW5337mF3ZS2wLSyXdY1Kr1agSWLrkZ+4KzIp5DcOCQ7qstZAVXoJIjRPXqMu2XKJ\n\tsH+sOCEchoM2eCQITynTpOZEuIapbDgdF7zzT/jBwrHRZ+F4zAUFGgn0t5xHMJczCZ06\n\t3hQ6g6q+UMRPMA9Xo7pxyHYANePeSUUQZsM1JdKthpf9/9p93hFP0ElrpCuIbUfK4o/N\n\tLgUKZG6OzMAJcZ84g3tnj6i9AwugufUrDO5izWYECE4spOiRMdowbu5JcQIChzHnvTBq\n\t4XqIGjX1zv2P9pVb3b5wOTm64RzLqWIwBlvwyMXuWkqmrSTMQvvxMCA0pFdIZzBcwkVy\n\tTWlQ==","X-Gm-Message-State":"AJIora+QvzNg+4/OPYCBVnWGWZrDCMIKFIWoqoadxIplj9YI3Hh9T4OZ\n\tCgZ57myTcvtjf+gX/UzuaIMbgCtj8928aw==","X-Google-Smtp-Source":"AGRyM1tr7bfoxHIXG2ZI8VITvHC3GI/uIdAIieqqSwxa2gtmeS/9pe11XpPienzRmPurneQBT77SHg==","X-Received":"by 2002:a7b:c401:0:b0:3a2:ca58:85bc with SMTP id\n\tk1-20020a7bc401000000b003a2ca5885bcmr2756901wmi.156.1658304942806; \n\tWed, 20 Jul 2022 01:15:42 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 20 Jul 2022 09:15:34 +0100","Message-Id":"<20220720081534.26400-1-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2] libcamera: controls: Suppress error\n\tmessage from ControlList::get()","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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Now that ControlList::get() returns a std::optional<T> to handle missing\ncontrols, the error log message in the call to ControlList::find() is\nunnecessary and likely invalid.\n\nFix this by avoding the call to ControlList::find() from ControlList::get() and\nreplacing with a call to the underlying std::unordered_map::find().\n\nFixes: 1c4d48018505 (\"libcamera: controls: Use std::optional to handle invalid control values\")\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/controls.h | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)","diff":"diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 192be78434dc..8362fce813fb 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -376,11 +376,12 @@ public:\n \ttemplate<typename T>\n \tstd::optional<T> get(const Control<T> &ctrl) const\n \t{\n-\t\tconst ControlValue *val = find(ctrl.id());\n-\t\tif (!val)\n+\t\tconst auto entry = controls_.find(ctrl.id());\n+\t\tif (entry == controls_.end())\n \t\t\treturn std::nullopt;\n \n-\t\treturn val->get<T>();\n+\t\tconst ControlValue &val = entry->second;\n+\t\treturn val.get<T>();\n \t}\n \n \ttemplate<typename T, typename V>\n","prefixes":["libcamera-devel","v2"]}