FGx
1
src
utilities
osdab
zip_p.h
1
/****************************************************************************
2
** Filename: zip_p.h
3
** Last updated [dd/mm/yyyy]: 27/03/2011
4
**
5
** pkzip 2.0 file compression.
6
**
7
** Some of the code has been inspired by other open source projects,
8
** (mainly Info-Zip and Gilles Vollant's minizip).
9
** Compression and decompression actually uses the zlib library.
10
**
11
** Copyright (C) 2007-2011 Angius Fabrizio. All rights reserved.
12
**
13
** This file is part of the OSDaB project (http://osdab.42cows.org/).
14
**
15
** This file may be distributed and/or modified under the terms of the
16
** GNU General Public License version 2 as published by the Free Software
17
** Foundation and appearing in the file LICENSE.GPL included in the
18
** packaging of this file.
19
**
20
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22
**
23
** See the file LICENSE.GPL that came with this software distribution or
24
** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
25
**
26
**********************************************************************/
27
28
//
29
// W A R N I N G
30
// -------------
31
//
32
// This file is not part of the Zip/UnZip API. It exists purely as an
33
// implementation detail. This header file may change from version to
34
// version without notice, or even be removed.
35
//
36
// We mean it.
37
//
38
39
#ifndef OSDAB_ZIP_P__H
40
#define OSDAB_ZIP_P__H
41
42
#include "zip.h"
43
#include "zipentry_p.h"
44
45
#include <QtCore/QFileInfo>
46
#include <QtCore/QObject>
47
#include <QtCore/QtGlobal>
48
53
#define ZIP_READ_BUFFER (256*1024)
54
55
OSDAB_BEGIN_NAMESPACE(
Zip
)
56
57
class
ZipPrivate
: public QObject
58
{
59
Q_OBJECT
60
61
public
:
62
ZipPrivate
();
63
virtual
~
ZipPrivate
();
64
65
QMap<QString,ZipEntryP*>* headers;
66
67
QIODevice* device;
68
QFile* file;
69
70
char
buffer1[ZIP_READ_BUFFER];
71
char
buffer2[ZIP_READ_BUFFER];
72
73
unsigned
char
* uBuffer;
74
75
const
quint32* crcTable;
76
77
QString comment;
78
QString password;
79
80
Zip::ErrorCode
createArchive(QIODevice* device);
81
Zip::ErrorCode
closeArchive();
82
void
reset();
83
84
bool
zLibInit();
85
86
Zip::ErrorCode
createEntry(
const
QFileInfo& file,
const
QString& root,
Zip::CompressionLevel
level);
87
Zip::CompressionLevel
detectCompressionByMime(
const
QString& ext);
88
89
inline
void
encryptBytes(quint32* keys,
char
* buffer, qint64 read);
90
91
inline
void
setULong(quint32 v,
char
* buffer,
unsigned
int
offset);
92
inline
void
updateKeys(quint32* keys,
int
c)
const
;
93
inline
void
initKeys(quint32* keys)
const
;
94
inline
int
decryptByte(quint32 key2)
const
;
95
96
inline
QString extractRoot(
const
QString& p);
97
98
private
slots:
99
void
deviceDestroyed(QObject*);
100
101
private
:
102
Zip::ErrorCode
do_closeArchive();
103
Zip::ErrorCode
writeEntry(
const
QString& fileName,
const
ZipEntryP
* h, quint32& szCentralDir);
104
Zip::ErrorCode
writeCentralDir(quint32 offCentralDir, quint32 szCentralDir);
105
};
106
107
OSDAB_END_NAMESPACE
108
109
#endif // OSDAB_ZIP_P__H
Zip
Zip file compression.
Definition:
zip.h:48
ZipEntryP
Definition:
zipentry_p.h:47
Zip::ErrorCode
ErrorCode
Definition:
zip.h:51
ZipPrivate
Definition:
zip_p.h:57
Zip::CompressionLevel
CompressionLevel
Definition:
zip.h:65
Generated on Thu Feb 13 2020 01:10:59 for FGx by
1.8.17