From patchwork Mon Sep 6 02:00:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13627 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 BF437BD87D for ; Mon, 6 Sep 2021 02:09:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EE2DF69188; Mon, 6 Sep 2021 04:01:40 +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="MrGny06/"; 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 EDC8069173 for ; Mon, 6 Sep 2021 04:01:26 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7A54F317; Mon, 6 Sep 2021 04:01:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630893686; bh=LjAFG557AsMFuQqRp6gQiNAC/v5bRxRLiV3zQyayPoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MrGny06/Blaq8MNMsMVTHv6WiZeqInaWFlvENlfiUvXgB0zK0dxcH+XL7Nxlq9pk3 4eYq258hvJEYcw3c2nZA+X+zu/mI9o6sBGQZT9y9dhHzpVN1o9apZ0SkivkPjgHcqj z7KHyYrO55uYeQcMMgB8UW3kaI1eVGEJNGhpkZ9s= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 6 Sep 2021 05:00:48 +0300 Message-Id: <20210906020100.14430-16-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210906020100.14430-1-laurent.pinchart@ideasonboard.com> References: <20210906020100.14430-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 15/27] libcamera: v4l2_videodevice: Use utils::enumerate() 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" Replace a manual counter with the utils::enumerate() utility function. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Hirokazu Honda --- src/libcamera/v4l2_videodevice.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 0a7fbdb7e011..59aa53c7c27e 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1356,7 +1356,7 @@ std::unique_ptr V4L2VideoDevice::createBuffer(unsigned int index) const FileDescriptor &fd = planes[0].fd; size_t offset = 0; - for (size_t i = 0; i < planes.size(); ++i) { + for (auto [i, plane] : utils::enumerate(planes)) { /* * The stride is reported by V4L2 for the first plane * only. Compute the stride of the other planes by @@ -1368,11 +1368,11 @@ std::unique_ptr V4L2VideoDevice::createBuffer(unsigned int index) * formatInfo_->planes[i].bytesPerGroup / formatInfo_->planes[0].bytesPerGroup; - planes[i].fd = fd; - planes[i].offset = offset; - planes[i].length = formatInfo_->planeSize(format_.size.height, - i, stride); - offset += planes[i].length; + plane.fd = fd; + plane.offset = offset; + plane.length = formatInfo_->planeSize(format_.size.height, + i, stride); + offset += plane.length; } }