1
0
Fork 0
forked from len0rd/rockbox

Set svn:eol-style on files from the rbutil directory and its subdirectories.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17462 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2008-05-11 17:21:14 +00:00
parent 850c4f98ba
commit 9c54187678
18 changed files with 17708 additions and 17708 deletions

View file

@ -1,48 +1,48 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2008 by Dominik Riebeling
* $Id$
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "rbunzip.h"
#include <QtCore>
UnZip::ErrorCode RbUnZip::extractArchive(const QString& dest)
{
QStringList files = this->fileList();
UnZip::ErrorCode error = Ok;
m_abortunzip = false;
int total = files.size();
for(int i = 0; i < total; i++) {
qDebug() << __func__ << files.at(i);
error = this->extractFile(files.at(i), dest, UnZip::ExtractPaths);
emit unzipProgress(i + 1, total);
QCoreApplication::processEvents(); // update UI
if(m_abortunzip)
error = SkipAll;
if(error != Ok)
break;
}
return error;
}
void RbUnZip::abortUnzip(void)
{
m_abortunzip = true;
}
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2008 by Dominik Riebeling
* $Id$
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "rbunzip.h"
#include <QtCore>
UnZip::ErrorCode RbUnZip::extractArchive(const QString& dest)
{
QStringList files = this->fileList();
UnZip::ErrorCode error = Ok;
m_abortunzip = false;
int total = files.size();
for(int i = 0; i < total; i++) {
qDebug() << __func__ << files.at(i);
error = this->extractFile(files.at(i), dest, UnZip::ExtractPaths);
emit unzipProgress(i + 1, total);
QCoreApplication::processEvents(); // update UI
if(m_abortunzip)
error = SkipAll;
if(error != Ok)
break;
}
return error;
}
void RbUnZip::abortUnzip(void)
{
m_abortunzip = true;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,2 +1,2 @@
1 24 MOVEABLE PURE "rbutilqt.manifest"
RBUTIL_ICON ICON DISCARDABLE "icons/rockbox.ico"
1 24 MOVEABLE PURE "rbutilqt.manifest"
RBUTIL_ICON ICON DISCARDABLE "icons/rockbox.ico"

View file

@ -1,67 +1,67 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2008 by Dominik Wenger
* $Id: rbzip.cpp 17129 2008-04-15 21:25:57Z bluebrother $
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "rbzip.h"
#include <QtCore>
Zip::ErrorCode RbZip::createZip(QString zip,QString dir,ProgressloggerInterface *dp)
{
m_logger = dp;
Zip::ErrorCode error = Ok;
m_curEntry = 1;
int numEntrys=0;
m_logger->addItem(tr("Creating Backup: %1").arg(zip),LOGINFO);
QCoreApplication::processEvents();
// get number of entrys in dir
QDirIterator it(dir, QDirIterator::Subdirectories);
while (it.hasNext())
{
it.next();
numEntrys++;
QCoreApplication::processEvents();
}
m_logger->setProgressMax(numEntrys);
//! create zip
error = Zip::createArchive(zip);
if(error != Ok)
return error;
//! add the content
error = Zip::addDirectory(dir);
if(error != Ok)
return error;
//! close zip
error = Zip::closeArchive();
return error;
}
void RbZip::progress()
{
m_curEntry++;
m_logger->setProgressValue(m_curEntry);
QCoreApplication::processEvents(); // update UI
}
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2008 by Dominik Wenger
* $Id: rbzip.cpp 17129 2008-04-15 21:25:57Z bluebrother $
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "rbzip.h"
#include <QtCore>
Zip::ErrorCode RbZip::createZip(QString zip,QString dir,ProgressloggerInterface *dp)
{
m_logger = dp;
Zip::ErrorCode error = Ok;
m_curEntry = 1;
int numEntrys=0;
m_logger->addItem(tr("Creating Backup: %1").arg(zip),LOGINFO);
QCoreApplication::processEvents();
// get number of entrys in dir
QDirIterator it(dir, QDirIterator::Subdirectories);
while (it.hasNext())
{
it.next();
numEntrys++;
QCoreApplication::processEvents();
}
m_logger->setProgressMax(numEntrys);
//! create zip
error = Zip::createArchive(zip);
if(error != Ok)
return error;
//! add the content
error = Zip::addDirectory(dir);
if(error != Ok)
return error;
//! close zip
error = Zip::closeArchive();
return error;
}
void RbZip::progress()
{
m_curEntry++;
m_logger->setProgressValue(m_curEntry);
QCoreApplication::processEvents(); // update UI
}

View file

@ -15,28 +15,28 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef RBZIP_H
#define RBZIP_H
#include <QtCore>
#include "zip/zip.h"
****************************************************************************/
#ifndef RBZIP_H
#define RBZIP_H
#include <QtCore>
#include "zip/zip.h"
#include "progressloggerinterface.h"
class RbZip : public QObject, public Zip
{
Q_OBJECT
public:
Zip::ErrorCode createZip(QString zip,QString dir,ProgressloggerInterface *dp);
virtual void progress();
class RbZip : public QObject, public Zip
{
Q_OBJECT
public:
Zip::ErrorCode createZip(QString zip,QString dir,ProgressloggerInterface *dp);
virtual void progress();
private:
int m_curEntry;
ProgressloggerInterface *m_logger;
};
#endif
ProgressloggerInterface *m_logger;
};
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,144 +1,144 @@
/****************************************************************************
** Filename: unzip.h
** Last updated [dd/mm/yyyy]: 28/01/2007
**
** pkzip 2.0 decompression.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
#ifndef OSDAB_UNZIP__H
#define OSDAB_UNZIP__H
#include <QtGlobal>
#include <QMap>
#include <QDateTime>
#include <zlib/zlib.h>
class UnzipPrivate;
class QIODevice;
class QFile;
class QDir;
class QStringList;
class QString;
class UnZip
{
public:
enum ErrorCode
{
Ok,
ZlibInit,
ZlibError,
OpenFailed,
PartiallyCorrupted,
Corrupted,
WrongPassword,
NoOpenArchive,
FileNotFound,
ReadFailed,
WriteFailed,
SeekFailed,
CreateDirFailed,
InvalidDevice,
InvalidArchive,
HeaderConsistencyError,
Skip, SkipAll // internal use only
};
enum ExtractionOption
{
//! Extracts paths (default)
ExtractPaths = 0x0001,
//! Ignores paths and extracts all the files to the same directory
SkipPaths = 0x0002
};
Q_DECLARE_FLAGS(ExtractionOptions, ExtractionOption)
enum CompressionMethod
{
NoCompression, Deflated, UnknownCompression
};
enum FileType
{
File, Directory
};
typedef struct ZipEntry
{
ZipEntry();
QString filename;
QString comment;
quint32 compressedSize;
quint32 uncompressedSize;
quint32 crc32;
QDateTime lastModified;
CompressionMethod compression;
FileType type;
bool encrypted;
};
UnZip();
virtual ~UnZip();
bool isOpen() const;
ErrorCode openArchive(const QString& filename);
ErrorCode openArchive(QIODevice* device);
void closeArchive();
QString archiveComment() const;
QString formatError(UnZip::ErrorCode c) const;
bool contains(const QString& file) const;
QStringList fileList() const;
QList<ZipEntry> entryList() const;
ErrorCode extractAll(const QString& dirname, ExtractionOptions options = ExtractPaths);
ErrorCode extractAll(const QDir& dir, ExtractionOptions options = ExtractPaths);
ErrorCode extractFile(const QString& filename, const QString& dirname, ExtractionOptions options = ExtractPaths);
ErrorCode extractFile(const QString& filename, const QDir& dir, ExtractionOptions options = ExtractPaths);
ErrorCode extractFile(const QString& filename, QIODevice* device, ExtractionOptions options = ExtractPaths);
ErrorCode extractFiles(const QStringList& filenames, const QString& dirname, ExtractionOptions options = ExtractPaths);
ErrorCode extractFiles(const QStringList& filenames, const QDir& dir, ExtractionOptions options = ExtractPaths);
void setPassword(const QString& pwd);
private:
UnzipPrivate* d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(UnZip::ExtractionOptions)
#endif // OSDAB_UNZIP__H
/****************************************************************************
** Filename: unzip.h
** Last updated [dd/mm/yyyy]: 28/01/2007
**
** pkzip 2.0 decompression.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
#ifndef OSDAB_UNZIP__H
#define OSDAB_UNZIP__H
#include <QtGlobal>
#include <QMap>
#include <QDateTime>
#include <zlib/zlib.h>
class UnzipPrivate;
class QIODevice;
class QFile;
class QDir;
class QStringList;
class QString;
class UnZip
{
public:
enum ErrorCode
{
Ok,
ZlibInit,
ZlibError,
OpenFailed,
PartiallyCorrupted,
Corrupted,
WrongPassword,
NoOpenArchive,
FileNotFound,
ReadFailed,
WriteFailed,
SeekFailed,
CreateDirFailed,
InvalidDevice,
InvalidArchive,
HeaderConsistencyError,
Skip, SkipAll // internal use only
};
enum ExtractionOption
{
//! Extracts paths (default)
ExtractPaths = 0x0001,
//! Ignores paths and extracts all the files to the same directory
SkipPaths = 0x0002
};
Q_DECLARE_FLAGS(ExtractionOptions, ExtractionOption)
enum CompressionMethod
{
NoCompression, Deflated, UnknownCompression
};
enum FileType
{
File, Directory
};
typedef struct ZipEntry
{
ZipEntry();
QString filename;
QString comment;
quint32 compressedSize;
quint32 uncompressedSize;
quint32 crc32;
QDateTime lastModified;
CompressionMethod compression;
FileType type;
bool encrypted;
};
UnZip();
virtual ~UnZip();
bool isOpen() const;
ErrorCode openArchive(const QString& filename);
ErrorCode openArchive(QIODevice* device);
void closeArchive();
QString archiveComment() const;
QString formatError(UnZip::ErrorCode c) const;
bool contains(const QString& file) const;
QStringList fileList() const;
QList<ZipEntry> entryList() const;
ErrorCode extractAll(const QString& dirname, ExtractionOptions options = ExtractPaths);
ErrorCode extractAll(const QDir& dir, ExtractionOptions options = ExtractPaths);
ErrorCode extractFile(const QString& filename, const QString& dirname, ExtractionOptions options = ExtractPaths);
ErrorCode extractFile(const QString& filename, const QDir& dir, ExtractionOptions options = ExtractPaths);
ErrorCode extractFile(const QString& filename, QIODevice* device, ExtractionOptions options = ExtractPaths);
ErrorCode extractFiles(const QStringList& filenames, const QString& dirname, ExtractionOptions options = ExtractPaths);
ErrorCode extractFiles(const QStringList& filenames, const QDir& dir, ExtractionOptions options = ExtractPaths);
void setPassword(const QString& pwd);
private:
UnzipPrivate* d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(UnZip::ExtractionOptions)
#endif // OSDAB_UNZIP__H

View file

@ -1,112 +1,112 @@
/****************************************************************************
** Filename: unzip_p.h
** Last updated [dd/mm/yyyy]: 28/01/2007
**
** pkzip 2.0 decompression.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Zip/UnZip API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef OSDAB_UNZIP_P__H
#define OSDAB_UNZIP_P__H
#include "unzip.h"
#include "zipentry_p.h"
#include <QtGlobal>
// zLib authors suggest using larger buffers (128K or 256K) for (de)compression (especially for inflate())
// we use a 256K buffer here - if you want to use this code on a pre-iceage mainframe please change it ;)
#define UNZIP_READ_BUFFER (256*1024)
class UnzipPrivate
{
public:
UnzipPrivate();
// Replace this with whatever else you use to store/retrieve the password.
QString password;
bool skipAllEncrypted;
QMap<QString,ZipEntryP*>* headers;
QIODevice* device;
char buffer1[UNZIP_READ_BUFFER];
char buffer2[UNZIP_READ_BUFFER];
unsigned char* uBuffer;
const quint32* crcTable;
// Central Directory (CD) offset
quint32 cdOffset;
// End of Central Directory (EOCD) offset
quint32 eocdOffset;
// Number of entries in the Central Directory (as to the EOCD record)
quint16 cdEntryCount;
// The number of detected entries that have been skipped because of a non compatible format
quint16 unsupportedEntryCount;
QString comment;
UnZip::ErrorCode openArchive(QIODevice* device);
UnZip::ErrorCode seekToCentralDirectory();
UnZip::ErrorCode parseCentralDirectoryRecord();
UnZip::ErrorCode parseLocalHeaderRecord(const QString& path, ZipEntryP& entry);
void closeArchive();
UnZip::ErrorCode extractFile(const QString& path, ZipEntryP& entry, const QDir& dir, UnZip::ExtractionOptions options);
UnZip::ErrorCode extractFile(const QString& path, ZipEntryP& entry, QIODevice* device, UnZip::ExtractionOptions options);
UnZip::ErrorCode testPassword(quint32* keys, const QString& file, const ZipEntryP& header);
bool testKeys(const ZipEntryP& header, quint32* keys);
bool createDirectory(const QString& path);
inline void decryptBytes(quint32* keys, char* buffer, qint64 read);
inline quint32 getULong(const unsigned char* data, quint32 offset) const;
inline quint64 getULLong(const unsigned char* data, quint32 offset) const;
inline quint16 getUShort(const unsigned char* data, quint32 offset) const;
inline int decryptByte(quint32 key2) const;
inline void updateKeys(quint32* keys, int c) const;
inline void initKeys(const QString& pwd, quint32* keys) const;
inline QDateTime convertDateTime(const unsigned char date[2], const unsigned char time[2]) const;
};
#endif // OSDAB_UNZIP_P__H
/****************************************************************************
** Filename: unzip_p.h
** Last updated [dd/mm/yyyy]: 28/01/2007
**
** pkzip 2.0 decompression.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Zip/UnZip API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef OSDAB_UNZIP_P__H
#define OSDAB_UNZIP_P__H
#include "unzip.h"
#include "zipentry_p.h"
#include <QtGlobal>
// zLib authors suggest using larger buffers (128K or 256K) for (de)compression (especially for inflate())
// we use a 256K buffer here - if you want to use this code on a pre-iceage mainframe please change it ;)
#define UNZIP_READ_BUFFER (256*1024)
class UnzipPrivate
{
public:
UnzipPrivate();
// Replace this with whatever else you use to store/retrieve the password.
QString password;
bool skipAllEncrypted;
QMap<QString,ZipEntryP*>* headers;
QIODevice* device;
char buffer1[UNZIP_READ_BUFFER];
char buffer2[UNZIP_READ_BUFFER];
unsigned char* uBuffer;
const quint32* crcTable;
// Central Directory (CD) offset
quint32 cdOffset;
// End of Central Directory (EOCD) offset
quint32 eocdOffset;
// Number of entries in the Central Directory (as to the EOCD record)
quint16 cdEntryCount;
// The number of detected entries that have been skipped because of a non compatible format
quint16 unsupportedEntryCount;
QString comment;
UnZip::ErrorCode openArchive(QIODevice* device);
UnZip::ErrorCode seekToCentralDirectory();
UnZip::ErrorCode parseCentralDirectoryRecord();
UnZip::ErrorCode parseLocalHeaderRecord(const QString& path, ZipEntryP& entry);
void closeArchive();
UnZip::ErrorCode extractFile(const QString& path, ZipEntryP& entry, const QDir& dir, UnZip::ExtractionOptions options);
UnZip::ErrorCode extractFile(const QString& path, ZipEntryP& entry, QIODevice* device, UnZip::ExtractionOptions options);
UnZip::ErrorCode testPassword(quint32* keys, const QString& file, const ZipEntryP& header);
bool testKeys(const ZipEntryP& header, quint32* keys);
bool createDirectory(const QString& path);
inline void decryptBytes(quint32* keys, char* buffer, qint64 read);
inline quint32 getULong(const unsigned char* data, quint32 offset) const;
inline quint64 getULLong(const unsigned char* data, quint32 offset) const;
inline quint16 getUShort(const unsigned char* data, quint32 offset) const;
inline int decryptByte(quint32 key2) const;
inline void updateKeys(quint32* keys, int c) const;
inline void initKeys(const QString& pwd, quint32* keys) const;
inline QDateTime convertDateTime(const unsigned char date[2], const unsigned char time[2]) const;
};
#endif // OSDAB_UNZIP_P__H

File diff suppressed because it is too large Load diff

View file

@ -1,115 +1,115 @@
/****************************************************************************
** Filename: zip.h
** Last updated [dd/mm/yyyy]: 01/02/2007
**
** pkzip 2.0 file compression.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
#ifndef OSDAB_ZIP__H
#define OSDAB_ZIP__H
#include <QtGlobal>
#include <QMap>
#include <zlib/zlib.h>
class ZipPrivate;
class QIODevice;
class QFile;
class QDir;
class QStringList;
class QString;
class Zip
{
public:
enum ErrorCode
{
Ok,
ZlibInit,
ZlibError,
FileExists,
OpenFailed,
NoOpenArchive,
FileNotFound,
ReadFailed,
WriteFailed,
SeekFailed
};
enum CompressionLevel
{
Store,
Deflate1 = 1, Deflate2, Deflate3, Deflate4,
Deflate5, Deflate6, Deflate7, Deflate8, Deflate9,
AutoCPU, AutoMIME, AutoFull
};
enum CompressionOption
{
//! Does not preserve absolute paths in the zip file when adding a file/directory (default)
RelativePaths = 0x0001,
//! Preserve absolute paths
AbsolutePaths = 0x0002,
//! Do not store paths. All the files are put in the (evtl. user defined) root of the zip file
IgnorePaths = 0x0004
};
Q_DECLARE_FLAGS(CompressionOptions, CompressionOption)
Zip();
virtual ~Zip();
bool isOpen() const;
void setPassword(const QString& pwd);
void clearPassword();
QString password() const;
ErrorCode createArchive(const QString& file, bool overwrite = true);
ErrorCode createArchive(QIODevice* device);
QString archiveComment() const;
void setArchiveComment(const QString& comment);
ErrorCode addDirectoryContents(const QString& path, CompressionLevel level = AutoFull);
ErrorCode addDirectoryContents(const QString& path, const QString& root, CompressionLevel level = AutoFull);
ErrorCode addDirectory(const QString& path, CompressionOptions options = RelativePaths, CompressionLevel level = AutoFull);
ErrorCode addDirectory(const QString& path, const QString& root, CompressionLevel level = AutoFull);
ErrorCode addDirectory(const QString& path, const QString& root, CompressionOptions options = RelativePaths, CompressionLevel level = AutoFull);
ErrorCode closeArchive();
QString formatError(ErrorCode c) const;
virtual void progress() {}
private:
ZipPrivate* d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Zip::CompressionOptions)
#endif // OSDAB_ZIP__H
/****************************************************************************
** Filename: zip.h
** Last updated [dd/mm/yyyy]: 01/02/2007
**
** pkzip 2.0 file compression.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
#ifndef OSDAB_ZIP__H
#define OSDAB_ZIP__H
#include <QtGlobal>
#include <QMap>
#include <zlib/zlib.h>
class ZipPrivate;
class QIODevice;
class QFile;
class QDir;
class QStringList;
class QString;
class Zip
{
public:
enum ErrorCode
{
Ok,
ZlibInit,
ZlibError,
FileExists,
OpenFailed,
NoOpenArchive,
FileNotFound,
ReadFailed,
WriteFailed,
SeekFailed
};
enum CompressionLevel
{
Store,
Deflate1 = 1, Deflate2, Deflate3, Deflate4,
Deflate5, Deflate6, Deflate7, Deflate8, Deflate9,
AutoCPU, AutoMIME, AutoFull
};
enum CompressionOption
{
//! Does not preserve absolute paths in the zip file when adding a file/directory (default)
RelativePaths = 0x0001,
//! Preserve absolute paths
AbsolutePaths = 0x0002,
//! Do not store paths. All the files are put in the (evtl. user defined) root of the zip file
IgnorePaths = 0x0004
};
Q_DECLARE_FLAGS(CompressionOptions, CompressionOption)
Zip();
virtual ~Zip();
bool isOpen() const;
void setPassword(const QString& pwd);
void clearPassword();
QString password() const;
ErrorCode createArchive(const QString& file, bool overwrite = true);
ErrorCode createArchive(QIODevice* device);
QString archiveComment() const;
void setArchiveComment(const QString& comment);
ErrorCode addDirectoryContents(const QString& path, CompressionLevel level = AutoFull);
ErrorCode addDirectoryContents(const QString& path, const QString& root, CompressionLevel level = AutoFull);
ErrorCode addDirectory(const QString& path, CompressionOptions options = RelativePaths, CompressionLevel level = AutoFull);
ErrorCode addDirectory(const QString& path, const QString& root, CompressionLevel level = AutoFull);
ErrorCode addDirectory(const QString& path, const QString& root, CompressionOptions options = RelativePaths, CompressionLevel level = AutoFull);
ErrorCode closeArchive();
QString formatError(ErrorCode c) const;
virtual void progress() {}
private:
ZipPrivate* d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Zip::CompressionOptions)
#endif // OSDAB_ZIP__H

View file

@ -1,93 +1,93 @@
/****************************************************************************
** Filename: zip_p.h
** Last updated [dd/mm/yyyy]: 28/01/2007
**
** pkzip 2.0 file compression.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Zip/UnZip API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef OSDAB_ZIP_P__H
#define OSDAB_ZIP_P__H
#include "zip.h"
#include "zipentry_p.h"
#include <QtGlobal>
#include <QFileInfo>
/*!
zLib authors suggest using larger buffers (128K or 256K) for (de)compression (especially for inflate())
we use a 256K buffer here - if you want to use this code on a pre-iceage mainframe please change it ;)
*/
#define ZIP_READ_BUFFER (256*1024)
class ZipPrivate
{
public:
ZipPrivate();
virtual ~ZipPrivate();
QMap<QString,ZipEntryP*>* headers;
QIODevice* device;
char buffer1[ZIP_READ_BUFFER];
char buffer2[ZIP_READ_BUFFER];
unsigned char* uBuffer;
const quint32* crcTable;
QString comment;
QString password;
Zip::ErrorCode createArchive(QIODevice* device);
Zip::ErrorCode closeArchive();
void reset();
bool zLibInit();
Zip::ErrorCode createEntry(const QFileInfo& file, const QString& root, Zip::CompressionLevel level);
Zip::CompressionLevel detectCompressionByMime(const QString& ext);
inline void encryptBytes(quint32* keys, char* buffer, qint64 read);
inline void setULong(quint32 v, char* buffer, unsigned int offset);
inline void updateKeys(quint32* keys, int c) const;
inline void initKeys(quint32* keys) const;
inline int decryptByte(quint32 key2) const;
inline QString extractRoot(const QString& p);
};
#endif // OSDAB_ZIP_P__H
/****************************************************************************
** Filename: zip_p.h
** Last updated [dd/mm/yyyy]: 28/01/2007
**
** pkzip 2.0 file compression.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Zip/UnZip API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef OSDAB_ZIP_P__H
#define OSDAB_ZIP_P__H
#include "zip.h"
#include "zipentry_p.h"
#include <QtGlobal>
#include <QFileInfo>
/*!
zLib authors suggest using larger buffers (128K or 256K) for (de)compression (especially for inflate())
we use a 256K buffer here - if you want to use this code on a pre-iceage mainframe please change it ;)
*/
#define ZIP_READ_BUFFER (256*1024)
class ZipPrivate
{
public:
ZipPrivate();
virtual ~ZipPrivate();
QMap<QString,ZipEntryP*>* headers;
QIODevice* device;
char buffer1[ZIP_READ_BUFFER];
char buffer2[ZIP_READ_BUFFER];
unsigned char* uBuffer;
const quint32* crcTable;
QString comment;
QString password;
Zip::ErrorCode createArchive(QIODevice* device);
Zip::ErrorCode closeArchive();
void reset();
bool zLibInit();
Zip::ErrorCode createEntry(const QFileInfo& file, const QString& root, Zip::CompressionLevel level);
Zip::CompressionLevel detectCompressionByMime(const QString& ext);
inline void encryptBytes(quint32* keys, char* buffer, qint64 read);
inline void setULong(quint32 v, char* buffer, unsigned int offset);
inline void updateKeys(quint32* keys, int c) const;
inline void initKeys(quint32* keys) const;
inline int decryptByte(quint32 key2) const;
inline QString extractRoot(const QString& p);
};
#endif // OSDAB_ZIP_P__H

View file

@ -1,78 +1,78 @@
/****************************************************************************
** Filename: ZipEntryP.h
** Last updated [dd/mm/yyyy]: 28/01/2007
**
** Wrapper for a ZIP local header.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Zip/UnZip API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef OSDAB_ZIPENTRY_P__H
#define OSDAB_ZIPENTRY_P__H
#include <QtGlobal>
#include <QString>
class ZipEntryP
{
public:
ZipEntryP()
{
lhOffset = 0;
dataOffset = 0;
gpFlag[0] = gpFlag[1] = 0;
compMethod = 0;
modTime[0] = modTime[1] = 0;
modDate[0] = modDate[1] = 0;
crc = 0;
szComp = szUncomp = 0;
lhEntryChecked = false;
}
quint32 lhOffset; // Offset of the local header record for this entry
quint32 dataOffset; // Offset of the file data for this entry
unsigned char gpFlag[2]; // General purpose flag
quint16 compMethod; // Compression method
unsigned char modTime[2]; // Last modified time
unsigned char modDate[2]; // Last modified date
quint32 crc; // CRC32
quint32 szComp; // Compressed file size
quint32 szUncomp; // Uncompressed file size
QString comment; // File comment
bool lhEntryChecked; // Is true if the local header record for this entry has been parsed
inline bool isEncrypted() const { return gpFlag[0] & 0x01; }
inline bool hasDataDescriptor() const { return gpFlag[0] & 0x08; }
};
#endif // OSDAB_ZIPENTRY_P__H
/****************************************************************************
** Filename: ZipEntryP.h
** Last updated [dd/mm/yyyy]: 28/01/2007
**
** Wrapper for a ZIP local header.
**
** Some of the code has been inspired by other open source projects,
** (mainly Info-Zip and Gilles Vollant's minizip).
** Compression and decompression actually uses the zlib library.
**
** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
**
** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See the file LICENSE.GPL that came with this software distribution or
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
**
**********************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Zip/UnZip API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef OSDAB_ZIPENTRY_P__H
#define OSDAB_ZIPENTRY_P__H
#include <QtGlobal>
#include <QString>
class ZipEntryP
{
public:
ZipEntryP()
{
lhOffset = 0;
dataOffset = 0;
gpFlag[0] = gpFlag[1] = 0;
compMethod = 0;
modTime[0] = modTime[1] = 0;
modDate[0] = modDate[1] = 0;
crc = 0;
szComp = szUncomp = 0;
lhEntryChecked = false;
}
quint32 lhOffset; // Offset of the local header record for this entry
quint32 dataOffset; // Offset of the file data for this entry
unsigned char gpFlag[2]; // General purpose flag
quint16 compMethod; // Compression method
unsigned char modTime[2]; // Last modified time
unsigned char modDate[2]; // Last modified date
quint32 crc; // CRC32
quint32 szComp; // Compressed file size
quint32 szUncomp; // Uncompressed file size
QString comment; // File comment
bool lhEntryChecked; // Is true if the local header record for this entry has been parsed
inline bool isEncrypted() const { return gpFlag[0] & 0x01; }
inline bool hasDataDescriptor() const { return gpFlag[0] & 0x08; }
};
#endif // OSDAB_ZIPENTRY_P__H

View file

@ -1,326 +1,326 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2004 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define deflatePrime z_deflatePrime
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define zError z_zError
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(__OS400__)
# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
# ifdef FAR
# undef FAR
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2004 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define deflatePrime z_deflatePrime
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define zError z_zError
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(__OS400__)
# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
# ifdef FAR
# undef FAR
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

File diff suppressed because it is too large Load diff