Show a patch.

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

{
    "id": 9965,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/9965/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9965/",
    "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": "<20201006054459.19742-1-email@uajain.com>",
    "date": "2020-10-06T05:44:59",
    "name": "[libcamera-devel,v3] android: jpeg: exif: Sanitize ASCII strings with utils::toAscii()",
    "commit_ref": "6feebf297ead7b13495d01d9dffb5a09aab82af9",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "70749e7ed60d06e185d55872e78412dd1204aa3c",
    "submitter": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/people/1/?format=api",
        "name": "Umang Jain",
        "email": "email@uajain.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/9965/mbox/",
    "series": [
        {
            "id": 1352,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1352/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1352",
            "date": "2020-10-06T05:44:59",
            "name": "[libcamera-devel,v3] android: jpeg: exif: Sanitize ASCII strings with utils::toAscii()",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1352/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9965/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9965/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 B9783C3B5D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Oct 2020 05:45:08 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 40FCC63B27;\n\tTue,  6 Oct 2020 07:45:08 +0200 (CEST)",
            "from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8773A60358\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Oct 2020 07:45:05 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"OjO7sjqL\"; dkim-atps=neutral",
        "From": "Umang Jain <email@uajain.com>",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1601963104; bh=OGyM51V1KvPCJ9N+RUFBNlmSeJBTy26osGdrXT+YqxQ=;\n\th=From:To:Cc:Subject;\n\tb=OjO7sjqL/Mnk3xkUbM6YbfreX50EsysWstwpcy4pU0PHqnAxU8GbcyWkTQAnvjQIc\n\tsYDW14v8KS/HWnHFItRjAyXYVpaMEm8xwUG3w26mE5ZuVOR32Q/WJWUf9khZRSyWIT\n\tGYTFutF7LrENydXj3fSJWm+yq07K5w8whkmVgJAGOpdSNEET2Kem3LdeQw8OJiKJ56\n\tmWufSnRcgNJEXcHLnnU1ptZBZHbVdWDT8MYCWG8YGQO0R9eAiRQ3VN60bh0sB1lWHT\n\tFgkuQrbmyJ0seSRhJ5ulB6KXvZamoCYodHyHau5LYD28ScHkhYiipkuSzdq+uqQJHN\n\t1df39WHDw3cFA==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  6 Oct 2020 11:14:59 +0530",
        "Message-Id": "<20201006054459.19742-1-email@uajain.com>",
        "Mime-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3] android: jpeg: exif: Sanitize ASCII\n\tstrings with utils::toAscii()",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Use the newly introduced utils::toAscii() utility to remove all\nnon-ASCII characters for EXIF_FORMAT_ASCII strings.\n\nSigned-off-by: Umang Jain <email@uajain.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/android/jpeg/exif.cpp | 25 +++++++++++++++++++++----\n 1 file changed, 21 insertions(+), 4 deletions(-)\n\n---\nChanges in v3:\n- Carry out small optimizing suggested by Laurent.\n\nChanges in v2:\n- Set new length for sanitized string.\n---",
    "diff": "diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp\nindex 3fd5d55..e4a116d 100644\n--- a/src/android/jpeg/exif.cpp\n+++ b/src/android/jpeg/exif.cpp\n@@ -8,6 +8,7 @@\n #include \"exif.h\"\n \n #include \"libcamera/internal/log.h\"\n+#include \"libcamera/internal/utils.h\"\n \n using namespace libcamera;\n \n@@ -171,15 +172,31 @@ void Exif::setRational(ExifIfd ifd, ExifTag tag, ExifRational item)\n \n void Exif::setString(ExifIfd ifd, ExifTag tag, ExifFormat format, const std::string &item)\n {\n-\t/* Pad 1 extra byte for null-terminated string in ASCII format. */\n-\tsize_t length = format == EXIF_FORMAT_ASCII ?\n-\t\t\titem.length() + 1 : item.length();\n+\tstd::string ascii;\n+\tsize_t length;\n+\tconst char *str;\n+\n+\tif (format == EXIF_FORMAT_ASCII) {\n+\t\tascii = utils::toAscii(item);\n+\t\tstr = ascii.c_str();\n+\n+\t\t/* Pad 1 extra byte to null-terminate the ASCII string. */\n+\t\tlength = ascii.length() + 1;\n+\t} else {\n+\t\tstr = item.c_str();\n+\n+\t\t/*\n+\t\t * Strings stored in different formats (EXIF_FORMAT_UNDEFINED)\n+\t\t * are not null-terminated.\n+\t\t */\n+\t\tlength = item.length();\n+\t}\n \n \tExifEntry *entry = createEntry(ifd, tag, format, length, length);\n \tif (!entry)\n \t\treturn;\n \n-\tmemcpy(entry->data, item.c_str(), length);\n+\tmemcpy(entry->data, str, length);\n \texif_entry_unref(entry);\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3"
    ]
}