Patch Detail
Show a patch.
GET /api/1.1/patches/10065/?format=api
{ "id": 10065, "url": "https://patchwork.libcamera.org/api/1.1/patches/10065/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10065/", "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": "<20201015223750.58563-5-kieran.bingham@ideasonboard.com>", "date": "2020-10-15T22:37:43", "name": "[libcamera-devel,v2,04/11] libcamera: pipeline: Prevent variable aliasing", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "fad5952eaabcde1c00d349a7ae6a8a4d9ed881d1", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/10065/mbox/", "series": [ { "id": 1376, "url": "https://patchwork.libcamera.org/api/1.1/series/1376/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1376", "date": "2020-10-15T22:37:39", "name": "Shadowed Variables", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1376/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10065/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10065/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 F34C8BE905\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Oct 2020 22:38:01 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB9C161081;\n\tFri, 16 Oct 2020 00:38:01 +0200 (CEST)", "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 013A5600F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Oct 2020 00:37:57 +0200 (CEST)", "from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 73F97556;\n\tFri, 16 Oct 2020 00:37:56 +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=\"svO6i5sS\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1602801476;\n\tbh=wIJFz3lU2EcDsfiDCs9X7jcZxFOFw2p6V9Oq6cxFFU0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=svO6i5sSw9bfXP3ZJA4OqKNNK9L5F4fECoRDLabn9V/vZ8s5fsfabNIPnmggreIcb\n\tOSa+SctH4afKImfjxOteyCAJQuTuodr6/EoJ1tfGS5Ua0aNZie1aIXpnSJ+MP3mink\n\tv8bocfN6UlMZ5TYji6Q9kWRLDG4N4GbtqwvMycqY=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Thu, 15 Oct 2020 23:37:43 +0100", "Message-Id": "<20201015223750.58563-5-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20201015223750.58563-1-kieran.bingham@ideasonboard.com>", "References": "<20201015223750.58563-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 04/11] libcamera: pipeline: Prevent\n\tvariable aliasing", "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=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Remove variable aliasing within the pipeline handler implementations.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 6 +++---\n src/libcamera/pipeline/simple/converter.cpp | 8 ++++----\n src/libcamera/pipeline/simple/simple.cpp | 4 ++--\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 ++--\n 4 files changed, 11 insertions(+), 11 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 26dbd2573e04..85e0a1f26ab6 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -512,9 +512,9 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \t\t/* Translate the V4L2PixelFormat to PixelFormat. */\n \t\tstd::map<PixelFormat, std::vector<SizeRange>> deviceFormats;\n \t\tfor (const auto &format : fmts) {\n-\t\t\tPixelFormat pixelFormat = format.first.toPixelFormat();\n-\t\t\tif (pixelFormat.isValid())\n-\t\t\t\tdeviceFormats[pixelFormat] = format.second;\n+\t\t\tPixelFormat pf = format.first.toPixelFormat();\n+\t\t\tif (pf.isValid())\n+\t\t\t\tdeviceFormats[pf] = format.second;\n \t\t}\n \n \t\t/* Add the stream format based on the device node used for the use case. */\ndiff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp\nindex 75fb297ebd58..2b541cd2bb3f 100644\n--- a/src/libcamera/pipeline/simple/converter.cpp\n+++ b/src/libcamera/pipeline/simple/converter.cpp\n@@ -72,11 +72,11 @@ std::vector<PixelFormat> SimpleConverter::formats(PixelFormat input)\n \t * Set the format on the input side (V4L2 output) of the converter to\n \t * enumerate the conversion capabilities on its output (V4L2 capture).\n \t */\n-\tV4L2DeviceFormat format;\n-\tformat.fourcc = m2m_->output()->toV4L2PixelFormat(input);\n-\tformat.size = { 1, 1 };\n+\tV4L2DeviceFormat v4l2Format;\n+\tv4l2Format.fourcc = m2m_->output()->toV4L2PixelFormat(input);\n+\tv4l2Format.size = { 1, 1 };\n \n-\tint ret = m2m_->output()->setFormat(&format);\n+\tint ret = m2m_->output()->setFormat(&v4l2Format);\n \tif (ret < 0) {\n \t\tLOG(SimplePipeline, Error)\n \t\t\t<< \"Failed to set format: \" << strerror(-ret);\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 7adb17e2d1db..999c44515023 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -314,8 +314,8 @@ int SimpleCameraData::init()\n \n \t\t\tconfig.outputSizes = converter->sizes(format.size);\n \n-\t\t\tfor (PixelFormat format : converter->formats(pixelFormat))\n-\t\t\t\tformats_[format] = config;\n+\t\t\tfor (PixelFormat fmt : converter->formats(pixelFormat))\n+\t\t\t\tformats_[fmt] = config;\n \t\t}\n \t}\n \ndiff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 8ec0dac1e689..54ba1b87bb3e 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -490,8 +490,8 @@ int UVCCameraData::init(MediaDevice *media)\n \t/* Locate and initialise the camera data with the default video node. */\n \tconst std::vector<MediaEntity *> &entities = media->entities();\n \tauto entity = std::find_if(entities.begin(), entities.end(),\n-\t\t\t\t [](MediaEntity *entity) {\n-\t\t\t\t\t return entity->flags() & MEDIA_ENT_FL_DEFAULT;\n+\t\t\t\t [](MediaEntity *e) {\n+\t\t\t\t\t return e->flags() & MEDIA_ENT_FL_DEFAULT;\n \t\t\t\t });\n \tif (entity == entities.end()) {\n \t\tLOG(UVC, Error) << \"Could not find a default video device\";\n", "prefixes": [ "libcamera-devel", "v2", "04/11" ] }