You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There needs to be a minor change in the two files quazip_qt_compat.h and quazipfileinfo.cpp when compiling with Qt 6.8.0 or later. Everything before that version compiles without any warnings (on GCC, but I disabled warnings when compiling with MSVC). (EDIT: using Qt 5.15.5 still compiles OK with the new #if ... #else guards in place).
The warning given when compiling the code with Qt 6.8.0 (using GCC 11.4.0 on Linux Ubuntu 22.04) is:
In file included from ../../../3rd_party/quazip/quazip.h:30,
from ../../../3rd_party/quazip/JlCompress.h:29,
from ../../../3rd_party/quazip/JlCompress.cpp:26:
../../../3rd_party/quazip/quazip_qt_compat.h:
../../../3rd_party/quazip/quazip_qt_compat.h:110:59:
In function ‘quint64 quazip_ntfs_ticks(const QDateTime&, int)’:
warning: ‘QDateTime::QDateTime(QDate, QTime, Qt::TimeSpec, int)’ is deprecated:
Pass QTimeZone instead [-Wdeprecated-declarations]
110 | QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC);
I tested using an #include guard:
// At line 106:
// this is not a deprecation but an improvement, for a change
#include <QtCore/QDateTime>
#if QT_VERSION >= QT_VERSION_CHECK(6,8,0)
inline quint64 quazip_ntfs_ticks(const QDateTime &time, int fineTicks) {
QDateTime base(QDate(1601, 1, 1), QTime(0, 0), QTimeZone(Qt::UTC));
return base.msecsTo(time) * 10000 + fineTicks;
}
#elif (QT_VERSION >= 0x040700)
// etc.
Also, in the file quazipfileinfo.cpp: #include at the top:
Since I am building QuaZip by including the source files in my application, I have no way of testing whether or not the proposed changes have implications for the build toolchain. That is why I have not forked the project and made a pull request, but rather just show the changes here. But the changes are very small, so I think it should be OK.
Since Qt 6.8 constructor of QDateTime, which accepts TimeSpec enum,
is marked as deprecated. To compile at this version without warnings it is necessary to
explicitly pass QTimeZone instead.
To save work with lower version of Qt, version check macro was added.
issue: #207
There needs to be a minor change in the two files
quazip_qt_compat.h
andquazipfileinfo.cpp
when compiling with Qt 6.8.0 or later. Everything before that version compiles without any warnings (on GCC, but I disabled warnings when compiling with MSVC). (EDIT: using Qt 5.15.5 still compiles OK with the new#if ... #else
guards in place).The warning given when compiling the code with Qt 6.8.0 (using GCC 11.4.0 on Linux Ubuntu 22.04) is:
I tested using an #include guard:
Also, in the file
quazipfileinfo.cpp
: #include at the top:Then at line 129:
The text was updated successfully, but these errors were encountered: