Add compatibility fix for Minizip dependency
parent
f827daba24
commit
f4c283298f
|
@ -43,6 +43,13 @@ if(MINIZIP_FOUND)
|
|||
set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY})
|
||||
set(MINIZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIR})
|
||||
SET(HAVE_MINIZIP ON)
|
||||
# Some distributions have minizip-ng code instead of the original zlib contrib
|
||||
# library but keep the old minizip name (because minizip-ng is
|
||||
# better maintained and provides a compatibility layer). However the
|
||||
# minizip-ng compatibility layer has some issues. We need to check
|
||||
# for renamed struct members to avoid an endless game of whack-a-mole.
|
||||
include(CheckStructHasMember)
|
||||
check_struct_has_member("zip_fileinfo" "dos_date" "minizip/zip.h" HAVE_MZCOMPAT_DOS_DATE)
|
||||
else()
|
||||
set(MINIZIP_LIBRARIES)
|
||||
set(MINIZIP_INCLUDE_DIRS)
|
||||
|
|
|
@ -130,6 +130,9 @@
|
|||
/* Define to use the minizip library */
|
||||
#cmakedefine HAVE_MINIZIP 1
|
||||
|
||||
/* Define if `dos_date' (with underscore) field exists in `zip_fileinfo' */
|
||||
#cmakedefine HAVE_MZCOMPAT_DOS_DATE 1
|
||||
|
||||
/* Define to use brotli library */
|
||||
#cmakedefine HAVE_BROTLI 1
|
||||
|
||||
|
|
|
@ -32,6 +32,14 @@
|
|||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
|
||||
/* Whether we are using minizip-ng and it uses an incompatible 'dos_date'
|
||||
* struct member. */
|
||||
#ifdef HAVE_MZCOMPAT_DOS_DATE
|
||||
#define _MZDOSDATE dos_date
|
||||
#else
|
||||
#define _MZDOSDATE dosDate
|
||||
#endif
|
||||
|
||||
bool WiresharkZipHelper::unzip(QString zipFile, QString directory, bool (*fileCheck)(QString, int), QString (*cleanName)(QString))
|
||||
{
|
||||
unzFile uf = Q_NULLPTR;
|
||||
|
@ -209,7 +217,7 @@ void WiresharkZipHelper::addFileToZip(zipFile zf, QString filepath, QString file
|
|||
memset(&zi, 0, sizeof(zi));
|
||||
|
||||
QDateTime fTime = fi.lastModified();
|
||||
zi.dosDate = qDateToDosDate(fTime);
|
||||
zi._MZDOSDATE = qDateToDosDate(fTime);
|
||||
|
||||
QFile fh(filepath);
|
||||
/* Checks if a large file block has to be written */
|
||||
|
|
Loading…
Reference in New Issue