From 2f1c89140e6719651b06fffffaeb047f02b5a124 Mon Sep 17 00:00:00 2001 From: Naveen Saini Date: Wed, 18 May 2022 17:46:15 +0800 Subject: libxcam: fix narrowing warning due to GCC12 Patch submitted to use uint32_t instead of int for IOCTLs commands. Warning log: | ../../../git/xcore/fake_v4l2_device.h: In member function 'virtual int XCam::FakeV4l2Device::io_control(int, void*)': | ../../../git/xcore/fake_v4l2_device.h:42:14: error: narrowing conversion of '3225441794' from 'long unsigned int' to 'int' [-Wnarrowing] | 42 | case VIDIOC_ENUM_FMT: | | ^~~~~~~~~~~~~~~ | make[4]: *** [Makefile:685: libgstxcamsrc_la-gstxcamsrc.lo] Error 1 Signed-off-by: Naveen Saini Signed-off-by: Anuj Mittal --- ...-fake_v4l2_device.h-fix-narrowing-warning.patch | 94 ++++++++++++++++++++++ recipes-core/libxcam/libxcam_1.5.0.bb | 1 + 2 files changed, 95 insertions(+) create mode 100644 recipes-core/libxcam/libxcam/0001-fake_v4l2_device.h-fix-narrowing-warning.patch diff --git a/recipes-core/libxcam/libxcam/0001-fake_v4l2_device.h-fix-narrowing-warning.patch b/recipes-core/libxcam/libxcam/0001-fake_v4l2_device.h-fix-narrowing-warning.patch new file mode 100644 index 00000000..f15d5cc7 --- /dev/null +++ b/recipes-core/libxcam/libxcam/0001-fake_v4l2_device.h-fix-narrowing-warning.patch @@ -0,0 +1,94 @@ +From d4c97b50b577ea16b9ff6d9a352ab474a119310e Mon Sep 17 00:00:00 2001 +From: Naveen Saini +Date: Wed, 18 May 2022 15:41:24 +0800 +Subject: [PATCH] fake_v4l2_device.h: fix narrowing warning + +Use uint32_t instead of int for IOCTLs commands. + +Warning log: +| ../../../git/xcore/fake_v4l2_device.h: In member function 'virtual int XCam::FakeV4l2Device::io_control(int, void*)': +| ../../../git/xcore/fake_v4l2_device.h:42:14: error: narrowing conversion of '3225441794' from 'long unsigned int' to 'int' [-Wnarrowing] +| 42 | case VIDIOC_ENUM_FMT: +| | ^~~~~~~~~~~~~~~ +| make[4]: *** [Makefile:685: libgstxcamsrc_la-gstxcamsrc.lo] Error 1 + +Issue: https://github.com/intel/libxcam/issues/801 +Upstream-Status: Submitted [https://github.com/intel/libxcam/pull/802] + +Signed-off-by: Naveen Saini +--- + xcore/base/xcam_common.h | 2 +- + xcore/fake_v4l2_device.h | 2 +- + xcore/v4l2_device.cpp | 2 +- + xcore/v4l2_device.h | 2 +- + xcore/xcam_common.cpp | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/xcore/base/xcam_common.h b/xcore/base/xcam_common.h +index 1f16e1e..4aa6cb9 100644 +--- a/xcore/base/xcam_common.h ++++ b/xcore/base/xcam_common.h +@@ -75,7 +75,7 @@ void xcam_free (void *ptr); + * return, 0 successfully + * else, check errno + */ +-int xcam_device_ioctl (int fd, int cmd, void *arg); ++int xcam_device_ioctl (int fd, uint32_t cmd, void *arg); + const char *xcam_fourcc_to_string (uint32_t fourcc); + + void xcam_set_log (const char* file_name); +diff --git a/xcore/fake_v4l2_device.h b/xcore/fake_v4l2_device.h +index f679c19..e29787d 100644 +--- a/xcore/fake_v4l2_device.h ++++ b/xcore/fake_v4l2_device.h +@@ -33,7 +33,7 @@ public: + : V4l2Device ("/dev/null") + {} + +- int io_control (int cmd, void *arg) ++ int io_control (uint32_t cmd, void *arg) + { + XCAM_UNUSED (arg); + +diff --git a/xcore/v4l2_device.cpp b/xcore/v4l2_device.cpp +index 395461e..66a8ac6 100644 +--- a/xcore/v4l2_device.cpp ++++ b/xcore/v4l2_device.cpp +@@ -185,7 +185,7 @@ V4l2Device::close () + } + + int +-V4l2Device::io_control (int cmd, void *arg) ++V4l2Device::io_control (uint32_t cmd, void *arg) + + { + if (_fd <= 0) +diff --git a/xcore/v4l2_device.h b/xcore/v4l2_device.h +index b4ad7ad..2551a92 100644 +--- a/xcore/v4l2_device.h ++++ b/xcore/v4l2_device.h +@@ -104,7 +104,7 @@ public: + XCamReturn queue_buffer (SmartPtr &buf); + + // use as less as possible +- virtual int io_control (int cmd, void *arg); ++ virtual int io_control (uint32_t cmd, void *arg); + + protected: + +diff --git a/xcore/xcam_common.cpp b/xcore/xcam_common.cpp +index 848884d..d4d5093 100644 +--- a/xcore/xcam_common.cpp ++++ b/xcore/xcam_common.cpp +@@ -53,7 +53,7 @@ void xcam_free(void *ptr) + free (ptr); + } + +-int xcam_device_ioctl (int fd, int cmd, void *arg) ++int xcam_device_ioctl (int fd, uint32_t cmd, void *arg) + { + int ret = 0; + int tried_time = 0; +-- +2.25.1 + diff --git a/recipes-core/libxcam/libxcam_1.5.0.bb b/recipes-core/libxcam/libxcam_1.5.0.bb index 2008168c..31e9344b 100644 --- a/recipes-core/libxcam/libxcam_1.5.0.bb +++ b/recipes-core/libxcam/libxcam_1.5.0.bb @@ -9,6 +9,7 @@ inherit autotools pkgconfig S = "${WORKDIR}/git" SRCREV = "231a1d5243cd45c7a6b511b667f1ec52178fdda8" SRC_URI = "git://github.com/intel/libxcam.git;branch=1.5.0;protocol=https \ + file://0001-fake_v4l2_device.h-fix-narrowing-warning.patch \ " COMPATIBLE_HOST:libc-musl = "null" -- cgit v1.2.3-54-g00ecf