From patchwork Wed Oct 21 15:41:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10182 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 91B5FBDB13 for ; Wed, 21 Oct 2020 15:42:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5F42F60C14; Wed, 21 Oct 2020 17:42:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AywV46Nx"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1818C60C1F for ; Wed, 21 Oct 2020 17:41:55 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9A8BE116B; Wed, 21 Oct 2020 17:41:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294914; bh=MmZ0POr1xbH6Ysj0uiTsVJ6/gVUAoF5QgOzzZzFzOVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AywV46NxOOU8yUXe98brh3LhQ8IvQljU28nshx0EG7zUrPcb5W0lbiSeX9ze+49XA 2M+Cz8117iQs4EuKxidYzl49Y+2uKw5fl1dhpfl9cbvKOYRtyCbQV5e6k18G7IY/0m MStCK2ElI93VPxMZ/qT31xQRmfm7lvxOmdnjO1dM= From: Kieran Bingham To: libcamera devel 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: Prevent shadowing of V4L2BufferCache members X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The members free, and lastUsed were not following the libcamera coding style, and were producing a shadowed parameter on the construction. Rename them to be marked as member variables with the _ postfix accordingly. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/internal/v4l2_videodevice.h | 4 ++-- src/libcamera/v4l2_videodevice.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index 40ed87e17cfa..53f6a2d5515b 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -127,8 +127,8 @@ private: bool operator==(const FrameBuffer &buffer) const; - bool free; - uint64_t lastUsed; + bool free_; + uint64_t lastUsed_; private: struct Plane { diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 16162e1edba3..36d7d9a0f27a 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -213,7 +213,7 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) for (unsigned int index = 0; index < cache_.size(); index++) { const Entry &entry = cache_[index]; - if (!entry.free) + if (!entry.free_) continue; /* Try to find a cache hit by comparing the planes. */ @@ -223,9 +223,9 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) break; } - if (entry.lastUsed < oldest) { + if (entry.lastUsed_ < oldest) { use = index; - oldest = entry.lastUsed; + oldest = entry.lastUsed_; } } @@ -249,16 +249,16 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) void V4L2BufferCache::put(unsigned int index) { ASSERT(index < cache_.size()); - cache_[index].free = true; + cache_[index].free_ = true; } V4L2BufferCache::Entry::Entry() - : free(true), lastUsed(0) + : free_(true), lastUsed_(0) { } V4L2BufferCache::Entry::Entry(bool free, uint64_t lastUsed, const FrameBuffer &buffer) - : free(free), lastUsed(lastUsed) + : free_(free), lastUsed_(lastUsed) { for (const FrameBuffer::Plane &plane : buffer.planes()) planes_.emplace_back(plane);