Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/include/zipsup.h
5986 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2018 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
/**
24
* @file
25
* @ingroup ZipSupport
26
* @brief Zip Support Header
27
*/
28
29
#ifndef ZIPSUP_H
30
#define ZIPSUP_H
31
32
/* @ddr_namespace: default */
33
#ifdef __cplusplus
34
extern "C" {
35
#endif
36
37
38
/* DO NOT DIRECTLY INCLUDE THIS FILE! */
39
/* Use zip_api.h from the include/ directory instead. */
40
41
42
#include "j9port.h"
43
44
typedef struct J9ZipCachePool J9ZipCachePool;
45
46
#define J9WSRP IDATA
47
48
#define ZIP_INTERNAL_MAX 80
49
#define ZIP_CM_Reduced1 2
50
#define ZIP_Unknown 0
51
#define ZIP_GZIP 2
52
#define ZIP_ERR_OUT_OF_MEMORY -3
53
#define ZIP_ERR_FILE_CORRUPT -6
54
#define ZIP_ERR_INTERNAL_ERROR -11
55
#define ZIP_CM_Imploded 6
56
#define ZIP_CM_Reduced4 5
57
#define ZIP_CM_Shrunk 1
58
#define ZIP_CM_Reduced2 3
59
#define ZIP_ERR_FILE_READ_ERROR -1
60
#define ZIP_CentralHeader 0x2014B50
61
#define ZIP_ERR_FILE_CLOSE_ERROR -10
62
#define ZIP_ERR_BUFFER_TOO_SMALL -7
63
#define ZIP_CM_Reduced3 4
64
#define ZIP_CM_Deflated 8
65
#define ZIP_LocalHeader 0x4034B50
66
#define ZIP_CM_Tokenized 7
67
#define ZIP_PKZIP 1
68
#define ZIP_CM_Stored 0
69
#define ZIP_ERR_UNSUPPORTED_FILE_TYPE -5
70
#define ZIP_ERR_NO_MORE_ENTRIES -2
71
#define ZIP_CentralEnd 0x6054B50
72
#define ZIP_ERR_FILE_OPEN_ERROR -9
73
#define ZIP_ERR_UNKNOWN_FILE_TYPE -4
74
#define ZIP_ERR_ENTRY_NOT_FOUND -8
75
#define ZIP_DataDescriptor 0x8074B50
76
77
typedef struct J9ZipCache {
78
struct J9PortLibrary * portLib;
79
void* cachePool;
80
void* cachePoolEntry;
81
} J9ZipCache;
82
83
typedef struct J9ZipCentralEnd {
84
U_16 diskNumber;
85
U_16 dirStartDisk;
86
U_16 thisDiskEntries;
87
U_16 totalEntries;
88
U_32 dirSize;
89
U_32 dirOffset;
90
U_16 commentLength;
91
U_8* comment;
92
U_64 endCentralDirRecordPosition;
93
} J9ZipCentralEnd;
94
95
typedef struct J9ZipEntry {
96
U_8* data;
97
U_8* filename;
98
U_8* extraField;
99
U_8* fileComment;
100
U_32 dataPointer;
101
U_32 filenamePointer;
102
U_32 extraFieldPointer;
103
I_32 fileCommentPointer;
104
U_32 compressedSize;
105
U_32 uncompressedSize;
106
U_32 crc32;
107
U_16 filenameLength;
108
U_16 extraFieldLength;
109
U_16 fileCommentLength;
110
U_16 internalAttributes;
111
U_16 versionCreated;
112
U_16 versionNeeded;
113
U_16 flags;
114
U_16 compressionMethod;
115
U_16 lastModTime;
116
U_16 lastModDate;
117
U_8 internalFilename[80];
118
} J9ZipEntry;
119
120
typedef struct J9ZipFile {
121
U_8* filename;
122
struct J9ZipCache* cache;
123
void* cachePool;
124
IDATA fd;
125
U_32 pointer;
126
U_8 internalFilename[80];
127
U_8 type;
128
} J9ZipFile;
129
130
typedef struct J9ZipChunkHeader {
131
J9WSRP next;
132
U_8* beginFree;
133
U_8* endFree;
134
} J9ZipChunkHeader;
135
136
#define J9ZIPCHUNKHEADER_NEXT(base) WSRP_GET((base)->next, struct J9ZipChunkHeader*)
137
138
typedef struct J9ZipFileEntry {
139
UDATA nameLength;
140
UDATA zipFileOffset;
141
} J9ZipFileEntry;
142
143
typedef struct J9ZipFileRecord {
144
J9WSRP next;
145
UDATA entryCount;
146
struct J9ZipFileEntry entry[1];
147
} J9ZipFileRecord;
148
149
#define J9ZIPFILERECORD_NEXT(base) WSRP_GET((base)->next, struct J9ZipFileRecord*)
150
151
typedef struct J9ZipDirEntry {
152
J9WSRP next;
153
J9WSRP fileList;
154
J9WSRP dirList;
155
UDATA zipFileOffset;
156
} J9ZipDirEntry;
157
158
#define J9ZIPDIRENTRY_NEXT(base) WSRP_GET((base)->next, struct J9ZipDirEntry*)
159
#define J9ZIPDIRENTRY_FILELIST(base) WSRP_GET((base)->fileList, struct J9ZipFileRecord*)
160
#define J9ZIPDIRENTRY_DIRLIST(base) WSRP_GET((base)->dirList, struct J9ZipDirEntry*)
161
162
typedef struct J9ZipCacheEntry {
163
J9WSRP zipFileName;
164
IDATA zipFileSize;
165
I_64 zipTimeStamp;
166
IDATA startCentralDir;
167
J9WSRP currentChunk;
168
J9WSRP chunkActiveDir;
169
struct J9ZipDirEntry root;
170
} J9ZipCacheEntry;
171
172
#define J9ZIPCACHEENTRY_ZIPFILENAME(base) WSRP_GET((base)->zipFileName, U_8*)
173
#define J9ZIPCACHEENTRY_CURRENTCHUNK(base) WSRP_GET((base)->currentChunk, struct J9ZipChunkHeader*)
174
#define J9ZIPCACHEENTRY_CHUNKACTIVEDIR(base) WSRP_GET((base)->chunkActiveDir, struct J9ZipDirEntry*)
175
#define J9ZIPCACHEENTRY_NEXT(base) WSRP_GET((&((base)->root))->next, struct J9ZipDirEntry*)
176
#define J9ZIPCACHEENTRY_FILELIST(base) WSRP_GET((&((base)->root))->fileList, struct J9ZipFileRecord*)
177
#define J9ZIPCACHEENTRY_DIRLIST(base) WSRP_GET((&((base)->root))->dirList, struct J9ZipDirEntry*)
178
179
#undef J9WSRP
180
181
#ifdef __cplusplus
182
}
183
#endif
184
185
#endif /* ZIPSUP_H */
186
187