diff options
author | Hubert Wiśniewski <hubert.wisniewski.25632@gmail.com> | 2024-08-01 09:03:46 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-08-10 15:57:57 -0700 |
commit | 4642c541c4f4f368941ce3956ad47c787bfb2a35 (patch) | |
tree | bcbf5c903042077564673e593e3f60a9621160dc | |
parent | 195d6196c69091b2962dcaf02099e4f48828d4ad (diff) | |
download | meta-openembedded-4642c541c4f4f368941ce3956ad47c787bfb2a35.tar.gz |
libcamera: Use multiple of sizeof as malloc size
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-malloc-instead-of-variable-length-arrays.patch (renamed from meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch) | 12 | ||||
-rw-r--r-- | meta-multimedia/recipes-multimedia/libcamera/libcamera_0.3.0.bb | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-malloc-instead-of-variable-length-arrays.patch index c336e92548..0ca2082c03 100644 --- a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch +++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-malloc-instead-of-variable-length-arrays.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 11cc6dbd45f0880beea64cdc514f57484b90bc39 Mon Sep 17 00:00:00 2001 | 1 | From a3e25b6aa9775c43336e30d3b350f54c085a32c8 Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Tue, 20 Feb 2024 18:44:23 -0800 | 3 | Date: Tue, 20 Feb 2024 18:44:23 -0800 |
4 | Subject: [PATCH] rpi: Use malloc instead of variable length arrays | 4 | Subject: [PATCH] rpi: Use malloc instead of variable length arrays |
@@ -8,16 +8,14 @@ Clang-18+ diagnoses this as error | |||
8 | | ../git/src/ipa/rpi/controller/rpi/alsc.cpp:499:10: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] | 499 | int xLo[X], xHi[X]; | 8 | | ../git/src/ipa/rpi/controller/rpi/alsc.cpp:499:10: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] | 499 | int xLo[X], xHi[X]; |
9 | | | ^ | 9 | | | ^ |
10 | 10 | ||
11 | Upstream-Status: Submitted [https://lists.libcamera.org/pipermail/libcamera-devel/2024-February/040529.html] | 11 | Upstream-Status: Denied [https://lists.libcamera.org/pipermail/libcamera-devel/2024-February/040536.html] |
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
13 | |||
14 | s | ||
15 | --- | 13 | --- |
16 | src/ipa/rpi/controller/rpi/alsc.cpp | 7 +++++-- | 14 | src/ipa/rpi/controller/rpi/alsc.cpp | 7 +++++-- |
17 | 1 file changed, 5 insertions(+), 2 deletions(-) | 15 | 1 file changed, 5 insertions(+), 2 deletions(-) |
18 | 16 | ||
19 | diff --git a/src/ipa/rpi/controller/rpi/alsc.cpp b/src/ipa/rpi/controller/rpi/alsc.cpp | 17 | diff --git a/src/ipa/rpi/controller/rpi/alsc.cpp b/src/ipa/rpi/controller/rpi/alsc.cpp |
20 | index 8a205c60..a7d42614 100644 | 18 | index 67029fc3..6eca9fb7 100644 |
21 | --- a/src/ipa/rpi/controller/rpi/alsc.cpp | 19 | --- a/src/ipa/rpi/controller/rpi/alsc.cpp |
22 | +++ b/src/ipa/rpi/controller/rpi/alsc.cpp | 20 | +++ b/src/ipa/rpi/controller/rpi/alsc.cpp |
23 | @@ -496,8 +496,8 @@ void resampleCalTable(const Array2D<double> &calTableIn, | 21 | @@ -496,8 +496,8 @@ void resampleCalTable(const Array2D<double> &calTableIn, |
@@ -26,8 +24,8 @@ index 8a205c60..a7d42614 100644 | |||
26 | */ | 24 | */ |
27 | - int xLo[X], xHi[X]; | 25 | - int xLo[X], xHi[X]; |
28 | - double xf[X]; | 26 | - double xf[X]; |
29 | + int *xLo = (int*)malloc(X), *xHi = (int*)malloc(X); | 27 | + int *xLo = (int *)malloc(X * sizeof(int)), *xHi = (int *)malloc(X * sizeof(int)); |
30 | + double *xf = (double*)malloc(X); | 28 | + double *xf = (double *)malloc(X * sizeof(double)); |
31 | double scaleX = cameraMode.sensorWidth / | 29 | double scaleX = cameraMode.sensorWidth / |
32 | (cameraMode.width * cameraMode.scaleX); | 30 | (cameraMode.width * cameraMode.scaleX); |
33 | double xOff = cameraMode.cropX / (double)cameraMode.sensorWidth; | 31 | double xOff = cameraMode.cropX / (double)cameraMode.sensorWidth; |
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.3.0.bb b/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.3.0.bb index 66433ec155..857f565fb7 100644 --- a/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.3.0.bb +++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.3.0.bb | |||
@@ -12,7 +12,7 @@ SRC_URI = " \ | |||
12 | git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master \ | 12 | git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master \ |
13 | file://0001-media_device-Add-bool-return-type-to-unlock.patch \ | 13 | file://0001-media_device-Add-bool-return-type-to-unlock.patch \ |
14 | file://0002-options-Replace-use-of-VLAs-in-C.patch \ | 14 | file://0002-options-Replace-use-of-VLAs-in-C.patch \ |
15 | file://0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch \ | 15 | file://0001-rpi-Use-malloc-instead-of-variable-length-arrays.patch \ |
16 | " | 16 | " |
17 | 17 | ||
18 | SRCREV = "aee16c06913422a0ac84ee3217f87a9795e3c2d9" | 18 | SRCREV = "aee16c06913422a0ac84ee3217f87a9795e3c2d9" |