From 5cfbbcd20731a2160206cc1d935eac2c770376ae Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 12 Dec 2020 01:21:01 +0200 Subject: 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 Reviewed-by: Paul Elder Reviewed-by: Umang Jain Reviewed-by: Jacopo Mondi --- src/libcamera/v4l2_videodevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libcamera/v4l2_videodevice.cpp') 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 #include #include #include @@ -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 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); -- cgit v1.2.1