summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/zip/unzip_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/zip/unzip_p.h')
-rw-r--r--rbutil/rbutilqt/zip/unzip_p.h224
1 files changed, 112 insertions, 112 deletions
diff --git a/rbutil/rbutilqt/zip/unzip_p.h b/rbutil/rbutilqt/zip/unzip_p.h
index c05ac67b47..c0ea11b7bf 100644
--- a/rbutil/rbutilqt/zip/unzip_p.h
+++ b/rbutil/rbutilqt/zip/unzip_p.h
@@ -1,112 +1,112 @@
1/**************************************************************************** 1/****************************************************************************
2** Filename: unzip_p.h 2** Filename: unzip_p.h
3** Last updated [dd/mm/yyyy]: 28/01/2007 3** Last updated [dd/mm/yyyy]: 28/01/2007
4** 4**
5** pkzip 2.0 decompression. 5** pkzip 2.0 decompression.
6** 6**
7** Some of the code has been inspired by other open source projects, 7** Some of the code has been inspired by other open source projects,
8** (mainly Info-Zip and Gilles Vollant's minizip). 8** (mainly Info-Zip and Gilles Vollant's minizip).
9** Compression and decompression actually uses the zlib library. 9** Compression and decompression actually uses the zlib library.
10** 10**
11** Copyright (C) 2007 Angius Fabrizio. All rights reserved. 11** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
12** 12**
13** This file is part of the OSDaB project (http://osdab.sourceforge.net/). 13** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
14** 14**
15** This file may be distributed and/or modified under the terms of the 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 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 17** Foundation and appearing in the file LICENSE.GPL included in the
18** packaging of this file. 18** packaging of this file.
19** 19**
20** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 21** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22** 22**
23** See the file LICENSE.GPL that came with this software distribution or 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. 24** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
25** 25**
26**********************************************************************/ 26**********************************************************************/
27 27
28// 28//
29// W A R N I N G 29// W A R N I N G
30// ------------- 30// -------------
31// 31//
32// This file is not part of the Zip/UnZip API. It exists purely as an 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 33// implementation detail. This header file may change from version to
34// version without notice, or even be removed. 34// version without notice, or even be removed.
35// 35//
36// We mean it. 36// We mean it.
37// 37//
38 38
39#ifndef OSDAB_UNZIP_P__H 39#ifndef OSDAB_UNZIP_P__H
40#define OSDAB_UNZIP_P__H 40#define OSDAB_UNZIP_P__H
41 41
42#include "unzip.h" 42#include "unzip.h"
43#include "zipentry_p.h" 43#include "zipentry_p.h"
44 44
45#include <QtGlobal> 45#include <QtGlobal>
46 46
47// zLib authors suggest using larger buffers (128K or 256K) for (de)compression (especially for inflate()) 47// zLib authors suggest using larger buffers (128K or 256K) for (de)compression (especially for inflate())
48// we use a 256K buffer here - if you want to use this code on a pre-iceage mainframe please change it ;) 48// we use a 256K buffer here - if you want to use this code on a pre-iceage mainframe please change it ;)
49#define UNZIP_READ_BUFFER (256*1024) 49#define UNZIP_READ_BUFFER (256*1024)
50 50
51class UnzipPrivate 51class UnzipPrivate
52{ 52{
53public: 53public:
54 UnzipPrivate(); 54 UnzipPrivate();
55 55
56 // Replace this with whatever else you use to store/retrieve the password. 56 // Replace this with whatever else you use to store/retrieve the password.
57 QString password; 57 QString password;
58 58
59 bool skipAllEncrypted; 59 bool skipAllEncrypted;
60 60
61 QMap<QString,ZipEntryP*>* headers; 61 QMap<QString,ZipEntryP*>* headers;
62 62
63 QIODevice* device; 63 QIODevice* device;
64 64
65 char buffer1[UNZIP_READ_BUFFER]; 65 char buffer1[UNZIP_READ_BUFFER];
66 char buffer2[UNZIP_READ_BUFFER]; 66 char buffer2[UNZIP_READ_BUFFER];
67 67
68 unsigned char* uBuffer; 68 unsigned char* uBuffer;
69 const quint32* crcTable; 69 const quint32* crcTable;
70 70
71 // Central Directory (CD) offset 71 // Central Directory (CD) offset
72 quint32 cdOffset; 72 quint32 cdOffset;
73 // End of Central Directory (EOCD) offset 73 // End of Central Directory (EOCD) offset
74 quint32 eocdOffset; 74 quint32 eocdOffset;
75 75
76 // Number of entries in the Central Directory (as to the EOCD record) 76 // Number of entries in the Central Directory (as to the EOCD record)
77 quint16 cdEntryCount; 77 quint16 cdEntryCount;
78 78
79 // The number of detected entries that have been skipped because of a non compatible format 79 // The number of detected entries that have been skipped because of a non compatible format
80 quint16 unsupportedEntryCount; 80 quint16 unsupportedEntryCount;
81 81
82 QString comment; 82 QString comment;
83 83
84 UnZip::ErrorCode openArchive(QIODevice* device); 84 UnZip::ErrorCode openArchive(QIODevice* device);
85 85
86 UnZip::ErrorCode seekToCentralDirectory(); 86 UnZip::ErrorCode seekToCentralDirectory();
87 UnZip::ErrorCode parseCentralDirectoryRecord(); 87 UnZip::ErrorCode parseCentralDirectoryRecord();
88 UnZip::ErrorCode parseLocalHeaderRecord(const QString& path, ZipEntryP& entry); 88 UnZip::ErrorCode parseLocalHeaderRecord(const QString& path, ZipEntryP& entry);
89 89
90 void closeArchive(); 90 void closeArchive();
91 91
92 UnZip::ErrorCode extractFile(const QString& path, ZipEntryP& entry, const QDir& dir, UnZip::ExtractionOptions options); 92 UnZip::ErrorCode extractFile(const QString& path, ZipEntryP& entry, const QDir& dir, UnZip::ExtractionOptions options);
93 UnZip::ErrorCode extractFile(const QString& path, ZipEntryP& entry, QIODevice* device, UnZip::ExtractionOptions options); 93 UnZip::ErrorCode extractFile(const QString& path, ZipEntryP& entry, QIODevice* device, UnZip::ExtractionOptions options);
94 94
95 UnZip::ErrorCode testPassword(quint32* keys, const QString& file, const ZipEntryP& header); 95 UnZip::ErrorCode testPassword(quint32* keys, const QString& file, const ZipEntryP& header);
96 bool testKeys(const ZipEntryP& header, quint32* keys); 96 bool testKeys(const ZipEntryP& header, quint32* keys);
97 97
98 bool createDirectory(const QString& path); 98 bool createDirectory(const QString& path);
99 99
100 inline void decryptBytes(quint32* keys, char* buffer, qint64 read); 100 inline void decryptBytes(quint32* keys, char* buffer, qint64 read);
101 101
102 inline quint32 getULong(const unsigned char* data, quint32 offset) const; 102 inline quint32 getULong(const unsigned char* data, quint32 offset) const;
103 inline quint64 getULLong(const unsigned char* data, quint32 offset) const; 103 inline quint64 getULLong(const unsigned char* data, quint32 offset) const;
104 inline quint16 getUShort(const unsigned char* data, quint32 offset) const; 104 inline quint16 getUShort(const unsigned char* data, quint32 offset) const;
105 inline int decryptByte(quint32 key2) const; 105 inline int decryptByte(quint32 key2) const;
106 inline void updateKeys(quint32* keys, int c) const; 106 inline void updateKeys(quint32* keys, int c) const;
107 inline void initKeys(const QString& pwd, quint32* keys) const; 107 inline void initKeys(const QString& pwd, quint32* keys) const;
108 108
109 inline QDateTime convertDateTime(const unsigned char date[2], const unsigned char time[2]) const; 109 inline QDateTime convertDateTime(const unsigned char date[2], const unsigned char time[2]) const;
110}; 110};
111 111
112#endif // OSDAB_UNZIP_P__H 112#endif // OSDAB_UNZIP_P__H