From 31db3c325d2ffc9dedc240d8ac5036fe6f1cf5c3 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Thu, 24 Mar 2022 22:53:02 -0400 Subject: [PATCH] Fix compiling with minizip-ng * minizip-ng has slightly different defines and function names than the original minizip. These changes adapt the existing code to use the minizip-ng versions if necessary. --- src/keeshare/CMakeLists.txt | 1 - src/keeshare/ShareExport.cpp | 9 ++++++++- src/keeshare/ShareImport.cpp | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/keeshare/CMakeLists.txt b/src/keeshare/CMakeLists.txt index 9fcc55dc2..a108b784b 100644 --- a/src/keeshare/CMakeLists.txt +++ b/src/keeshare/CMakeLists.txt @@ -17,6 +17,5 @@ if(WITH_XC_KEESHARE) add_library(keeshare STATIC ${keeshare_SOURCES}) target_link_libraries(keeshare PUBLIC Qt5::Core Qt5::Widgets ${BOTAN2_LIBRARIES} ${ZLIB_LIBRARIES} PRIVATE ${MINIZIP_LIBRARIES}) - target_include_directories(keeshare SYSTEM PRIVATE ${MINIZIP_INCLUDE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) endif(WITH_XC_KEESHARE) diff --git a/src/keeshare/ShareExport.cpp b/src/keeshare/ShareExport.cpp index a457033af..d43ef73cb 100644 --- a/src/keeshare/ShareExport.cpp +++ b/src/keeshare/ShareExport.cpp @@ -27,7 +27,14 @@ #include #include -#include +#include + +// Compatibility with minizip-ng +#ifdef MZ_VERSION_BUILD +#undef Z_BEST_COMPRESSION +#define Z_BEST_COMPRESSION MZ_COMPRESS_LEVEL_BEST +#define zipOpenNewFileInZip64 zipOpenNewFileInZip_64 +#endif namespace { diff --git a/src/keeshare/ShareImport.cpp b/src/keeshare/ShareImport.cpp index 123486456..eb93912e7 100644 --- a/src/keeshare/ShareImport.cpp +++ b/src/keeshare/ShareImport.cpp @@ -21,7 +21,7 @@ #include "keys/PasswordKey.h" #include -#include +#include namespace {