summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_videodevice.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-12 01:21:01 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-14 15:35:24 +0200
commit5cfbbcd20731a2160206cc1d935eac2c770376ae (patch)
tree817f2ef9c3ce6aa7fb2ace65466498c8f880c60b /src/libcamera/v4l2_videodevice.cpp
parentbd4894d2596168b3435fb93b9e53dad84b2dcc7e (diff)
libcamera: Replace ARRAY_SIZE() with std::size()
C++17 has a std::size() function that returns the size of a C-style array. Use it instead of the custom ARRAY_SIZE macro. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <email@uajain.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/v4l2_videodevice.cpp')
-rw-r--r--src/libcamera/v4l2_videodevice.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index e2b58284..baf683d6 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -7,6 +7,7 @@
#include "libcamera/internal/v4l2_videodevice.h"
+#include <array>
#include <fcntl.h>
#include <iomanip>
#include <sstream>
@@ -26,7 +27,6 @@
#include "libcamera/internal/log.h"
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/media_object.h"
-#include "libcamera/internal/utils.h"
/**
* \file v4l2_videodevice.h
@@ -860,7 +860,7 @@ int V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)
pix->num_planes = format->planesCount;
pix->field = V4L2_FIELD_NONE;
- ASSERT(pix->num_planes <= ARRAY_SIZE(pix->plane_fmt));
+ ASSERT(pix->num_planes <= std::size(pix->plane_fmt));
for (unsigned int i = 0; i < pix->num_planes; ++i) {
pix->plane_fmt[i].bytesperline = format->planes[i].bpl;
@@ -1255,7 +1255,7 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
buf.index = index;
buf.type = bufferType_;
buf.memory = V4L2_MEMORY_MMAP;
- buf.length = ARRAY_SIZE(v4l2Planes);
+ buf.length = std::size(v4l2Planes);
buf.m.planes = v4l2Planes;
int ret = ioctl(VIDIOC_QUERYBUF, &buf);