aboutsummaryrefslogtreecommitdiff
path: root/depends
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2015-02-12 22:01:20 +0100
committerJan Dalheimer <jan@dalheimer.de>2015-02-19 21:04:27 +0100
commita53f8d506e212f862f54e5a758fb50666ec7c3ba (patch)
tree6b2cab86af0e34eabaec17a82893284f20323cd7 /depends
parentf9a17eb9deb559ee01fd7e6c67d80c4f93badf28 (diff)
downloadPrismLauncher-a53f8d506e212f862f54e5a758fb50666ec7c3ba.tar.gz
PrismLauncher-a53f8d506e212f862f54e5a758fb50666ec7c3ba.tar.bz2
PrismLauncher-a53f8d506e212f862f54e5a758fb50666ec7c3ba.zip
GH-366: Plain and simple modpack export/import/download
Also removed the in-source QuaZIP in favour of upstream version
Diffstat (limited to 'depends')
-rw-r--r--depends/quazip/CMakeLists.txt31
-rw-r--r--depends/quazip/JlCompress.cpp522
-rw-r--r--depends/quazip/JlCompress.h125
-rw-r--r--depends/quazip/crypt.h135
-rw-r--r--depends/quazip/ioapi.h77
-rw-r--r--depends/quazip/qioapi.cpp146
-rw-r--r--depends/quazip/quaadler32.cpp28
-rw-r--r--depends/quazip/quaadler32.h29
-rw-r--r--depends/quazip/quachecksum32.h54
-rw-r--r--depends/quazip/quacrc32.cpp28
-rw-r--r--depends/quazip/quacrc32.h26
-rw-r--r--depends/quazip/quagzipfile.cpp141
-rw-r--r--depends/quazip/quagzipfile.h35
-rw-r--r--depends/quazip/quaziodevice.cpp283
-rw-r--r--depends/quazip/quaziodevice.h27
-rw-r--r--depends/quazip/quazip.cpp554
-rw-r--r--depends/quazip/quazip.h411
-rw-r--r--depends/quazip/quazip_global.h55
-rw-r--r--depends/quazip/quazipdir.cpp507
-rw-r--r--depends/quazip/quazipdir.h171
-rw-r--r--depends/quazip/quazipfile.cpp488
-rw-r--r--depends/quazip/quazipfile.h442
-rw-r--r--depends/quazip/quazipfileinfo.h66
-rw-r--r--depends/quazip/quazipnewinfo.cpp51
-rw-r--r--depends/quazip/quazipnewinfo.h102
-rw-r--r--depends/quazip/unzip.c1603
-rw-r--r--depends/quazip/unzip.h356
-rw-r--r--depends/quazip/zip.c1281
-rw-r--r--depends/quazip/zip.h245
29 files changed, 0 insertions, 8019 deletions
diff --git a/depends/quazip/CMakeLists.txt b/depends/quazip/CMakeLists.txt
deleted file mode 100644
index b5787307..00000000
--- a/depends/quazip/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-project(quazip)
-
-# Find ZLIB for quazip
-# Use system zlib on unix and Qt ZLIB on Windows
-if(UNIX)
- find_package(ZLIB REQUIRED)
-else(UNIX)
- get_filename_component(ZLIB_FOUND_DIR "${Qt5Core_DIR}/../../../include/QtZlib" ABSOLUTE)
- set(ZLIB_INCLUDE_DIRS ${ZLIB_FOUND_DIR} CACHE PATH "Path to ZLIB headers of Qt")
- set(ZLIB_LIBRARIES "")
- if(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h")
- message("Please specify a valid zlib include dir")
- endif(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h")
-endif(UNIX)
-
-# set all include directories for in and out of source builds
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${ZLIB_INCLUDE_DIRS}
-)
-
-file(GLOB SRCS "*.c" "*.cpp")
-file(GLOB PUBLIC_HEADERS "*.h")
-
-# Static link!
-add_definitions(-DQUAZIP_STATIC)
-
-add_library(quazip STATIC ${SRCS})
-qt5_use_modules(quazip Core)
-target_link_libraries(quazip ${ZLIB_LIBRARIES})
diff --git a/depends/quazip/JlCompress.cpp b/depends/quazip/JlCompress.cpp
deleted file mode 100644
index a6cf0eaf..00000000
--- a/depends/quazip/JlCompress.cpp
+++ /dev/null
@@ -1,522 +0,0 @@
-#include "JlCompress.h"
-#include <QDebug>
-
-bool JlCompress::copyData(QIODevice &inFile, QIODevice &outFile)
-{
- while (!inFile.atEnd()) {
- char buf[4096];
- qint64 readLen = inFile.read(buf, 4096);
- if (readLen <= 0)
- return false;
- if (outFile.write(buf, readLen) != readLen)
- return false;
- }
- return true;
-}
-
-/**OK
- * Comprime il file fileName, nell'oggetto zip, con il nome fileDest.
- *
- * La funzione fallisce se:
- * * zip==NULL;
- * * l'oggetto zip e stato aperto in una modalita non compatibile con l'aggiunta di file;
- * * non e possibile aprire il file d'origine;
- * * non e possibile creare il file all'interno dell'oggetto zip;
- * * si e rilevato un errore nella copia dei dati;
- * * non e stato possibile chiudere il file all'interno dell'oggetto zip;
- */
-bool JlCompress::compressFile(QuaZip* zip, QString fileName, QString fileDest) {
- // zip: oggetto dove aggiungere il file
- // fileName: nome del file reale
- // fileDest: nome del file all'interno del file compresso
-
- // Controllo l'apertura dello zip
- if (!zip) return false;
- if (zip->getMode()!=QuaZip::mdCreate &&
- zip->getMode()!=QuaZip::mdAppend &&
- zip->getMode()!=QuaZip::mdAdd) return false;
-
- // Apro il file originale
- QFile inFile;
- inFile.setFileName(fileName);
- if(!inFile.open(QIODevice::ReadOnly)) return false;
-
- // Apro il file risulato
- QuaZipFile outFile(zip);
- if(!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, inFile.fileName()))) return false;
-
- // Copio i dati
- if (!copyData(inFile, outFile) || outFile.getZipError()!=UNZ_OK) {
- return false;
- }
-
- // Chiudo i file
- outFile.close();
- if (outFile.getZipError()!=UNZ_OK) return false;
- inFile.close();
-
- return true;
-}
-
-/**OK
- * Comprime la cartella dir nel file fileCompressed, se recursive e true allora
- * comprime anche le sotto cartelle. I nomi dei file preceduti dal path creato
- * togliendo il pat della cartella origDir al path della cartella dir.
- * Se la funzione fallisce restituisce false e cancella il file che si e tentato
- * di creare.
- *
- * La funzione fallisce se:
- * * zip==NULL;
- * * l'oggetto zip e stato aperto in una modalita non compatibile con l'aggiunta di file;
- * * la cartella dir non esiste;
- * * la compressione di una sotto cartella fallisce (1);
- * * la compressione di un file fallisce;
- * (1) La funzione si richiama in maniera ricorsiva per comprimere le sotto cartelle
- * dunque gli errori di compressione di una sotto cartella sono gli stessi di questa
- * funzione.
- */
-bool JlCompress::compressSubDir( QuaZip* parentZip, QString dir, QString parentDir, bool recursive, QSet<QString>& added )
-{
- // zip: oggetto dove aggiungere il file
- // dir: cartella reale corrente
- // origDir: cartella reale originale
- // (path(dir)-path(origDir)) = path interno all'oggetto zip
-
- // Controllo l'apertura dello zip
- if (!parentZip ) return false;
- if ( parentZip->getMode()!=QuaZip::mdCreate &&
- parentZip->getMode()!=QuaZip::mdAppend &&
- parentZip->getMode()!=QuaZip::mdAdd) return false;
-
- // Controllo la cartella
- QDir directory(dir);
- if (!directory.exists()) return false;
-
- // Se comprimo anche le sotto cartelle
- if (recursive) {
- // Per ogni sotto cartella
- QFileInfoList files = directory.entryInfoList(QDir::AllDirs|QDir::NoDotAndDotDot);
- Q_FOREACH (QFileInfo file, files)
- {
- // Comprimo la sotto cartella
- if(!compressSubDir( parentZip,file.absoluteFilePath(),parentDir,recursive,added)) return false;
- }
- }
-
- // Per ogni file nella cartella
- QFileInfoList files = directory.entryInfoList(QDir::Files);
- QDir origDirectory( parentDir );
- Q_FOREACH (QFileInfo file, files)
- {
- // Se non e un file o e il file compresso che sto creando
- if(!file.isFile()||file.absoluteFilePath()==parentZip->getZipName()) continue;
-
- // Creo il nome relativo da usare all'interno del file compresso
- QString filename = origDirectory.relativeFilePath(file.absoluteFilePath());
-
- // Comprimo il file
- if (!compressFile( parentZip,file.absoluteFilePath(),filename))
- return false;
- added.insert(filename);
- }
-
- return true;
-}
-
-/**OK
- * Estrae il file fileName, contenuto nell'oggetto zip, con il nome fileDest.
- * Se la funzione fallisce restituisce false e cancella il file che si e tentato di estrarre.
- *
- * La funzione fallisce se:
- * * zip==NULL;
- * * l'oggetto zip e stato aperto in una modalita non compatibile con l'estrazione di file;
- * * non e possibile aprire il file all'interno dell'oggetto zip;
- * * non e possibile creare il file estratto;
- * * si e rilevato un errore nella copia dei dati (1);
- * * non e stato possibile chiudere il file all'interno dell'oggetto zip (1);
- *
- * (1): prima di uscire dalla funzione cancella il file estratto.
- */
-bool JlCompress::extractFile(QuaZip* zip, QString fileName, QString fileDest) {
- // zip: oggetto dove aggiungere il file
- // filename: nome del file reale
- // fileincompress: nome del file all'interno del file compresso
-
- // Controllo l'apertura dello zip
- if (!zip) return false;
- if (zip->getMode()!=QuaZip::mdUnzip) return false;
-
- // Apro il file compresso
- if (!fileName.isEmpty())
- zip->setCurrentFile(fileName);
- QuaZipFile inFile(zip);
- if(!inFile.open(QIODevice::ReadOnly) || inFile.getZipError()!=UNZ_OK) return false;
-
- // Controllo esistenza cartella file risultato
- QDir curDir;
- if (!curDir.mkpath(QFileInfo(fileDest).absolutePath())) {
- return false;
- }
-
- if (QFileInfo(fileDest).isDir())
- return true;
-
- // Apro il file risultato
- QFile outFile;
- outFile.setFileName(fileDest);
- if(!outFile.open(QIODevice::WriteOnly)) return false;
-
- // Copio i dati
- if (!copyData(inFile, outFile) || inFile.getZipError()!=UNZ_OK) {
- outFile.close();
- removeFile(QStringList(fileDest));
- return false;
- }
- outFile.close();
-
- // Chiudo i file
- inFile.close();
- if (inFile.getZipError()!=UNZ_OK) {
- removeFile(QStringList(fileDest));
- return false;
- }
-
- return true;
-}
-
-/**
- * Rimuove i file il cui nome e specificato all'interno di listFile.
- * Restituisce true se tutti i file sono stati cancellati correttamente, attenzione
- * perche puo restituire false anche se alcuni file non esistevano e si e tentato
- * di cancellarli.
- */
-bool JlCompress::removeFile(QStringList listFile) {
- bool ret = true;
- // Per ogni file
- for (int i=0; i<listFile.count(); i++) {
- // Lo elimino
- ret = ret && QFile::remove(listFile.at(i));
- }
- return ret;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-/**OK
- * Comprime il file fileName nel file fileCompressed.
- * Se la funzione fallisce restituisce false e cancella il file che si e tentato
- * di creare.
- *
- * La funzione fallisce se:
- * * non si riesce ad aprire l'oggetto zip;
- * * la compressione del file fallisce;
- * * non si riesce a chiudere l'oggetto zip;
- */
-bool JlCompress::compressFile(QString fileCompressed, QString file) {
- // Creo lo zip
- QuaZip zip(fileCompressed);
- QDir().mkpath(QFileInfo(fileCompressed).absolutePath());
- if(!zip.open(QuaZip::mdCreate)) {
- QFile::remove(fileCompressed);
- return false;
- }
-
- // Aggiungo il file
- if (!compressFile(&zip,file,QFileInfo(file).fileName())) {
- QFile::remove(fileCompressed);
- return false;
- }
-
- // Chiudo il file zip
- zip.close();
- if(zip.getZipError()!=0) {
- QFile::remove(fileCompressed);
- return false;
- }
-
- return true;
-}
-
-/**OK
- * Comprime i file specificati in files nel file fileCompressed.
- * Se la funzione fallisce restituisce false e cancella il file che si e tentato
- * di creare.
- *
- * La funzione fallisce se:
- * * non si riesce ad aprire l'oggetto zip;
- * * la compressione di un file fallisce;
- * * non si riesce a chiudere l'oggetto zip;
- */
-bool JlCompress::compressFiles(QString fileCompressed, QStringList files) {
- // Creo lo zip
- QuaZip zip(fileCompressed);
- QDir().mkpath(QFileInfo(fileCompressed).absolutePath());
- if(!zip.open(QuaZip::mdCreate)) {
- QFile::remove(fileCompressed);
- return false;
- }
-
- // Comprimo i file
- QFileInfo info;
- Q_FOREACH (QString file, files) {
- info.setFile(file);
- if (!info.exists() || !compressFile(&zip,file,info.fileName())) {
- QFile::remove(fileCompressed);
- return false;
- }
- }
-
- // Chiudo il file zip
- zip.close();
- if(zip.getZipError()!=0) {
- QFile::remove(fileCompressed);
- return false;
- }
-
- return true;
-}
-
-/**OK
- * Comprime la cartella dir nel file fileCompressed, se recursive e true allora
- * comprime anche le sotto cartelle.
- * Se la funzione fallisce restituisce false e cancella il file che si e tentato
- * di creare.
- *
- * La funzione fallisce se:
- * * non si riesce ad aprire l'oggetto zip;
- * * la compressione di un file fallisce;
- * * non si riesce a chiudere l'oggetto zip;
- */
-bool JlCompress::compressDir(QString fileCompressed, QString dir, bool recursive) {
- // Creo lo zip
- QuaZip zip(fileCompressed);
- QDir().mkpath(QFileInfo(fileCompressed).absolutePath());
- if(!zip.open(QuaZip::mdCreate)) {
- QFile::remove(fileCompressed);
- return false;
- }
- QSet<QString> added;
- // Aggiungo i file e le sotto cartelle
- if (!compressSubDir(&zip,dir,dir,recursive, added))
- {
- QFile::remove(fileCompressed);
- return false;
- }
-
- // Chiudo il file zip
- zip.close();
- if(zip.getZipError()!=0) {
- QFile::remove(fileCompressed);
- return false;
- }
-
- return true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-/**OK
- * Estrae il file fileName, contenuto nel file fileCompressed, con il nome fileDest.
- * Se fileDest = "" allora il file viene estratto con lo stesso nome con cui e
- * stato compresso.
- * Se la funzione fallisce cancella il file che si e tentato di estrarre.
- * Restituisce il nome assoluto del file estratto.
- *
- * La funzione fallisce se:
- * * non si riesce ad aprire l'oggetto zip;
- * * l'estrazione del file fallisce;
- * * non si riesce a chiudere l'oggetto zip;
- */
-QString JlCompress::extractFile(QString fileCompressed, QString fileName, QString fileDest) {
- // Apro lo zip
- QuaZip zip(fileCompressed);
- if(!zip.open(QuaZip::mdUnzip)) {
- return QString();
- }
-
- // Estraggo il file
- if (fileDest.isEmpty())
- fileDest = fileName;
- if (!extractFile(&zip,fileName,fileDest)) {
- return QString();
- }
-
- // Chiudo il file zip
- zip.close();
- if(zip.getZipError()!=0) {
- removeFile(QStringList(fileDest));
- return QString();
- }
- return QFileInfo(fileDest).absoluteFilePath();
-}
-
-/**OK
- * Estrae i file specificati in files, contenuti nel file fileCompressed, nella
- * cartella dir. La struttura a cartelle del file compresso viene rispettata.
- * Se dir = "" allora il file viene estratto nella cartella corrente.
- * Se la funzione fallisce cancella i file che si e tentato di estrarre.
- * Restituisce i nomi assoluti dei file estratti.
- *
- * La funzione fallisce se:
- * * non si riesce ad aprire l'oggetto zip;
- * * l'estrazione di un file fallisce;
- * * non si riesce a chiudere l'oggetto zip;
- */
-QStringList JlCompress::extractFiles(QString fileCompressed, QStringList files, QString dir) {
- // Creo lo zip
- QuaZip zip(fileCompressed);
- if(!zip.open(QuaZip::mdUnzip)) {
- return QStringList();
- }
-
- // Estraggo i file
- QStringList extracted;
- for (int i=0; i<files.count(); i++) {
- QString absPath = QDir(dir).absoluteFilePath(files.at(i));
- if (!extractFile(&zip, files.at(i), absPath)) {
- removeFile(extracted);
- return QStringList();
- }
- extracted.append(absPath);
- }
-
- // Chiudo il file zip
- zip.close();
- if(zip.getZipError()!=0) {
- removeFile(extracted);
- return QStringList();
- }
-
- return extracted;
-}
-
-QStringList JlCompress::extractWithExceptions(QString fileCompressed, QString dir, QStringList exceptions)
-{
- QuaZip zip(fileCompressed);
- if(!zip.open(QuaZip::mdUnzip))
- {
- return QStringList();
- }
-
- QDir directory(dir);
- QStringList extracted;
- if (!zip.goToFirstFile())
- {
- return QStringList();
- }
- do
- {
- QString name = zip.getCurrentFileName();
- bool ok = true;
- for(auto str: exceptions)
- {
- if(name.startsWith(str))
- {
- ok = false;
- break;
- }
- }
- if(!ok)
- continue;
- QString absFilePath = directory.absoluteFilePath(name);
- if (!JlCompress::extractFile(&zip, "", absFilePath))
- {
- JlCompress::removeFile(extracted);
- return QStringList();
- }
- extracted.append(absFilePath);
- } while (zip.goToNextFile());
-
- zip.close();
- if(zip.getZipError()!=0)
- {
- JlCompress::removeFile(extracted);
- return QStringList();
- }
-
- return extracted;
-}
-
-/**OK
- * Estrae il file fileCompressed nella cartella dir.
- * Se dir = "" allora il file viene estratto nella cartella corrente.
- * Se la funzione fallisce cancella i file che si e tentato di estrarre.
- * Restituisce i nomi assoluti dei file estratti.
- *
- * La funzione fallisce se:
- * * non si riesce ad aprire l'oggetto zip;
- * * la compressione di un file fallisce;
- * * non si riesce a chiudere l'oggetto zip;
- */
-QStringList JlCompress::extractDir(QString fileCompressed, QString dir) {
- // Apro lo zip
- QuaZip zip(fileCompressed);
- if(!zip.open(QuaZip::mdUnzip)) {
- return QStringList();
- }
-
- QDir directory(dir);
- QStringList extracted;
- if (!zip.goToFirstFile()) {
- return QStringList();
- }
- do {
- QString name = zip.getCurrentFileName();
- QString absFilePath = directory.absoluteFilePath(name);
- if (!extractFile(&zip, "", absFilePath)) {
- removeFile(extracted);
- return QStringList();
- }
- extracted.append(absFilePath);
- } while (zip.goToNextFile());
-
- // Chiudo il file zip
- zip.close();
- if(zip.getZipError()!=0) {
- removeFile(extracted);
- return QStringList();
- }
-
- return extracted;
-}
-
-/**OK
- * Restituisce la lista dei file resenti nel file compresso fileCompressed.
- * Se la funzione fallisce, restituisce un elenco vuoto.
- *
- * La funzione fallisce se:
- * * non si riesce ad aprire l'oggetto zip;
- * * la richiesta di informazioni di un file fallisce;
- * * non si riesce a chiudere l'oggetto zip;
- */
-QStringList JlCompress::getFileList(QString fileCompressed) {
- // Apro lo zip
- QuaZip* zip = new QuaZip(QFileInfo(fileCompressed).absoluteFilePath());
- if(!zip->open(QuaZip::mdUnzip)) {
- delete zip;
- return QStringList();
- }
-
- // Estraggo i nomi dei file
- QStringList lst;
- QuaZipFileInfo info;
- for(bool more=zip->goToFirstFile(); more; more=zip->goToNextFile()) {
- if(!zip->getCurrentFileInfo(&info)) {
- delete zip;
- return QStringList();
- }
- lst << info.name;
- //info.name.toLocal8Bit().constData()
- }
-
- // Chiudo il file zip
- zip->close();
- if(zip->getZipError()!=0) {
- delete zip;
- return QStringList();
- }
- delete zip;
-
- return lst;
-}
-
diff --git a/depends/quazip/JlCompress.h b/depends/quazip/JlCompress.h
deleted file mode 100644
index 3ee8c25a..00000000
--- a/depends/quazip/JlCompress.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef JLCOMPRESSFOLDER_H_
-#define JLCOMPRESSFOLDER_H_
-
-#include "quazip.h"
-#include "quazipfile.h"
-#include "quazipfileinfo.h"
-#include <QString>
-#include <QDir>
-#include <QFileInfo>
-#include <QFile>
-
-/// Utility class for typical operations.
-/**
- This class contains a number of useful static functions to perform
- simple operations, such as mass ZIP packing or extraction.
- */
-class QUAZIP_EXPORT JlCompress {
-private:
- /// Remove some files.
- /**
- \param listFile The list of files to remove.
- \return true if success, false otherwise.
- */
- static bool removeFile(QStringList listFile);
-public:
- /// Compress a single file.
- /**
- \param zip Opened zip to compress the file to.
- \param fileName The full path to the source file.
- \param fileDest The full name of the file inside the archive.
- \return true if success, false otherwise.
- */
- static bool compressFile(QuaZip* zip, QString fileName, QString fileDest);
- /// Compress a subdirectory.
- /**
- \param parentZip Opened zip containing the parent directory.
- \param dir The full path to the directory to pack.
- \param parentDir The full path to the directory corresponding to
- the root of the ZIP.
- \param recursive Whether to pack sub-directories as well or only
- files.
- \return true if success, false otherwise.
- */
- static bool compressSubDir( QuaZip* parentZip, QString dir, QString parentDir, bool recursive, QSet< QString >& added );
- /// Extract a single file.
- /**
- \param zip The opened zip archive to extract from.
- \param fileName The full name of the file to extract.
- \param fileDest The full path to the destination file.
- \return true if success, false otherwise.
- */
- static bool extractFile(QuaZip* zip, QString fileName, QString fileDest);
-
- /// copy data from inFile to outFile
- static bool copyData(QIODevice &inFile, QIODevice &outFile);
- /// Compress a single file.
- /**
- \param fileCompressed The name of the archive.
- \param file The file to compress.
- \return true if success, false otherwise.
- */
- static bool compressFile(QString fileCompressed, QString file);
- /// Compress a list of files.
- /**
- \param fileCompressed The name of the archive.
- \param files The file list to compress.
- \return true if success, false otherwise.
- */
- static bool compressFiles(QString fileCompressed, QStringList files);
- /// Compress a whole directory.
- /**
- \param fileCompressed The name of the archive.
- \param dir The directory to compress.
- \param recursive Whether to pack the subdirectories as well, or
- just regular files.
- \return true if success, false otherwise.
- */
- static bool compressDir(QString fileCompressed, QString dir = QString(), bool recursive = true);
-
-public:
- /// Extract a single file.
- /**
- \param fileCompressed The name of the archive.
- \param fileName The file to extract.
- \param fileDest The destination file, assumed to be identical to
- \a file if left empty.
- \return The list of the full paths of the files extracted, empty on failure.
- */
- static QString extractFile(QString fileCompressed, QString fileName, QString fileDest = QString());
- /// Extract a list of files.
- /**
- \param fileCompressed The name of the archive.
- \param files The file list to extract.
- \param dir The directory to put the files to, the current
- directory if left empty.
- \return The list of the full paths of the files extracted, empty on failure.
- */
- static QStringList extractFiles(QString fileCompressed, QStringList files, QString dir = QString());
- /// Extract a whole archive.
- /**
- \param fileCompressed The name of the archive.
- \param dir The directory to extract to, the current directory if
- left empty.
- \return The list of the full paths of the files extracted, empty on failure.
- */
- static QStringList extractDir(QString fileCompressed, QString dir = QString());
- /// Extract a whole archive, with a list of exceptions (prefixes to ignore).
- /**
- \param fileCompressed The name of the archive.
- \param dir The directory to extract to, the current directory if
- left empty.
- \param exceptions The list of exception prefixes
- \return The list of the full paths of the files extracted, empty on failure.
- */
- static QStringList extractWithExceptions(QString fileCompressed, QString dir, QStringList exceptions);
- /// Get the file list.
- /**
- \return The list of the files in the archive, or, more precisely, the
- list of the entries, including both files and directories if they
- are present separately.
- */
- static QStringList getFileList(QString fileCompressed);
-};
-
-#endif /* JLCOMPRESSFOLDER_H_ */
diff --git a/depends/quazip/crypt.h b/depends/quazip/crypt.h
deleted file mode 100644
index 1d6da628..00000000
--- a/depends/quazip/crypt.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* crypt.h -- base code for crypt/uncrypt ZIPfile
-
-
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-
- This code is a modified version of crypting code in Infozip distribution
-
- The encryption/decryption parts of this source code (as opposed to the
- non-echoing password parts) were originally written in Europe. The
- whole source package can be freely distributed, including from the USA.
- (Prior to January 2000, re-export from the US was a violation of US law.)
-
- This encryption code is a direct transcription of the algorithm from
- Roger Schlafly, described by Phil Katz in the file appnote.txt. This
- file (appnote.txt) is distributed with the PKZIP program (even in the
- version without encryption capabilities).
-
- If you don't need crypting in your application, just define symbols
- NOCRYPT and NOUNCRYPT.
-
- This code support the "Traditional PKWARE Encryption".
-
- The new AES encryption added on Zip format by Winzip (see the page
- http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
- Encryption is not supported.
-*/
-
-#include "quazip_global.h"
-
-#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
-
-/***********************************************************************
- * Return the next byte in the pseudo-random sequence
- */
-static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab UNUSED)
-{
- //(void) pcrc_32_tab; /* avoid "unused parameter" warning */
- unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
- * unpredictable manner on 16-bit systems; not a problem
- * with any known compiler so far, though */
-
- temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
- return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
-}
-
-/***********************************************************************
- * Update the encryption keys with the next byte of plain text
- */
-static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
-{
- (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
- (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
- (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
- {
- register int keyshift = (int)((*(pkeys+1)) >> 24);
- (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
- }
- return c;
-}
-
-
-/***********************************************************************
- * Initialize the encryption keys and the random header according to
- * the given password.
- */
-static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
-{
- *(pkeys+0) = 305419896L;
- *(pkeys+1) = 591751049L;
- *(pkeys+2) = 878082192L;
- while (*passwd != '\0') {
- update_keys(pkeys,pcrc_32_tab,(int)*passwd);
- passwd++;
- }
-}
-
-#define zdecode(pkeys,pcrc_32_tab,c) \
- (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
-
-#define zencode(pkeys,pcrc_32_tab,c,t) \
- (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
-
-#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
-
-#define RAND_HEAD_LEN 12
- /* "last resort" source for second part of crypt seed pattern */
-# ifndef ZCR_SEED2
-# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
-# endif
-
-static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
- const char *passwd; /* password string */
- unsigned char *buf; /* where to write header */
- int bufSize;
- unsigned long* pkeys;
- const unsigned long* pcrc_32_tab;
- unsigned long crcForCrypting;
-{
- int n; /* index in random header */
- int t; /* temporary */
- int c; /* random byte */
- unsigned char header[RAND_HEAD_LEN-2]; /* random header */
- static unsigned calls = 0; /* ensure different random header each time */
-
- if (bufSize<RAND_HEAD_LEN)
- return 0;
-
- /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
- * output of rand() to get less predictability, since rand() is
- * often poorly implemented.
- */
- if (++calls == 1)
- {
- srand((unsigned)(time(NULL) ^ ZCR_SEED2));
- }
- init_keys(passwd, pkeys, pcrc_32_tab);
- for (n = 0; n < RAND_HEAD_LEN-2; n++)
- {
- c = (rand() >> 7) & 0xff;
- header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
- }
- /* Encrypt random header (last two bytes is high word of crc) */
- init_keys(passwd, pkeys, pcrc_32_tab);
- for (n = 0; n < RAND_HEAD_LEN-2; n++)
- {
- buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
- }
- buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
- buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) &