{"id":10182,"url":"https://patchwork.libcamera.org/api/patches/10182/?format=json","web_url":"https://patchwork.libcamera.org/patch/10182/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201021154148.511505-6-kieran.bingham@ideasonboard.com>","date":"2020-10-21T15:41:38","name":"[libcamera-devel,v4,05/15] libcamera: v4l2_videodevice: Prevent shadowing of V4L2BufferCache members","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"8562d19da483749de7abb22fdb927c8d180975fe","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10182/mbox/","series":[{"id":1401,"url":"https://patchwork.libcamera.org/api/series/1401/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1401","date":"2020-10-21T15:41:33","name":"Shadowed Variables","version":4,"mbox":"https://patchwork.libcamera.org/series/1401/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10182/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10182/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 91B5FBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Oct 2020 15:42:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5F42F60C14;\n\tWed, 21 Oct 2020 17:42:00 +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 1818C60C1F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Oct 2020 17:41:55 +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 9A8BE116B;\n\tWed, 21 Oct 2020 17:41:54 +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=\"AywV46Nx\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603294914;\n\tbh=MmZ0POr1xbH6Ysj0uiTsVJ6/gVUAoF5QgOzzZzFzOVE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=AywV46NxOOU8yUXe98brh3LhQ8IvQljU28nshx0EG7zUrPcb5W0lbiSeX9ze+49XA\n\t2M+Cz8117iQs4EuKxidYzl49Y+2uKw5fl1dhpfl9cbvKOYRtyCbQV5e6k18G7IY/0m\n\tMStCK2ElI93VPxMZ/qT31xQRmfm7lvxOmdnjO1dM=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Wed, 21 Oct 2020 16:41:38 +0100","Message-Id":"<20201021154148.511505-6-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20201021154148.511505-1-kieran.bingham@ideasonboard.com>","References":"<20201021154148.511505-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 05/15] libcamera: v4l2_videodevice:\n\tPrevent shadowing of V4L2BufferCache members","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":"The members free, and lastUsed were not following the libcamera coding\nstyle, and were producing a shadowed parameter on the construction.\n\nRename them to be marked as member variables with the _ postfix\naccordingly.\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 include/libcamera/internal/v4l2_videodevice.h |  4 ++--\n src/libcamera/v4l2_videodevice.cpp            | 12 ++++++------\n 2 files changed, 8 insertions(+), 8 deletions(-)","diff":"diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex 40ed87e17cfa..53f6a2d5515b 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -127,8 +127,8 @@ private:\n \n \t\tbool operator==(const FrameBuffer &buffer) const;\n \n-\t\tbool free;\n-\t\tuint64_t lastUsed;\n+\t\tbool free_;\n+\t\tuint64_t lastUsed_;\n \n \tprivate:\n \t\tstruct Plane {\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 16162e1edba3..36d7d9a0f27a 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -213,7 +213,7 @@ int V4L2BufferCache::get(const FrameBuffer &buffer)\n \tfor (unsigned int index = 0; index < cache_.size(); index++) {\n \t\tconst Entry &entry = cache_[index];\n \n-\t\tif (!entry.free)\n+\t\tif (!entry.free_)\n \t\t\tcontinue;\n \n \t\t/* Try to find a cache hit by comparing the planes. */\n@@ -223,9 +223,9 @@ int V4L2BufferCache::get(const FrameBuffer &buffer)\n \t\t\tbreak;\n \t\t}\n \n-\t\tif (entry.lastUsed < oldest) {\n+\t\tif (entry.lastUsed_ < oldest) {\n \t\t\tuse = index;\n-\t\t\toldest = entry.lastUsed;\n+\t\t\toldest = entry.lastUsed_;\n \t\t}\n \t}\n \n@@ -249,16 +249,16 @@ int V4L2BufferCache::get(const FrameBuffer &buffer)\n void V4L2BufferCache::put(unsigned int index)\n {\n \tASSERT(index < cache_.size());\n-\tcache_[index].free = true;\n+\tcache_[index].free_ = true;\n }\n \n V4L2BufferCache::Entry::Entry()\n-\t: free(true), lastUsed(0)\n+\t: free_(true), lastUsed_(0)\n {\n }\n \n V4L2BufferCache::Entry::Entry(bool free, uint64_t lastUsed, const FrameBuffer &buffer)\n-\t: free(free), lastUsed(lastUsed)\n+\t: free_(free), lastUsed_(lastUsed)\n {\n \tfor (const FrameBuffer::Plane &plane : buffer.planes())\n \t\tplanes_.emplace_back(plane);\n","prefixes":["libcamera-devel","v4","05/15"]}