From 1268751ce6d170dc1aa968f1314c0bb5852b1b8e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 7 Mar 2020 22:20:45 +0200 Subject: v4l2: v4l2_camera_proxy: Fix sign compare compilation error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When compiling for ARM and uClibc, gcc-8.3.0 complains about comparison of integer expressions of different signedness: ../../src/v4l2/v4l2_camera_proxy.cpp: In member function ‘void* V4L2CameraProxy::mmap(void*, size_t, int, int, off_t)’: ../../src/v4l2/v4l2_camera_proxy.cpp:88:25: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘off_t’ {aka ‘long int’} [-Werror=sign-compare] if (index * sizeimage_ != offset || length != sizeimage_) { ~~~~~~~~~~~~~~~~~~~^~~~~~~~~ Fix the compilation error with a cast. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/v4l2/v4l2_camera_proxy.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/v4l2/v4l2_camera_proxy.cpp') diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 62252047..b620f236 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -85,7 +85,8 @@ void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags, } unsigned int index = offset / sizeimage_; - if (index * sizeimage_ != offset || length != sizeimage_) { + if (static_cast(index * sizeimage_) != offset || + length != sizeimage_) { errno = EINVAL; return MAP_FAILED; } -- cgit v1.2.1