From 0f4d81c2bf40b1aba07dc5ef66aaa7484496eedf Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 1 Sep 2021 21:00:24 +0300 Subject: libcamera: v4l2_videodevice: Use utils::enumerate() 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(-) (limited to 'src') diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 2e458fcc..281f3f13 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; } } -- cgit v1.2.1