Patch Detail
Show a patch.
GET /api/1.1/patches/16934/?format=api
{ "id": 16934, "url": "https://patchwork.libcamera.org/api/1.1/patches/16934/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16934/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220803110324.28539-1-jacopo@jmondi.org>", "date": "2022-08-03T11:03:24", "name": "[libcamera-devel] libcamera: yaml_parser: Return nullopt on error", "commit_ref": "2e77ccbb93a14a0c976bb3ca9d5dbbdc32a12847", "pull_url": null, "state": "accepted", "archived": false, "hash": "6d9752e4576a78ff09cc391bdf0e29ec03cfddb7", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16934/mbox/", "series": [ { "id": 3366, "url": "https://patchwork.libcamera.org/api/1.1/series/3366/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3366", "date": "2022-08-03T11:03:24", "name": "[libcamera-devel] libcamera: yaml_parser: Return nullopt on error", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3366/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16934/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16934/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 A35FCC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 3 Aug 2022 11:03:31 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6D34861FAE;\n\tWed, 3 Aug 2022 13:03:31 +0200 (CEST)", "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9203C603E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 3 Aug 2022 13:03:30 +0200 (CEST)", "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id E38661C0006;\n\tWed, 3 Aug 2022 11:03:29 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659524611;\n\tbh=7EfPKvlrGAAJUdW/QgxczMO0d7s0IMn5wzTLSuBwfAA=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=BhzKEYJ97kbYLkG6dr1Ug6VvLDZRN3kTS1/tfjgJUrdAqwZVDHRjEBEvLYkHqcNqa\n\tGTLatajoysyLaz1zh4WCVhkYpCKLUGfQMRHmoGMGnW7WfKhJ5xDeAzeLimWy1biS+/\n\tSMHI30CW6ahbQ4D7ZlJF8bOubGSUWDKcU0Wz6nHxAQvbNLGOg3R3FdggniQFnrYwBz\n\tWWS2pnwCVFbV+CmLvKx32jYWAW2wn8tjsFota+Vb6kTw4PlrSqyLD6q4wC+TqS9Zcn\n\t43HfZi0qHAHsan1iSnWVsbON9KmwzGmOilEpDZyvtr61vwcDh7JKyuHcWeYxMjJxpc\n\tELYPTN72H4GSg==", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 3 Aug 2022 13:03:24 +0200", "Message-Id": "<20220803110324.28539-1-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.37.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: yaml_parser: Return nullopt on\n\terror", "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": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The YamlParser::getList<>() function returns an std::optional<> to allow\ncallers to identify cases where parsing the .yaml file failed from cases\nwhere the parsed list is just empty.\n\nThe current implementation however returns an empty list in case of\nerrors, making it impossible for the caller to detect parsing failures.\n\nFix this by returning std::nullopt in case of errors.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/yaml_parser.cpp | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\nindex 84cb57d6de83..c96e99e1317c 100644\n--- a/src/libcamera/yaml_parser.cpp\n+++ b/src/libcamera/yaml_parser.cpp\n@@ -319,7 +319,7 @@ template<typename T,\n std::optional<std::vector<T>> YamlObject::getList() const\n {\n \tif (type_ != Type::List)\n-\t\treturn {};\n+\t\treturn std::nullopt;\n \n \tstd::vector<T> values;\n \tvalues.reserve(list_.size());\n@@ -327,7 +327,7 @@ std::optional<std::vector<T>> YamlObject::getList() const\n \tfor (const YamlObject &entry : asList()) {\n \t\tconst auto value = entry.get<T>();\n \t\tif (!value)\n-\t\t\treturn {};\n+\t\t\treturn std::nullopt;\n \t\tvalues.emplace_back(*value);\n \t}\n \n", "prefixes": [ "libcamera-devel" ] }