summaryrefslogtreecommitdiff
path: root/extra/openjpeg
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-03 19:59:53 +0100
committerdavidovski <david@davidovski.xyz>2022-05-03 19:59:53 +0100
commit751b7f3d84515715d07d92a5aed78062bd39adff (patch)
tree9bfdc04a539250f35452cbd0986ca361dd91509f /extra/openjpeg
parent50740393013cb5fde05318d917ac4b68c58fdfa9 (diff)
added extra files
Diffstat (limited to 'extra/openjpeg')
-rw-r--r--extra/openjpeg/b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch77
-rw-r--r--extra/openjpeg/fix-cmakelists.patch11
2 files changed, 88 insertions, 0 deletions
diff --git a/extra/openjpeg/b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch b/extra/openjpeg/b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch
new file mode 100644
index 0000000..169e4ad
--- /dev/null
+++ b/extra/openjpeg/b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch
@@ -0,0 +1,77 @@
+From b4700bc09d55ac17ff6bef9b0a867f6de527be17 Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne@dereferenced.org>
+Date: Tue, 27 Apr 2021 09:37:40 -0600
+Subject: [PATCH] use calloc instead of malloc to allocate arrays
+
+---
+ src/bin/jp2/opj_compress.c | 4 ++--
+ src/bin/jp2/opj_decompress.c | 5 ++---
+ src/bin/jp2/opj_dump.c | 6 +++---
+ 3 files changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c
+index 4cc513452..d8f894cb1 100644
+--- a/src/bin/jp2/opj_compress.c
++++ b/src/bin/jp2/opj_compress.c
+@@ -1910,9 +1910,9 @@ int main(int argc, char **argv)
+ num_images = get_num_images(img_fol.imgdirpath);
+ dirptr = (dircnt_t*)malloc(sizeof(dircnt_t));
+ if (dirptr) {
+- dirptr->filename_buf = (char*)malloc(num_images * OPJ_PATH_LEN * sizeof(
++ dirptr->filename_buf = (char*)calloc(num_images, OPJ_PATH_LEN * sizeof(
+ char)); /* Stores at max 10 image file names*/
+- dirptr->filename = (char**) malloc(num_images * sizeof(char*));
++ dirptr->filename = (char**) calloc(num_images, sizeof(char*));
+ if (!dirptr->filename_buf) {
+ ret = 0;
+ goto fin;
+diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c
+index 487e3fa18..e54e54fce 100644
+--- a/src/bin/jp2/opj_decompress.c
++++ b/src/bin/jp2/opj_decompress.c
+@@ -1357,14 +1357,13 @@ int main(int argc, char **argv)
+ return EXIT_FAILURE;
+ }
+ /* Stores at max 10 image file names */
+- dirptr->filename_buf = (char*)malloc(sizeof(char) *
+- (size_t)num_images * OPJ_PATH_LEN);
++ dirptr->filename_buf = calloc((size_t) num_images, sizeof(char) * OPJ_PATH_LEN);
+ if (!dirptr->filename_buf) {
+ failed = 1;
+ goto fin;
+ }
+
+- dirptr->filename = (char**) malloc((size_t)num_images * sizeof(char*));
++ dirptr->filename = (char**) calloc((size_t) num_images, sizeof(char*));
+
+ if (!dirptr->filename) {
+ failed = 1;
+diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c
+index 754a39dd0..4e19c6177 100644
+--- a/src/bin/jp2/opj_dump.c
++++ b/src/bin/jp2/opj_dump.c
+@@ -457,7 +457,7 @@ int main(int argc, char *argv[])
+ opj_codestream_info_v2_t* cstr_info = NULL;
+ opj_codestream_index_t* cstr_index = NULL;
+
+- OPJ_INT32 num_images, imageno;
++ int num_images, imageno;
+ img_fol_t img_fol;
+ dircnt_t *dirptr = NULL;
+
+@@ -486,13 +486,13 @@ int main(int argc, char *argv[])
+ if (!dirptr) {
+ return EXIT_FAILURE;
+ }
+- dirptr->filename_buf = (char*)malloc((size_t)num_images * OPJ_PATH_LEN * sizeof(
++ dirptr->filename_buf = (char*) calloc((size_t) num_images, OPJ_PATH_LEN * sizeof(
+ char)); /* Stores at max 10 image file names*/
+ if (!dirptr->filename_buf) {
+ free(dirptr);
+ return EXIT_FAILURE;
+ }
+- dirptr->filename = (char**) malloc((size_t)num_images * sizeof(char*));
++ dirptr->filename = (char**) calloc((size_t) num_images, sizeof(char*));
+
+ if (!dirptr->filename) {
+ goto fails;
diff --git a/extra/openjpeg/fix-cmakelists.patch b/extra/openjpeg/fix-cmakelists.patch
new file mode 100644
index 0000000..ee5fb01
--- /dev/null
+++ b/extra/openjpeg/fix-cmakelists.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -148,7 +148,7 @@
+ # We could install *.cmake files in share/ however those files contains
+ # hardcoded path to libraries on a multi-arch system (fedora/debian) those
+ # path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
+- set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
++ set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/cmake/${OPENJPEG_INSTALL_SUBDIR}")
+ endif()
+
+ if (APPLE)