Add compatibility fix for Minizip dependency
This commit is contained in:
parent
f827daba24
commit
f4c283298f
|
@ -43,6 +43,13 @@ if(MINIZIP_FOUND)
|
||||||
set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY})
|
set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY})
|
||||||
set(MINIZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIR})
|
set(MINIZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIR})
|
||||||
SET(HAVE_MINIZIP ON)
|
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()
|
else()
|
||||||
set(MINIZIP_LIBRARIES)
|
set(MINIZIP_LIBRARIES)
|
||||||
set(MINIZIP_INCLUDE_DIRS)
|
set(MINIZIP_INCLUDE_DIRS)
|
||||||
|
|
|
@ -130,6 +130,9 @@
|
||||||
/* Define to use the minizip library */
|
/* Define to use the minizip library */
|
||||||
#cmakedefine HAVE_MINIZIP 1
|
#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 */
|
/* Define to use brotli library */
|
||||||
#cmakedefine HAVE_BROTLI 1
|
#cmakedefine HAVE_BROTLI 1
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,14 @@
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QMap>
|
#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))
|
bool WiresharkZipHelper::unzip(QString zipFile, QString directory, bool (*fileCheck)(QString, int), QString (*cleanName)(QString))
|
||||||
{
|
{
|
||||||
unzFile uf = Q_NULLPTR;
|
unzFile uf = Q_NULLPTR;
|
||||||
|
@ -209,7 +217,7 @@ void WiresharkZipHelper::addFileToZip(zipFile zf, QString filepath, QString file
|
||||||
memset(&zi, 0, sizeof(zi));
|
memset(&zi, 0, sizeof(zi));
|
||||||
|
|
||||||
QDateTime fTime = fi.lastModified();
|
QDateTime fTime = fi.lastModified();
|
||||||
zi.dosDate = qDateToDosDate(fTime);
|
zi._MZDOSDATE = qDateToDosDate(fTime);
|
||||||
|
|
||||||
QFile fh(filepath);
|
QFile fh(filepath);
|
||||||
/* Checks if a large file block has to be written */
|
/* Checks if a large file block has to be written */
|
||||||
|
|
Loading…
Reference in New Issue