rbutil: Update vendored quazip from v1.1 to v1.3

Change-Id: Icd6f010adbc9712f381a409eca31506fe31bb304
This commit is contained in:
Solomon Peachy 2026-06-21 08:55:26 -04:00
parent 18237a3c1f
commit 1e3301388c
5 changed files with 44 additions and 16 deletions

View file

@ -3,7 +3,7 @@ These files are distributed under the LGPL v2.1 or later. Only source files
actually used in Rockbox Utility are included, further sources have been left
out. Check the quazip source distribution for those.
The source files have been last synced with the project's release 1.1 at
https://github.com/stachenov/quazip/ on October 11, 2020.
The source files have been last synced with the project's release 1.3 at
https://github.com/stachenov/quazip/ from April 16, 2022.

View file

@ -349,7 +349,6 @@ void QuaZip::close()
p->zipError=UNZ_OK;
switch(p->mode) {
case mdNotOpen:
qWarning("QuaZip::close(): ZIP is not open");
return;
case mdUnzip:
p->zipError=unzClose(p->unzFile_f);
@ -371,8 +370,7 @@ void QuaZip::close()
p->ioDevice = nullptr;
}
p->clearDirectoryMap();
if(p->zipError==UNZ_OK)
p->mode=mdNotOpen;
p->mode=mdNotOpen;
}
void QuaZip::setZipName(const QString& zipName)

View file

@ -213,6 +213,11 @@ class QUAZIP_EXPORT QuaZip {
* but at least it makes your programs work instead of crashing. Note that
* if the auto-close flag is cleared, then this is a non-issue, and
* commit() isn't called.
*
* Closing an already closed (or never opened) instance is safe,
* regardless of whether the first close attempt was successful.
* This second close does nothing, but is considered a success,
* as far as getZipError() is concerned.
*/
void close();
/// Sets the codec used to encode/decode file names inside archive.

View file

@ -25,7 +25,7 @@ Original ZIP package is copyrighted by Gilles Vollant and contributors,
see quazip/(un)zip.h files for details. Basically it's the zlib license.
*/
#include <QtCore/qglobal.h>
#include <QtCore/QtGlobal>
/**
This is automatically defined when building a static library, but when

View file

@ -9,8 +9,8 @@
* Some includes are repeated just in case we want to split this file later.
*/
#include <Qt>
#include <QtGlobal>
#include <QtCore/Qt>
#include <QtCore/QtGlobal>
// Legacy encodings are still everywhere, but the Qt team decided we
// don't need them anymore and moved them out of Core in Qt 6.
@ -46,12 +46,12 @@ inline bool quazip_close(QIODevice *device) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
using Qt::SkipEmptyParts;
#else
#include <QString>
#include <QtCore/QString>
const auto SkipEmptyParts = QString::SplitBehavior::SkipEmptyParts;
#endif
// and yet another... (why didn't they just make qSort delegate to std::sort?)
#include <QList>
#include <QtCore/QList>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
#include <algorithm>
template<typename T, typename C>
@ -59,7 +59,7 @@ inline void quazip_sort(T begin, T end, C comparator) {
std::sort(begin, end, comparator);
}
#else
#include <QtAlgorithms>
#include <QtCore/QtAlgorithms>
template<typename T, typename C>
inline void quazip_sort(T begin, T end, C comparator) {
qSort(begin, end, comparator);
@ -67,8 +67,8 @@ inline void quazip_sort(T begin, T end, C comparator) {
#endif
// this is a stupid rename...
#include <QDateTime>
#include <QFileInfo>
#include <QtCore/QDateTime>
#include <QtCore/QFileInfo>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
inline QDateTime quazip_ctime(const QFileInfo &fi) {
return fi.birthTime();
@ -79,8 +79,33 @@ inline QDateTime quazip_ctime(const QFileInfo &fi) {
}
#endif
// this is just a slightly better alternative
#include <QtCore/QFileInfo>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
inline bool quazip_is_symlink(const QFileInfo &fi) {
return fi.isSymbolicLink();
}
#else
inline bool quazip_is_symlink(const QFileInfo &fi) {
// also detects *.lnk on Windows, but better than nothing
return fi.isSymLink();
}
#endif
// I'm not even sure what this one is, but nevertheless
#include <QtCore/QFileInfo>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
inline QString quazip_symlink_target(const QFileInfo &fi) {
return fi.symLinkTarget();
}
#else
inline QString quazip_symlink_target(const QFileInfo &fi) {
return fi.readLink(); // What's the difference? I've no idea.
}
#endif
// this is not a deprecation but an improvement, for a change
#include <QDateTime>
#include <QtCore/QDateTime>
#if (QT_VERSION >= 0x040700)
inline quint64 quazip_ntfs_ticks(const QDateTime &time, int fineTicks) {
QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC);
@ -98,7 +123,7 @@ inline quint64 quazip_ntfs_ticks(const QDateTime &time, int fineTicks) {
#endif
// yet another improvement...
#include <QDateTime>
#include <QtCore/QDateTime>
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) // Yay! Finally a way to get time as qint64!
inline qint64 quazip_to_time64_t(const QDateTime &time) {
return time.toSecsSinceEpoch();
@ -109,7 +134,7 @@ inline qint64 quazip_to_time64_t(const QDateTime &time) {
}
#endif
#include <QTextStream>
#include <QtCore/QTextStream>
// and another stupid move
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
const auto quazip_endl = Qt::endl;