Show a patch.

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

{
    "id": 12715,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12715/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12715/",
    "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": "<20210625215558.32615-1-laurent.pinchart@ideasonboard.com>",
    "date": "2021-06-25T21:55:58",
    "name": "[libcamera-devel] libcamera: utils: Only enable utils::hex() for integer arguments",
    "commit_ref": "d3fef998444c21142fa12b9bf698a73ee5706fd6",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "1fb5015eb03cb24965c34bde08d4dd0030aeaaca",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12715/mbox/",
    "series": [
        {
            "id": 2178,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2178/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2178",
            "date": "2021-06-25T21:55:58",
            "name": "[libcamera-devel] libcamera: utils: Only enable utils::hex() for integer arguments",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2178/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12715/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12715/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 7CF57C321A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 25 Jun 2021 21:56:36 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B9FBD684CD;\n\tFri, 25 Jun 2021 23:56:35 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A6903684C9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jun 2021 23:56:33 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3BE074A1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jun 2021 23:56:33 +0200 (CEST)"
        ],
        "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=\"fjSHL7mT\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624658193;\n\tbh=jCAwN8tbKcjp5rdWfGzxTiTSNRX2vHsOP7rRzO1vjm8=;\n\th=From:To:Subject:Date:From;\n\tb=fjSHL7mTH/kBMoDtMBipMLB5bJpsn52l6oudC5coDB4NYMUrHYG2/PwWwyxVFVbqZ\n\t0h8s63eTgPMDfl7Pa7/zlZTcasraP47Vc8HEXnPiK9+NfRe2LJaB5pafcNJwOnlc3D\n\tgCkd8betGWSLpFs3hCoj2ewnLmdMRyzsgztqYl/M=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 26 Jun 2021 00:55:58 +0300",
        "Message-Id": "<20210625215558.32615-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] libcamera: utils: Only enable\n\tutils::hex() for integer arguments",
        "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": "The utils::hex() function is defined as a function template that has\nimplementations for integer arguments only. When given a different\nargument type, the compiler will not catch the issue, but linking will\nfail:\n\nsrc/libcamera/libcamera.so.p/camera_sensor.cpp.o: in function `libcamera::CameraSensor::validateSensorDriver()':\ncamera_sensor.cpp:(.text+0x1e6b): undefined reference to `libcamera::utils::_hex libcamera::utils::hex<libcamera::ControlId const*>(libcamera::ControlId const*, unsigned int)'\n\nMove the failure to compilation time by enabling the function for\ninteger arguments only. This provides better diagnostics:\n\n../../src/libcamera/camera_sensor.cpp: In member function ‘int libcamera::CameraSensor::validateSensorDriver()’:\n../../src/libcamera/camera_sensor.cpp:199:77: error: no matching function for call to ‘hex(const libcamera::ControlId*&)’\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/base/utils.h | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\nindex 07685045aa05..52301254c2eb 100644\n--- a/include/libcamera/base/utils.h\n+++ b/include/libcamera/base/utils.h\n@@ -16,6 +16,7 @@\n #include <string>\n #include <string.h>\n #include <sys/time.h>\n+#include <type_traits>\n #include <utility>\n #include <vector>\n \n@@ -84,7 +85,8 @@ std::basic_ostream<char, std::char_traits<char>> &\n operator<<(std::basic_ostream<char, std::char_traits<char>> &stream, const _hex &h);\n #endif\n \n-template<typename T>\n+template<typename T,\n+\t std::enable_if_t<std::is_integral<T>::value> * = nullptr>\n _hex hex(T value, unsigned int width = 0);\n \n #ifndef __DOXYGEN__\n",
    "prefixes": [
        "libcamera-devel"
    ]
}