From b86055454903bcac6e9f0958075c4d8197e23d61 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Thu, 4 Jul 2024 10:30:37 +0200 Subject: [PATCH] Squashed 'src/SZ/' changes from c25805c..f466775 f466775 Merge pull request #116 from ayzk/master1 bde9259 fix a bug when dimension is corrected in compression but not in decompression a92658e Merge pull request #109 from vasole/master a5d6039 Restrict the scope only to windows without MINGW as already done. d0c7f6c Force static build of external libraries with MSVC 73065ab Remove gcc specific options git-subtree-dir: src/SZ git-subtree-split: f4667759ead6a902110e80ff838ccdfddbc8dcd7 --- sz/CMakeLists.txt | 20 ++++++++++++++++---- sz/src/sz.c | 11 ++++++++++- zlib/CMakeLists.txt | 4 ++++ zstd/CMakeLists.txt | 4 ++++ 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/sz/CMakeLists.txt b/sz/CMakeLists.txt index 7fb9bfab..86eae0fc 100644 --- a/sz/CMakeLists.txt +++ b/sz/CMakeLists.txt @@ -92,11 +92,23 @@ set_target_properties (SZ PROPERTIES OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} ) -target_link_libraries (SZ PUBLIC ${ZLIB_dep} ${ZSTD_dep} m) +if (WIN32 AND NOT MINGW) + target_link_libraries (SZ PUBLIC ${ZLIB_dep} ${ZSTD_dep}) +else () + target_link_libraries (SZ PUBLIC ${ZLIB_dep} ${ZSTD_dep} m) +endif () -target_compile_options(SZ - PRIVATE $<$:-Wall -Wextra -Wpedantic -Wno-unused-parameter> - ) +if (WIN32 AND NOT MINGW) + message(STATUS "Native windows compiler detected, adding compile flags") + target_compile_options(SZ + PRIVATE $<$:-Wall> + ) +else () + message(STATUS "GCC detected, adding compile flags") + target_compile_options(SZ + PRIVATE $<$:-Wall -Wextra -Wpedantic -Wno-unused-parameter> + ) +endif() if(BUILD_OPENMP) target_link_libraries(SZ PRIVATE OpenMP::OpenMP_C) diff --git a/sz/src/sz.c b/sz/src/sz.c index 51e98b8a..6bb789bb 100644 --- a/sz/src/sz.c +++ b/sz/src/sz.c @@ -485,7 +485,16 @@ unsigned char *SZ_compress_rev(int dataType, void *data, void *reservedValue, si void *SZ_decompress(int dataType, unsigned char *bytes, size_t byteLength, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1) { - if(confparams_dec==NULL) + //correct dimension if needed + size_t _r[5]; + filterDimension(r5, r4, r3, r2, r1, _r); + r5 = _r[4]; + r4 = _r[3]; + r3 = _r[2]; + r2 = _r[1]; + r1 = _r[0]; + + if(confparams_dec==NULL) confparams_dec = (sz_params*)malloc(sizeof(sz_params)); memset(confparams_dec, 0, sizeof(sz_params)); if(exe_params==NULL) diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt index 305a1e2e..09eb7178 100644 --- a/zlib/CMakeLists.txt +++ b/zlib/CMakeLists.txt @@ -4,6 +4,10 @@ else () set (BUILD_EXT_LIBS_TYPE "STATIC") endif () +if (WIN32 AND NOT MINGW) + set (BUILD_EXT_LIBS_TYPE "STATIC") +endif () + add_library(ZLIB ${BUILD_EXT_LIBS_TYPE} ./gzclose.c ./uncompr.c diff --git a/zstd/CMakeLists.txt b/zstd/CMakeLists.txt index 9a6bc395..ea13dba6 100644 --- a/zstd/CMakeLists.txt +++ b/zstd/CMakeLists.txt @@ -4,6 +4,10 @@ else () set (BUILD_EXT_LIBS_TYPE "STATIC") endif () +if (WIN32 AND NOT MINGW) + set (BUILD_EXT_LIBS_TYPE "STATIC") +endif () + add_library(zstd ${BUILD_EXT_LIBS_TYPE} ./common/entropy_common.c ./common/pool.c