fast_excel 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -7
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/examples/example.rb +2 -0
- data/examples/example_date_time.rb +38 -0
- data/fast_excel.gemspec +2 -2
- data/lib/fast_excel/binding/format.rb +17 -0
- data/lib/fast_excel/binding/workbook.rb +39 -17
- data/lib/fast_excel/binding/worksheet.rb +57 -13
- data/lib/fast_excel/binding.rb +7 -7
- data/lib/fast_excel.rb +27 -20
- data/libxlsxwriter/.github/FUNDING.yml +1 -0
- data/libxlsxwriter/.github/ISSUE_TEMPLATE.md +85 -0
- data/libxlsxwriter/.github/PULL_REQUEST_TEMPLATE.md +130 -0
- data/libxlsxwriter/.github/workflows/cmake_actions.yml +48 -0
- data/libxlsxwriter/.github/workflows/code_style.yml +23 -0
- data/libxlsxwriter/.github/workflows/coverity.yml +22 -0
- data/libxlsxwriter/.github/workflows/make_actions.yml +52 -0
- data/libxlsxwriter/.github/workflows/valgrind.yml +23 -0
- data/libxlsxwriter/.github/workflows/windows_build.yml +54 -0
- data/libxlsxwriter/.github/workflows/zig_build.yml +22 -0
- data/libxlsxwriter/.gitignore +16 -1
- data/libxlsxwriter/.indent.pro +24 -0
- data/libxlsxwriter/CMakeLists.txt +156 -56
- data/libxlsxwriter/CONTRIBUTING.md +2 -2
- data/libxlsxwriter/Changes.txt +344 -2
- data/libxlsxwriter/LICENSE.txt +66 -8
- data/libxlsxwriter/Makefile +151 -54
- data/libxlsxwriter/Package.swift +42 -0
- data/libxlsxwriter/Readme.md +4 -2
- data/libxlsxwriter/build.zig +324 -0
- data/libxlsxwriter/build.zig.zon +11 -0
- data/libxlsxwriter/cmake/FindMINIZIP.cmake +3 -3
- data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +6 -0
- data/libxlsxwriter/include/xlsxwriter/app.h +2 -1
- data/libxlsxwriter/include/xlsxwriter/chart.h +236 -32
- data/libxlsxwriter/include/xlsxwriter/chartsheet.h +7 -7
- data/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
- data/libxlsxwriter/include/xlsxwriter/common.h +111 -50
- data/libxlsxwriter/include/xlsxwriter/content_types.h +8 -1
- data/libxlsxwriter/include/xlsxwriter/core.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/drawing.h +11 -20
- data/libxlsxwriter/include/xlsxwriter/format.h +121 -8
- data/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/metadata.h +49 -0
- data/libxlsxwriter/include/xlsxwriter/packager.h +27 -16
- data/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/styles.h +13 -7
- data/libxlsxwriter/include/xlsxwriter/table.h +51 -0
- data/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
- data/libxlsxwriter/include/xlsxwriter/third_party/emyg_dtoa.h +26 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +27 -25
- data/libxlsxwriter/include/xlsxwriter/third_party/md5.h +45 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +155 -153
- data/libxlsxwriter/include/xlsxwriter/utility.h +70 -8
- data/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
- data/libxlsxwriter/include/xlsxwriter/workbook.h +218 -47
- data/libxlsxwriter/include/xlsxwriter/worksheet.h +2770 -241
- data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +12 -8
- data/libxlsxwriter/include/xlsxwriter.h +4 -2
- data/libxlsxwriter/libxlsxwriter.podspec +8 -5
- data/libxlsxwriter/src/Makefile +58 -21
- data/libxlsxwriter/src/app.c +5 -2
- data/libxlsxwriter/src/chart.c +396 -81
- data/libxlsxwriter/src/chartsheet.c +22 -22
- data/libxlsxwriter/src/comment.c +443 -0
- data/libxlsxwriter/src/content_types.c +40 -1
- data/libxlsxwriter/src/core.c +2 -2
- data/libxlsxwriter/src/custom.c +1 -1
- data/libxlsxwriter/src/drawing.c +160 -40
- data/libxlsxwriter/src/format.c +109 -25
- data/libxlsxwriter/src/hash_table.c +1 -1
- data/libxlsxwriter/src/metadata.c +283 -0
- data/libxlsxwriter/src/packager.c +794 -94
- data/libxlsxwriter/src/relationships.c +1 -1
- data/libxlsxwriter/src/shared_strings.c +2 -4
- data/libxlsxwriter/src/styles.c +353 -58
- data/libxlsxwriter/src/table.c +304 -0
- data/libxlsxwriter/src/theme.c +1 -1
- data/libxlsxwriter/src/utility.c +143 -43
- data/libxlsxwriter/src/vml.c +1062 -0
- data/libxlsxwriter/src/workbook.c +567 -77
- data/libxlsxwriter/src/worksheet.c +6668 -1462
- data/libxlsxwriter/src/xmlwriter.c +95 -5
- data/libxlsxwriter/third_party/dtoa/Makefile +42 -0
- data/libxlsxwriter/third_party/dtoa/emyg_dtoa.c +461 -0
- data/libxlsxwriter/third_party/dtoa/emyg_dtoa.h +26 -0
- data/libxlsxwriter/third_party/md5/Makefile +42 -0
- data/libxlsxwriter/third_party/md5/md5.c +291 -0
- data/libxlsxwriter/third_party/md5/md5.h +45 -0
- data/libxlsxwriter/third_party/minizip/Makefile +3 -8
- data/libxlsxwriter/third_party/minizip/Makefile.orig +8 -4
- data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +1 -1
- data/libxlsxwriter/third_party/minizip/configure.ac +1 -1
- data/libxlsxwriter/third_party/minizip/crypt.h +13 -16
- data/libxlsxwriter/third_party/minizip/ioapi.c +31 -57
- data/libxlsxwriter/third_party/minizip/ioapi.h +31 -23
- data/libxlsxwriter/third_party/minizip/iowin32.c +29 -45
- data/libxlsxwriter/third_party/minizip/iowin32.h +4 -4
- data/libxlsxwriter/third_party/minizip/miniunz.c +29 -56
- data/libxlsxwriter/third_party/minizip/minizip.c +38 -49
- data/libxlsxwriter/third_party/minizip/mztools.c +1 -7
- data/libxlsxwriter/third_party/minizip/unzip.c +202 -342
- data/libxlsxwriter/third_party/minizip/unzip.h +74 -74
- data/libxlsxwriter/third_party/minizip/zip.c +165 -218
- data/libxlsxwriter/third_party/minizip/zip.h +164 -154
- data/libxlsxwriter/third_party/tmpfileplus/Makefile +3 -3
- data/libxlsxwriter/version.txt +1 -1
- data/test/auto_width_test.rb +20 -0
- data/test/default_format_test.rb +1 -1
- data/test/validations_test.rb +3 -3
- data/test/worksheet_test.rb +6 -1
- metadata +33 -7
- data/libxlsxwriter/.travis.yml +0 -37
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
|
|
15
15
|
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
|
|
16
16
|
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
|
|
17
|
-
It is used when
|
|
18
|
-
ZIP64 data is
|
|
17
|
+
It is used when recreating zip archive with RAW when deleting items from a zip.
|
|
18
|
+
ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
|
|
19
19
|
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
|
|
20
20
|
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
|
21
21
|
|
|
@@ -25,14 +25,13 @@
|
|
|
25
25
|
#include <stdio.h>
|
|
26
26
|
#include <stdlib.h>
|
|
27
27
|
#include <string.h>
|
|
28
|
+
#include <stdint.h>
|
|
28
29
|
#include <time.h>
|
|
29
30
|
#include "zlib.h"
|
|
30
31
|
#include "zip.h"
|
|
31
32
|
|
|
32
33
|
#ifdef STDC
|
|
33
34
|
# include <stddef.h>
|
|
34
|
-
# include <string.h>
|
|
35
|
-
# include <stdlib.h>
|
|
36
35
|
#endif
|
|
37
36
|
#ifdef NO_ERRNO_H
|
|
38
37
|
extern int errno;
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
/* compile with -Dlocal if your debugger can't find static symbols */
|
|
48
47
|
|
|
49
48
|
#ifndef VERSIONMADEBY
|
|
50
|
-
# define VERSIONMADEBY (0x0) /* platform
|
|
49
|
+
# define VERSIONMADEBY (0x0) /* platform dependent */
|
|
51
50
|
#endif
|
|
52
51
|
|
|
53
52
|
#ifndef Z_BUFSIZE
|
|
@@ -61,9 +60,6 @@
|
|
|
61
60
|
#ifndef ALLOC
|
|
62
61
|
# define ALLOC(size) (malloc(size))
|
|
63
62
|
#endif
|
|
64
|
-
#ifndef TRYFREE
|
|
65
|
-
# define TRYFREE(p) {if (p) free(p);}
|
|
66
|
-
#endif
|
|
67
63
|
|
|
68
64
|
/*
|
|
69
65
|
#define SIZECENTRALDIRITEM (0x2e)
|
|
@@ -116,7 +112,7 @@ typedef struct linkedlist_datablock_internal_s
|
|
|
116
112
|
struct linkedlist_datablock_internal_s* next_datablock;
|
|
117
113
|
uLong avail_in_this_block;
|
|
118
114
|
uLong filled_in_this_block;
|
|
119
|
-
uLong unused; /* for future use and
|
|
115
|
+
uLong unused; /* for future use and alignment */
|
|
120
116
|
unsigned char data[SIZEDATA_INDATABLOCK];
|
|
121
117
|
} linkedlist_datablock_internal;
|
|
122
118
|
|
|
@@ -138,40 +134,40 @@ typedef struct
|
|
|
138
134
|
uInt pos_in_buffered_data; /* last written byte in buffered_data */
|
|
139
135
|
|
|
140
136
|
ZPOS64_T pos_local_header; /* offset of the local header of the file
|
|
141
|
-
|
|
137
|
+
currently writing */
|
|
142
138
|
char* central_header; /* central header data for the current file */
|
|
143
139
|
uLong size_centralExtra;
|
|
144
140
|
uLong size_centralheader; /* size of the central header for cur file */
|
|
145
141
|
uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
|
|
146
142
|
uLong flag; /* flag of the file currently writing */
|
|
147
143
|
|
|
148
|
-
int method; /* compression method of file
|
|
144
|
+
int method; /* compression method of file currently wr.*/
|
|
149
145
|
int raw; /* 1 for directly writing raw data */
|
|
150
146
|
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
|
|
151
147
|
uLong dosDate;
|
|
152
148
|
uLong crc32;
|
|
153
149
|
int encrypt;
|
|
154
|
-
int zip64; /* Add ZIP64
|
|
150
|
+
int zip64; /* Add ZIP64 extended information in the extra field */
|
|
155
151
|
ZPOS64_T pos_zip64extrainfo;
|
|
156
152
|
ZPOS64_T totalCompressedData;
|
|
157
153
|
ZPOS64_T totalUncompressedData;
|
|
158
154
|
#ifndef NOCRYPT
|
|
159
155
|
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
|
|
160
156
|
const z_crc_t* pcrc_32_tab;
|
|
161
|
-
|
|
157
|
+
unsigned crypt_header_size;
|
|
162
158
|
#endif
|
|
163
159
|
} curfile64_info;
|
|
164
160
|
|
|
165
161
|
typedef struct
|
|
166
162
|
{
|
|
167
163
|
zlib_filefunc64_32_def z_filefunc;
|
|
168
|
-
voidpf filestream; /* io
|
|
164
|
+
voidpf filestream; /* io structure of the zipfile */
|
|
169
165
|
linkedlist_data central_dir;/* datablock with central dir in construction*/
|
|
170
166
|
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
|
|
171
|
-
curfile64_info ci; /* info on the file
|
|
167
|
+
curfile64_info ci; /* info on the file currently writing */
|
|
172
168
|
|
|
173
169
|
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
|
|
174
|
-
ZPOS64_T
|
|
170
|
+
ZPOS64_T add_position_when_writing_offset;
|
|
175
171
|
ZPOS64_T number_entry;
|
|
176
172
|
|
|
177
173
|
#ifndef NO_ADDFILEINEXISTINGZIP
|
|
@@ -186,8 +182,7 @@ typedef struct
|
|
|
186
182
|
#include "crypt.h"
|
|
187
183
|
#endif
|
|
188
184
|
|
|
189
|
-
local linkedlist_datablock_internal* allocate_new_datablock()
|
|
190
|
-
{
|
|
185
|
+
local linkedlist_datablock_internal* allocate_new_datablock(void) {
|
|
191
186
|
linkedlist_datablock_internal* ldi;
|
|
192
187
|
ldi = (linkedlist_datablock_internal*)
|
|
193
188
|
ALLOC(sizeof(linkedlist_datablock_internal));
|
|
@@ -200,30 +195,26 @@ local linkedlist_datablock_internal* allocate_new_datablock()
|
|
|
200
195
|
return ldi;
|
|
201
196
|
}
|
|
202
197
|
|
|
203
|
-
local void free_datablock(linkedlist_datablock_internal* ldi)
|
|
204
|
-
{
|
|
198
|
+
local void free_datablock(linkedlist_datablock_internal* ldi) {
|
|
205
199
|
while (ldi!=NULL)
|
|
206
200
|
{
|
|
207
201
|
linkedlist_datablock_internal* ldinext = ldi->next_datablock;
|
|
208
|
-
|
|
202
|
+
free(ldi);
|
|
209
203
|
ldi = ldinext;
|
|
210
204
|
}
|
|
211
205
|
}
|
|
212
206
|
|
|
213
|
-
local void init_linkedlist(linkedlist_data* ll)
|
|
214
|
-
{
|
|
207
|
+
local void init_linkedlist(linkedlist_data* ll) {
|
|
215
208
|
ll->first_block = ll->last_block = NULL;
|
|
216
209
|
}
|
|
217
210
|
|
|
218
|
-
local void free_linkedlist(linkedlist_data* ll)
|
|
219
|
-
{
|
|
211
|
+
local void free_linkedlist(linkedlist_data* ll) {
|
|
220
212
|
free_datablock(ll->first_block);
|
|
221
213
|
ll->first_block = ll->last_block = NULL;
|
|
222
214
|
}
|
|
223
215
|
|
|
224
216
|
|
|
225
|
-
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
|
226
|
-
{
|
|
217
|
+
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) {
|
|
227
218
|
linkedlist_datablock_internal* ldi;
|
|
228
219
|
const unsigned char* from_copy;
|
|
229
220
|
|
|
@@ -238,7 +229,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
|
|
238
229
|
}
|
|
239
230
|
|
|
240
231
|
ldi = ll->last_block;
|
|
241
|
-
from_copy = (unsigned char*)buf;
|
|
232
|
+
from_copy = (const unsigned char*)buf;
|
|
242
233
|
|
|
243
234
|
while (len>0)
|
|
244
235
|
{
|
|
@@ -283,9 +274,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
|
|
283
274
|
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
|
|
284
275
|
*/
|
|
285
276
|
|
|
286
|
-
local int zip64local_putValue
|
|
287
|
-
local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
|
|
288
|
-
{
|
|
277
|
+
local int zip64local_putValue(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) {
|
|
289
278
|
unsigned char buf[8];
|
|
290
279
|
int n;
|
|
291
280
|
for (n = 0; n < nbByte; n++)
|
|
@@ -301,15 +290,13 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
|
301
290
|
}
|
|
302
291
|
}
|
|
303
292
|
|
|
304
|
-
if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
|
|
293
|
+
if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,(uLong)nbByte)!=(uLong)nbByte)
|
|
305
294
|
return ZIP_ERRNO;
|
|
306
295
|
else
|
|
307
296
|
return ZIP_OK;
|
|
308
297
|
}
|
|
309
298
|
|
|
310
|
-
local void zip64local_putValue_inmemory
|
|
311
|
-
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
|
|
312
|
-
{
|
|
299
|
+
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) {
|
|
313
300
|
unsigned char* buf=(unsigned char*)dest;
|
|
314
301
|
int n;
|
|
315
302
|
for (n = 0; n < nbByte; n++) {
|
|
@@ -329,25 +316,21 @@ local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
|
|
|
329
316
|
/****************************************************************************/
|
|
330
317
|
|
|
331
318
|
|
|
332
|
-
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
|
|
333
|
-
{
|
|
319
|
+
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) {
|
|
334
320
|
uLong year = (uLong)ptm->tm_year;
|
|
335
321
|
if (year>=1980)
|
|
336
322
|
year-=1980;
|
|
337
323
|
else if (year>=80)
|
|
338
324
|
year-=80;
|
|
339
325
|
return
|
|
340
|
-
(uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
|
|
341
|
-
((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
|
|
326
|
+
(uLong) (((uLong)(ptm->tm_mday) + (32 * (uLong)(ptm->tm_mon+1)) + (512 * year)) << 16) |
|
|
327
|
+
(((uLong)ptm->tm_sec/2) + (32 * (uLong)ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
|
|
342
328
|
}
|
|
343
329
|
|
|
344
330
|
|
|
345
331
|
/****************************************************************************/
|
|
346
332
|
|
|
347
|
-
local int zip64local_getByte
|
|
348
|
-
|
|
349
|
-
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
|
|
350
|
-
{
|
|
333
|
+
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
|
|
351
334
|
unsigned char c;
|
|
352
335
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
|
|
353
336
|
if (err==1)
|
|
@@ -368,10 +351,7 @@ local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,vo
|
|
|
368
351
|
/* ===========================================================================
|
|
369
352
|
Reads a long in LSB order from the given gz_stream. Sets
|
|
370
353
|
*/
|
|
371
|
-
local int zip64local_getShort
|
|
372
|
-
|
|
373
|
-
local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
|
|
374
|
-
{
|
|
354
|
+
local int zip64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
|
|
375
355
|
uLong x ;
|
|
376
356
|
int i = 0;
|
|
377
357
|
int err;
|
|
@@ -390,10 +370,7 @@ local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
|
390
370
|
return err;
|
|
391
371
|
}
|
|
392
372
|
|
|
393
|
-
local int zip64local_getLong
|
|
394
|
-
|
|
395
|
-
local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
|
|
396
|
-
{
|
|
373
|
+
local int zip64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
|
|
397
374
|
uLong x ;
|
|
398
375
|
int i = 0;
|
|
399
376
|
int err;
|
|
@@ -420,11 +397,8 @@ local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
|
420
397
|
return err;
|
|
421
398
|
}
|
|
422
399
|
|
|
423
|
-
local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
|
|
424
400
|
|
|
425
|
-
|
|
426
|
-
local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
|
|
427
|
-
{
|
|
401
|
+
local int zip64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) {
|
|
428
402
|
ZPOS64_T x;
|
|
429
403
|
int i = 0;
|
|
430
404
|
int err;
|
|
@@ -475,10 +449,7 @@ local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def
|
|
|
475
449
|
Locate the Central directory of a zipfile (at the end, just before
|
|
476
450
|
the global comment)
|
|
477
451
|
*/
|
|
478
|
-
local ZPOS64_T zip64local_SearchCentralDir
|
|
479
|
-
|
|
480
|
-
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
|
481
|
-
{
|
|
452
|
+
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
|
482
453
|
unsigned char* buf;
|
|
483
454
|
ZPOS64_T uSizeFile;
|
|
484
455
|
ZPOS64_T uBackRead;
|
|
@@ -519,19 +490,17 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
|
|
519
490
|
break;
|
|
520
491
|
|
|
521
492
|
for (i=(int)uReadSize-3; (i--)>0;)
|
|
522
|
-
{
|
|
523
493
|
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
|
524
494
|
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
|
|
525
495
|
{
|
|
526
|
-
uPosFound = uReadPos+i;
|
|
496
|
+
uPosFound = uReadPos+(unsigned)i;
|
|
527
497
|
break;
|
|
528
498
|
}
|
|
529
|
-
}
|
|
530
499
|
|
|
531
|
-
|
|
532
|
-
|
|
500
|
+
if (uPosFound!=0)
|
|
501
|
+
break;
|
|
533
502
|
}
|
|
534
|
-
|
|
503
|
+
free(buf);
|
|
535
504
|
return uPosFound;
|
|
536
505
|
}
|
|
537
506
|
|
|
@@ -539,10 +508,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
|
|
539
508
|
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
|
|
540
509
|
the global comment)
|
|
541
510
|
*/
|
|
542
|
-
local ZPOS64_T zip64local_SearchCentralDir64
|
|
543
|
-
|
|
544
|
-
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
|
545
|
-
{
|
|
511
|
+
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
|
546
512
|
unsigned char* buf;
|
|
547
513
|
ZPOS64_T uSizeFile;
|
|
548
514
|
ZPOS64_T uBackRead;
|
|
@@ -588,7 +554,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
|
|
588
554
|
// Signature "0x07064b50" Zip64 end of central directory locater
|
|
589
555
|
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
|
|
590
556
|
{
|
|
591
|
-
uPosFound = uReadPos+i;
|
|
557
|
+
uPosFound = uReadPos+(unsigned)i;
|
|
592
558
|
break;
|
|
593
559
|
}
|
|
594
560
|
}
|
|
@@ -597,7 +563,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
|
|
597
563
|
break;
|
|
598
564
|
}
|
|
599
565
|
|
|
600
|
-
|
|
566
|
+
free(buf);
|
|
601
567
|
if (uPosFound == 0)
|
|
602
568
|
return 0;
|
|
603
569
|
|
|
@@ -639,8 +605,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
|
|
639
605
|
return relativeOffset;
|
|
640
606
|
}
|
|
641
607
|
|
|
642
|
-
int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
|
643
|
-
{
|
|
608
|
+
local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
|
|
644
609
|
int err=ZIP_OK;
|
|
645
610
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
|
646
611
|
|
|
@@ -650,9 +615,9 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
|
|
650
615
|
uLong uL;
|
|
651
616
|
|
|
652
617
|
uLong number_disk; /* number of the current dist, used for
|
|
653
|
-
|
|
618
|
+
spanning ZIP, unsupported, always 0*/
|
|
654
619
|
uLong number_disk_with_CD; /* number the the disk with central dir, used
|
|
655
|
-
for
|
|
620
|
+
for spanning ZIP, unsupported, always 0*/
|
|
656
621
|
ZPOS64_T number_entry;
|
|
657
622
|
ZPOS64_T number_entry_CD; /* total number of entries in
|
|
658
623
|
the central dir
|
|
@@ -809,7 +774,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
|
|
809
774
|
}
|
|
810
775
|
|
|
811
776
|
byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir);
|
|
812
|
-
pziinit->
|
|
777
|
+
pziinit->add_position_when_writing_offset = byte_before_the_zipfile;
|
|
813
778
|
|
|
814
779
|
{
|
|
815
780
|
ZPOS64_T size_central_dir_to_read = size_central_dir;
|
|
@@ -832,7 +797,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
|
|
832
797
|
|
|
833
798
|
size_central_dir_to_read-=read_this;
|
|
834
799
|
}
|
|
835
|
-
|
|
800
|
+
free(buf_read);
|
|
836
801
|
}
|
|
837
802
|
pziinit->begin_pos = byte_before_the_zipfile;
|
|
838
803
|
pziinit->number_entry = number_entry_CD;
|
|
@@ -848,8 +813,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
|
|
848
813
|
|
|
849
814
|
|
|
850
815
|
/************************************************************/
|
|
851
|
-
extern zipFile ZEXPORT zipOpen3
|
|
852
|
-
{
|
|
816
|
+
extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
|
|
853
817
|
zip64_internal ziinit;
|
|
854
818
|
zip64_internal* zi;
|
|
855
819
|
int err=ZIP_OK;
|
|
@@ -877,7 +841,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
|
|
|
877
841
|
ziinit.in_opened_file_inzip = 0;
|
|
878
842
|
ziinit.ci.stream_initialised = 0;
|
|
879
843
|
ziinit.number_entry = 0;
|
|
880
|
-
ziinit.
|
|
844
|
+
ziinit.add_position_when_writing_offset = 0;
|
|
881
845
|
init_linkedlist(&(ziinit.central_dir));
|
|
882
846
|
|
|
883
847
|
|
|
@@ -907,9 +871,9 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
|
|
|
907
871
|
if (err != ZIP_OK)
|
|
908
872
|
{
|
|
909
873
|
# ifndef NO_ADDFILEINEXISTINGZIP
|
|
910
|
-
|
|
874
|
+
free(ziinit.globalcomment);
|
|
911
875
|
# endif /* !NO_ADDFILEINEXISTINGZIP*/
|
|
912
|
-
|
|
876
|
+
free(zi);
|
|
913
877
|
return NULL;
|
|
914
878
|
}
|
|
915
879
|
else
|
|
@@ -919,8 +883,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
|
|
|
919
883
|
}
|
|
920
884
|
}
|
|
921
885
|
|
|
922
|
-
extern zipFile ZEXPORT zipOpen2
|
|
923
|
-
{
|
|
886
|
+
extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) {
|
|
924
887
|
if (pzlib_filefunc32_def != NULL)
|
|
925
888
|
{
|
|
926
889
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
|
@@ -931,8 +894,7 @@ extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* gl
|
|
|
931
894
|
return zipOpen3(pathname, append, globalcomment, NULL);
|
|
932
895
|
}
|
|
933
896
|
|
|
934
|
-
extern zipFile ZEXPORT zipOpen2_64
|
|
935
|
-
{
|
|
897
|
+
extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) {
|
|
936
898
|
if (pzlib_filefunc_def != NULL)
|
|
937
899
|
{
|
|
938
900
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
|
@@ -947,18 +909,15 @@ extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc*
|
|
|
947
909
|
|
|
948
910
|
|
|
949
911
|
|
|
950
|
-
extern zipFile ZEXPORT zipOpen
|
|
951
|
-
{
|
|
912
|
+
extern zipFile ZEXPORT zipOpen(const char* pathname, int append) {
|
|
952
913
|
return zipOpen3((const void*)pathname,append,NULL,NULL);
|
|
953
914
|
}
|
|
954
915
|
|
|
955
|
-
extern zipFile ZEXPORT zipOpen64
|
|
956
|
-
{
|
|
916
|
+
extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) {
|
|
957
917
|
return zipOpen3(pathname,append,NULL,NULL);
|
|
958
918
|
}
|
|
959
919
|
|
|
960
|
-
int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
|
|
961
|
-
{
|
|
920
|
+
local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) {
|
|
962
921
|
/* write the local header */
|
|
963
922
|
int err;
|
|
964
923
|
uInt size_filename = (uInt)strlen(filename);
|
|
@@ -1036,8 +995,8 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex
|
|
|
1036
995
|
// Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
|
|
1037
996
|
zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
|
|
1038
997
|
|
|
1039
|
-
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (
|
|
1040
|
-
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (
|
|
998
|
+
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)HeaderID,2);
|
|
999
|
+
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)DataSize,2);
|
|
1041
1000
|
|
|
1042
1001
|
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
|
|
1043
1002
|
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
|
|
@@ -1054,14 +1013,13 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex
|
|
|
1054
1013
|
It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
|
|
1055
1014
|
unnecessary allocations.
|
|
1056
1015
|
*/
|
|
1057
|
-
extern int ZEXPORT zipOpenNewFileInZip4_64
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
{
|
|
1016
|
+
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
1017
|
+
const void* extrafield_local, uInt size_extrafield_local,
|
|
1018
|
+
const void* extrafield_global, uInt size_extrafield_global,
|
|
1019
|
+
const char* comment, int method, int level, int raw,
|
|
1020
|
+
int windowBits,int memLevel, int strategy,
|
|
1021
|
+
const char* password, uLong crcForCrypting,
|
|
1022
|
+
uLong versionMadeBy, uLong flagBase, int zip64) {
|
|
1065
1023
|
zip64_internal* zi;
|
|
1066
1024
|
uInt size_filename;
|
|
1067
1025
|
uInt size_comment;
|
|
@@ -1069,7 +1027,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
|
|
1069
1027
|
int err = ZIP_OK;
|
|
1070
1028
|
|
|
1071
1029
|
# ifdef NOCRYPT
|
|
1072
|
-
(void)(crcForCrypting);
|
|
1030
|
+
(void) (crcForCrypting);
|
|
1073
1031
|
if (password != NULL)
|
|
1074
1032
|
return ZIP_PARAMERROR;
|
|
1075
1033
|
# endif
|
|
@@ -1085,6 +1043,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
|
|
1085
1043
|
return ZIP_PARAMERROR;
|
|
1086
1044
|
#endif
|
|
1087
1045
|
|
|
1046
|
+
// The filename and comment length must fit in 16 bits.
|
|
1047
|
+
if ((filename!=NULL) && (strlen(filename)>0xffff))
|
|
1048
|
+
return ZIP_PARAMERROR;
|
|
1049
|
+
if ((comment!=NULL) && (strlen(comment)>0xffff))
|
|
1050
|
+
return ZIP_PARAMERROR;
|
|
1051
|
+
// The extra field length must fit in 16 bits. If the member also requires
|
|
1052
|
+
// a Zip64 extra block, that will also need to fit within that 16-bit
|
|
1053
|
+
// length, but that will be checked for later.
|
|
1054
|
+
if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
|
|
1055
|
+
return ZIP_PARAMERROR;
|
|
1056
|
+
|
|
1088
1057
|
zi = (zip64_internal*)file;
|
|
1089
1058
|
|
|
1090
1059
|
if (zi->in_opened_file_inzip == 1)
|
|
@@ -1166,7 +1135,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
|
|
1166
1135
|
if(zi->ci.pos_local_header >= 0xffffffff)
|
|
1167
1136
|
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)0xffffffff,4);
|
|
1168
1137
|
else
|
|
1169
|
-
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->
|
|
1138
|
+
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writing_offset,4);
|
|
1170
1139
|
|
|
1171
1140
|
for (i=0;i<size_filename;i++)
|
|
1172
1141
|
*(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
|
|
@@ -1264,35 +1233,33 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
|
|
1264
1233
|
return err;
|
|
1265
1234
|
}
|
|
1266
1235
|
|
|
1267
|
-
extern int ZEXPORT zipOpenNewFileInZip4
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
password, crcForCrypting, versionMadeBy, flagBase, 0);
|
|
1236
|
+
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
1237
|
+
const void* extrafield_local, uInt size_extrafield_local,
|
|
1238
|
+
const void* extrafield_global, uInt size_extrafield_global,
|
|
1239
|
+
const char* comment, int method, int level, int raw,
|
|
1240
|
+
int windowBits,int memLevel, int strategy,
|
|
1241
|
+
const char* password, uLong crcForCrypting,
|
|
1242
|
+
uLong versionMadeBy, uLong flagBase) {
|
|
1243
|
+
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
|
1244
|
+
extrafield_local, size_extrafield_local,
|
|
1245
|
+
extrafield_global, size_extrafield_global,
|
|
1246
|
+
comment, method, level, raw,
|
|
1247
|
+
windowBits, memLevel, strategy,
|
|
1248
|
+
password, crcForCrypting, versionMadeBy, flagBase, 0);
|
|
1281
1249
|
}
|
|
1282
1250
|
|
|
1283
|
-
extern int ZEXPORT zipOpenNewFileInZip3
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
password, crcForCrypting, VERSIONMADEBY, 0, 0);
|
|
1251
|
+
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
1252
|
+
const void* extrafield_local, uInt size_extrafield_local,
|
|
1253
|
+
const void* extrafield_global, uInt size_extrafield_global,
|
|
1254
|
+
const char* comment, int method, int level, int raw,
|
|
1255
|
+
int windowBits,int memLevel, int strategy,
|
|
1256
|
+
const char* password, uLong crcForCrypting) {
|
|
1257
|
+
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
|
1258
|
+
extrafield_local, size_extrafield_local,
|
|
1259
|
+
extrafield_global, size_extrafield_global,
|
|
1260
|
+
comment, method, level, raw,
|
|
1261
|
+
windowBits, memLevel, strategy,
|
|
1262
|
+
password, crcForCrypting, VERSIONMADEBY, 0, 0);
|
|
1296
1263
|
}
|
|
1297
1264
|
|
|
1298
1265
|
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
@@ -1300,70 +1267,64 @@ extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, c
|
|
|
1300
1267
|
const void* extrafield_global, uInt size_extrafield_global,
|
|
1301
1268
|
const char* comment, int method, int level, int raw,
|
|
1302
1269
|
int windowBits,int memLevel, int strategy,
|
|
1303
|
-
const char* password, uLong crcForCrypting, int zip64)
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
password, crcForCrypting, VERSIONMADEBY, 0, zip64);
|
|
1270
|
+
const char* password, uLong crcForCrypting, int zip64) {
|
|
1271
|
+
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
|
1272
|
+
extrafield_local, size_extrafield_local,
|
|
1273
|
+
extrafield_global, size_extrafield_global,
|
|
1274
|
+
comment, method, level, raw,
|
|
1275
|
+
windowBits, memLevel, strategy,
|
|
1276
|
+
password, crcForCrypting, VERSIONMADEBY, 0, zip64);
|
|
1311
1277
|
}
|
|
1312
1278
|
|
|
1313
1279
|
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
1314
1280
|
const void* extrafield_local, uInt size_extrafield_local,
|
|
1315
1281
|
const void* extrafield_global, uInt size_extrafield_global,
|
|
1316
|
-
const char* comment, int method, int level, int raw)
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
NULL, 0, VERSIONMADEBY, 0, 0);
|
|
1282
|
+
const char* comment, int method, int level, int raw) {
|
|
1283
|
+
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
|
1284
|
+
extrafield_local, size_extrafield_local,
|
|
1285
|
+
extrafield_global, size_extrafield_global,
|
|
1286
|
+
comment, method, level, raw,
|
|
1287
|
+
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
|
1288
|
+
NULL, 0, VERSIONMADEBY, 0, 0);
|
|
1324
1289
|
}
|
|
1325
1290
|
|
|
1326
1291
|
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
NULL, 0, VERSIONMADEBY, 0, zip64);
|
|
1292
|
+
const void* extrafield_local, uInt size_extrafield_local,
|
|
1293
|
+
const void* extrafield_global, uInt size_extrafield_global,
|
|
1294
|
+
const char* comment, int method, int level, int raw, int zip64) {
|
|
1295
|
+
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
|
1296
|
+
extrafield_local, size_extrafield_local,
|
|
1297
|
+
extrafield_global, size_extrafield_global,
|
|
1298
|
+
comment, method, level, raw,
|
|
1299
|
+
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
|
1300
|
+
NULL, 0, VERSIONMADEBY, 0, zip64);
|
|
1337
1301
|
}
|
|
1338
1302
|
|
|
1339
|
-
extern int ZEXPORT zipOpenNewFileInZip64
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
NULL, 0, VERSIONMADEBY, 0, zip64);
|
|
1303
|
+
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
1304
|
+
const void* extrafield_local, uInt size_extrafield_local,
|
|
1305
|
+
const void*extrafield_global, uInt size_extrafield_global,
|
|
1306
|
+
const char* comment, int method, int level, int zip64) {
|
|
1307
|
+
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
|
1308
|
+
extrafield_local, size_extrafield_local,
|
|
1309
|
+
extrafield_global, size_extrafield_global,
|
|
1310
|
+
comment, method, level, 0,
|
|
1311
|
+
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
|
1312
|
+
NULL, 0, VERSIONMADEBY, 0, zip64);
|
|
1350
1313
|
}
|
|
1351
1314
|
|
|
1352
|
-
extern int ZEXPORT zipOpenNewFileInZip
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
NULL, 0, VERSIONMADEBY, 0, 0);
|
|
1315
|
+
extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
|
1316
|
+
const void* extrafield_local, uInt size_extrafield_local,
|
|
1317
|
+
const void*extrafield_global, uInt size_extrafield_global,
|
|
1318
|
+
const char* comment, int method, int level) {
|
|
1319
|
+
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
|
1320
|
+
extrafield_local, size_extrafield_local,
|
|
1321
|
+
extrafield_global, size_extrafield_global,
|
|
1322
|
+
comment, method, level, 0,
|
|
1323
|
+
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
|
1324
|
+
NULL, 0, VERSIONMADEBY, 0, 0);
|
|
1363
1325
|
}
|
|
1364
1326
|
|
|
1365
|
-
local int zip64FlushWriteBuffer(zip64_internal* zi)
|
|
1366
|
-
{
|
|
1327
|
+
local int zip64FlushWriteBuffer(zip64_internal* zi) {
|
|
1367
1328
|
int err=ZIP_OK;
|
|
1368
1329
|
|
|
1369
1330
|
if (zi->ci.encrypt != 0)
|
|
@@ -1401,8 +1362,7 @@ local int zip64FlushWriteBuffer(zip64_internal* zi)
|
|
|
1401
1362
|
return err;
|
|
1402
1363
|
}
|
|
1403
1364
|
|
|
1404
|
-
extern int ZEXPORT zipWriteInFileInZip
|
|
1405
|
-
{
|
|
1365
|
+
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned int len) {
|
|
1406
1366
|
zip64_internal* zi;
|
|
1407
1367
|
int err=ZIP_OK;
|
|
1408
1368
|
|
|
@@ -1452,7 +1412,7 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
|
|
1452
1412
|
else
|
|
1453
1413
|
#endif
|
|
1454
1414
|
{
|
|
1455
|
-
zi->ci.stream.next_in = (Bytef*)buf;
|
|
1415
|
+
zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
|
|
1456
1416
|
zi->ci.stream.avail_in = len;
|
|
1457
1417
|
|
|
1458
1418
|
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
|
|
@@ -1473,11 +1433,6 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
|
|
1473
1433
|
{
|
|
1474
1434
|
uLong uTotalOutBefore = zi->ci.stream.total_out;
|
|
1475
1435
|
err=deflate(&zi->ci.stream, Z_NO_FLUSH);
|
|
1476
|
-
if(uTotalOutBefore > zi->ci.stream.total_out)
|
|
1477
|
-
{
|
|
1478
|
-
int bBreak = 0;
|
|
1479
|
-
bBreak++;
|
|
1480
|
-
}
|
|
1481
1436
|
|
|
1482
1437
|
zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
|
|
1483
1438
|
}
|
|
@@ -1508,17 +1463,15 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
|
|
1508
1463
|
return err;
|
|
1509
1464
|
}
|
|
1510
1465
|
|
|
1511
|
-
extern int ZEXPORT zipCloseFileInZipRaw
|
|
1512
|
-
{
|
|
1466
|
+
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) {
|
|
1513
1467
|
return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
|
|
1514
1468
|
}
|
|
1515
1469
|
|
|
1516
|
-
extern int ZEXPORT zipCloseFileInZipRaw64
|
|
1517
|
-
{
|
|
1470
|
+
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) {
|
|
1518
1471
|
zip64_internal* zi;
|
|
1519
1472
|
ZPOS64_T compressed_size;
|
|
1520
1473
|
uLong invalidValue = 0xffffffff;
|
|
1521
|
-
|
|
1474
|
+
unsigned datasize = 0;
|
|
1522
1475
|
int err=ZIP_OK;
|
|
1523
1476
|
|
|
1524
1477
|
if (file == NULL)
|
|
@@ -1749,15 +1702,13 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
|
|
|
1749
1702
|
return err;
|
|
1750
1703
|
}
|
|
1751
1704
|
|
|
1752
|
-
extern int ZEXPORT zipCloseFileInZip
|
|
1753
|
-
{
|
|
1705
|
+
extern int ZEXPORT zipCloseFileInZip(zipFile file) {
|
|
1754
1706
|
return zipCloseFileInZipRaw (file,0,0);
|
|
1755
1707
|
}
|
|
1756
1708
|
|
|
1757
|
-
int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
|
|
1758
|
-
{
|
|
1709
|
+
local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) {
|
|
1759
1710
|
int err = ZIP_OK;
|
|
1760
|
-
ZPOS64_T pos = zip64eocd_pos_inzip - zi->
|
|
1711
|
+
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
|
|
1761
1712
|
|
|
1762
1713
|
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
|
|
1763
1714
|
|
|
@@ -1776,8 +1727,7 @@ int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eo
|
|
|
1776
1727
|
return err;
|
|
1777
1728
|
}
|
|
1778
1729
|
|
|
1779
|
-
int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
|
1780
|
-
{
|
|
1730
|
+
local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
|
|
1781
1731
|
int err = ZIP_OK;
|
|
1782
1732
|
|
|
1783
1733
|
uLong Zip64DataSize = 44;
|
|
@@ -1810,13 +1760,13 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra
|
|
|
1810
1760
|
|
|
1811
1761
|
if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
|
|
1812
1762
|
{
|
|
1813
|
-
ZPOS64_T pos = centraldir_pos_inzip - zi->
|
|
1763
|
+
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
|
1814
1764
|
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8);
|
|
1815
1765
|
}
|
|
1816
1766
|
return err;
|
|
1817
1767
|
}
|
|
1818
|
-
|
|
1819
|
-
{
|
|
1768
|
+
|
|
1769
|
+
local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
|
|
1820
1770
|
int err = ZIP_OK;
|
|
1821
1771
|
|
|
1822
1772
|
/*signature*/
|
|
@@ -1851,20 +1801,19 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir,
|
|
|
1851
1801
|
|
|
1852
1802
|
if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
|
|
1853
1803
|
{
|
|
1854
|
-
ZPOS64_T pos = centraldir_pos_inzip - zi->
|
|
1804
|
+
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
|
1855
1805
|
if(pos >= 0xffffffff)
|
|
1856
1806
|
{
|
|
1857
1807
|
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4);
|
|
1858
1808
|
}
|
|
1859
1809
|
else
|
|
1860
|
-
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->
|
|
1810
|
+
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writing_offset),4);
|
|
1861
1811
|
}
|
|
1862
1812
|
|
|
1863
1813
|
return err;
|
|
1864
1814
|
}
|
|
1865
1815
|
|
|
1866
|
-
int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
|
1867
|
-
{
|
|
1816
|
+
local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) {
|
|
1868
1817
|
int err = ZIP_OK;
|
|
1869
1818
|
uInt size_global_comment = 0;
|
|
1870
1819
|
|
|
@@ -1881,8 +1830,7 @@ int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
|
|
1881
1830
|
return err;
|
|
1882
1831
|
}
|
|
1883
1832
|
|
|
1884
|
-
extern int ZEXPORT zipClose
|
|
1885
|
-
{
|
|
1833
|
+
extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
|
|
1886
1834
|
zip64_internal* zi;
|
|
1887
1835
|
int err = 0;
|
|
1888
1836
|
uLong size_centraldir = 0;
|
|
@@ -1923,7 +1871,7 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
|
|
1923
1871
|
}
|
|
1924
1872
|
free_linkedlist(&(zi->central_dir));
|
|
1925
1873
|
|
|
1926
|
-
pos = centraldir_pos_inzip - zi->
|
|
1874
|
+
pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
|
1927
1875
|
if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
|
|
1928
1876
|
{
|
|
1929
1877
|
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
|
|
@@ -1943,15 +1891,14 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
|
|
1943
1891
|
err = ZIP_ERRNO;
|
|
1944
1892
|
|
|
1945
1893
|
#ifndef NO_ADDFILEINEXISTINGZIP
|
|
1946
|
-
|
|
1894
|
+
free(zi->globalcomment);
|
|
1947
1895
|
#endif
|
|
1948
|
-
|
|
1896
|
+
free(zi);
|
|
1949
1897
|
|
|
1950
1898
|
return err;
|
|
1951
1899
|
}
|
|
1952
1900
|
|
|
1953
|
-
extern int ZEXPORT zipRemoveExtraInfoBlock
|
|
1954
|
-
{
|
|
1901
|
+
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
|
|
1955
1902
|
char* p = pData;
|
|
1956
1903
|
int size = 0;
|
|
1957
1904
|
char* pNewHeader;
|
|
@@ -1961,10 +1908,10 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
|
|
|
1961
1908
|
|
|
1962
1909
|
int retVal = ZIP_OK;
|
|
1963
1910
|
|
|
1964
|
-
if(pData == NULL || *dataLen < 4)
|
|
1911
|
+
if(pData == NULL || dataLen == NULL || *dataLen < 4)
|
|
1965
1912
|
return ZIP_PARAMERROR;
|
|
1966
1913
|
|
|
1967
|
-
pNewHeader = (char*)ALLOC(*dataLen);
|
|
1914
|
+
pNewHeader = (char*)ALLOC((unsigned)*dataLen);
|
|
1968
1915
|
pTmp = pNewHeader;
|
|
1969
1916
|
|
|
1970
1917
|
while(p < (pData + *dataLen))
|
|
@@ -2003,7 +1950,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
|
|
|
2003
1950
|
else
|
|
2004
1951
|
retVal = ZIP_ERRNO;
|
|
2005
1952
|
|
|
2006
|
-
|
|
1953
|
+
free(pNewHeader);
|
|
2007
1954
|
|
|
2008
1955
|
return retVal;
|
|
2009
1956
|
}
|