Show a patch.

GET /api/patches/15174/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 15174,
    "url": "https://patchwork.libcamera.org/api/patches/15174/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15174/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20211220232629.1485890-4-paul.elder@ideasonboard.com>",
    "date": "2021-12-20T23:26:26",
    "name": "[libcamera-devel,v2,3/6] android: camera_metadata: Add appendEntry helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "02d0d9cee3a0e8b20e5315cef132fced09330117",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15174/mbox/",
    "series": [
        {
            "id": 2848,
            "url": "https://patchwork.libcamera.org/api/series/2848/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2848",
            "date": "2021-12-20T23:26:23",
            "name": "android: Miscellaneous fixes",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2848/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15174/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15174/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 9AF7ABE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Dec 2021 23:26:51 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 53BAF608E7;\n\tTue, 21 Dec 2021 00:26:51 +0100 (CET)",
            "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 89482608F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Dec 2021 00:26:47 +0100 (CET)",
            "from pyrite.mediacom.info (unknown\n\t[IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7640EFD7;\n\tTue, 21 Dec 2021 00:26:46 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZwI9Bu0g\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640042807;\n\tbh=EWvzbnAHQgmUJOa2+xZog7a/Z1C7NG0LPoqsKdrDNVA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZwI9Bu0gJyNaVDn6AeSOq+Itprzb3o/5ZBReXwF44vonsu41c9v1FTdcuYP9s3t6Z\n\tnKZt6FBRNXisWjnhX4i8+9f+dweJfp/kkCZ3nAg31Rve49gk9dUHicymkqWymaWkFV\n\ti/YJfdEKnNKl+sr0t/EAhrdawphi6sPgOkhPjHW8=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 20 Dec 2021 17:26:26 -0600",
        "Message-Id": "<20211220232629.1485890-4-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20211220232629.1485890-1-paul.elder@ideasonboard.com>",
        "References": "<20211220232629.1485890-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 3/6] android: camera_metadata: Add\n\tappendEntry helper",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add appendEntry() helper, that automatically detects if updateEntry() or\naddEntry() should be used.\n\nNote that updateEntry() will fail if the entry was not yet added, and\naddEntry() will fail is the entry was already added. They are silent\nfailures that cause unexpected values to find their way into the android\nmetadata instance.\n\nPreviously this helper was not necessary, as (with respect to the\ncurrent use case) the preview template generator would always add a key\nso the other template generators that used the preview template as\nboilerplate could reliably use updateEntry(). The preview template\ngenerator will soon decide based on capabilities whether or not to add\nkeys, so the other template generators need a helper to decide whether\nto use updateEntry() or addEntry().\n\nFor now only implement it for enums and arithmetic values, as they will\nmainly be used in populating templates.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nChanges in v2:\n- expand on correctness of updateEntry() vs addEntry(), and the\n  rationale for the patch\n---\n src/android/camera_metadata.h | 11 +++++++++++\n 1 file changed, 11 insertions(+)",
    "diff": "diff --git a/src/android/camera_metadata.h b/src/android/camera_metadata.h\nindex e70f60af..f3b7c91e 100644\n--- a/src/android/camera_metadata.h\n+++ b/src/android/camera_metadata.h\n@@ -33,6 +33,17 @@ public:\n \n \tbool hasEntry(uint32_t tag) const;\n \n+\ttemplate<typename T,\n+\t\t std::enable_if_t<std::is_arithmetic_v<T> ||\n+\t\t\t\t  std::is_enum_v<T>> * = nullptr>\n+\tbool appendEntry(uint32_t tag, const T &data)\n+\t{\n+\t\tif (hasEntry(tag))\n+\t\t\treturn updateEntry(tag, &data, 1, sizeof(T));\n+\t\telse\n+\t\t\treturn addEntry(tag, &data, 1, sizeof(T));\n+\t}\n+\n \ttemplate<typename T,\n \t\t std::enable_if_t<std::is_arithmetic_v<T> ||\n \t\t\t\t  std::is_enum_v<T>> * = nullptr>\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "3/6"
    ]
}