50 # define VERSIONMADEBY (0x0) 54 #define Z_BUFSIZE (64*1024) //(16384) 57 #ifndef Z_MAXFILENAMEINZIP 58 #define Z_MAXFILENAMEINZIP (256) 62 # define ALLOC(size) (malloc(size)) 65 # define TRYFREE(p) {if (p) free(p);} 77 #define MAKEULONG64(a, b) ((ZPOS64_T)(((unsigned long)(a)) | ((ZPOS64_T)((unsigned long)(b))) << 32)) 92 #if MAX_MEM_LEVEL >= 8 93 # define DEF_MEM_LEVEL 8 95 # define DEF_MEM_LEVEL MAX_MEM_LEVEL 98 const char zip_copyright[] =
" zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
101 #define SIZEDATA_INDATABLOCK (4096-(4*4)) 103 #define LOCALHEADERMAGIC (0x04034b50) 104 #define CENTRALHEADERMAGIC (0x02014b50) 105 #define ENDHEADERMAGIC (0x06054b50) 106 #define ZIP64ENDHEADERMAGIC (0x6064b50) 107 #define ZIP64ENDLOCHEADERMAGIC (0x7064b50) 109 #define FLAG_LOCALHEADER_OFFSET (0x06) 110 #define CRC_LOCALHEADER_OFFSET (0x0e) 112 #define SIZECENTRALHEADER (0x2e) 114 typedef struct linkedlist_datablock_internal_s
116 struct linkedlist_datablock_internal_s* next_datablock;
117 uLong avail_in_this_block;
118 uLong filled_in_this_block;
123 typedef struct linkedlist_data_s
137 int stream_initialised;
138 uInt pos_in_buffered_data;
142 char* central_header;
143 uLong size_centralExtra;
144 uLong size_centralheader;
145 uLong size_centralExtraFree;
159 unsigned long keys[3];
161 int crypt_header_size;
170 int in_opened_file_inzip;
174 ZPOS64_T add_position_when_writting_offset;
177 #ifndef NO_ADDFILEINEXISTINGZIP 185 #define INCLUDECRYPTINGCODE_IFCRYPTALLOWED 196 ldi->next_datablock =
NULL ;
197 ldi->filled_in_this_block = 0 ;
215 ll->first_block = ll->last_block =
NULL;
221 ll->first_block = ll->last_block =
NULL;
228 const unsigned char* from_copy;
233 if (ll->last_block ==
NULL)
236 if (ll->first_block ==
NULL)
240 ldi = ll->last_block;
241 from_copy = (
unsigned char*)buf;
247 unsigned char* to_copy;
249 if (ldi->avail_in_this_block==0)
252 if (ldi->next_datablock ==
NULL)
254 ldi = ldi->next_datablock ;
255 ll->last_block = ldi;
258 if (ldi->avail_in_this_block < len)
259 copy_this = (
uInt)ldi->avail_in_this_block;
263 to_copy = &(ldi->data[ldi->filled_in_this_block]);
265 for (i=0;i<copy_this;i++)
266 *(to_copy+i)=*(from_copy+
i);
268 ldi->filled_in_this_block += copy_this;
269 ldi->avail_in_this_block -= copy_this;
270 from_copy += copy_this ;
280 #ifndef NO_ADDFILEINEXISTINGZIP 289 unsigned char buf[8];
291 for (n = 0; n < nbByte; n++)
293 buf[
n] = (
unsigned char)(x & 0xff);
298 for (n = 0; n < nbByte; n++)
304 if (
ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(
uLong)nbByte)
313 unsigned char*
buf=(
unsigned char*)dest;
315 for (n = 0; n < nbByte; n++) {
316 buf[
n] = (
unsigned char)(x & 0xff);
322 for (n = 0; n < nbByte; n++)
352 int err = (
int)
ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
360 if (
ZERROR64(*pzlib_filefunc_def,filestream))
471 #ifndef BUFREADCOMMENT 472 #define BUFREADCOMMENT (0x400) 492 uSizeFile =
ZTELL64(*pzlib_filefunc_def,filestream);
494 if (uMaxBack>uSizeFile)
495 uMaxBack = uSizeFile;
502 while (uBackRead<uMaxBack)
508 uBackRead = uMaxBack;
511 uReadPos = uSizeFile-uBackRead ;
518 if (
ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
521 for (i=(
int)uReadSize-3; (i--)>0;)
522 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
523 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
525 uPosFound = uReadPos+
i;
555 uSizeFile =
ZTELL64(*pzlib_filefunc_def,filestream);
557 if (uMaxBack>uSizeFile)
558 uMaxBack = uSizeFile;
565 while (uBackRead<uMaxBack)
571 uBackRead = uMaxBack;
574 uReadPos = uSizeFile-uBackRead ;
581 if (
ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
584 for (i=(
int)uReadSize-3; (i--)>0;)
587 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
589 uPosFound = uReadPos+
i;
634 if (uL != 0x06064b50)
637 return relativeOffset;
652 uLong number_disk_with_CD;
662 int hasZIP64Record = 0;
670 else if(central_pos == 0)
718 if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0))
764 number_entry_CD = uL;
766 if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0))
770 size_central_dir = 0;
774 size_central_dir = uL;
777 offset_central_dir = 0;
781 offset_central_dir = uL;
789 if ((central_pos<offset_central_dir+size_central_dir) &&
795 ZCLOSE64(pziinit->z_filefunc, pziinit->filestream);
801 pziinit->globalcomment = (
char*)
ALLOC(size_comment+1);
802 if (pziinit->globalcomment)
804 size_comment =
ZREAD64(pziinit->z_filefunc, pziinit->filestream, pziinit->globalcomment,size_comment);
805 pziinit->globalcomment[size_comment]=0;
809 byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir);
810 pziinit->add_position_when_writting_offset = byte_before_the_zipfile;
813 ZPOS64_T size_central_dir_to_read = size_central_dir;
815 void* buf_read = (
void*)
ALLOC(buf_size);
819 while ((size_central_dir_to_read>0) && (err==
ZIP_OK))
822 if (read_this > size_central_dir_to_read)
823 read_this = size_central_dir_to_read;
825 if (
ZREAD64(pziinit->z_filefunc, pziinit->filestream,buf_read,(
uLong)read_this) != read_this)
831 size_central_dir_to_read-=read_this;
835 pziinit->begin_pos = byte_before_the_zipfile;
836 pziinit->number_entry = number_entry_CD;
851 zip64_internal ziinit;
855 ziinit.z_filefunc.zseek32_file =
NULL;
856 ziinit.z_filefunc.ztell32_file =
NULL;
857 if (pzlib_filefunc64_32_def==
NULL)
860 ziinit.z_filefunc = *pzlib_filefunc64_32_def;
862 ziinit.filestream =
ZOPEN64(ziinit.z_filefunc,
868 if (ziinit.filestream ==
NULL)
874 ziinit.begin_pos =
ZTELL64(ziinit.z_filefunc,ziinit.filestream);
875 ziinit.in_opened_file_inzip = 0;
876 ziinit.ci.stream_initialised = 0;
877 ziinit.number_entry = 0;
878 ziinit.add_position_when_writting_offset = 0;
883 zi = (zip64_internal*)
ALLOC(
sizeof(zip64_internal));
886 ZCLOSE64(ziinit.z_filefunc,ziinit.filestream);
891 # ifndef NO_ADDFILEINEXISTINGZIP 892 ziinit.globalcomment =
NULL;
901 *globalcomment = ziinit.globalcomment;
907 # ifndef NO_ADDFILEINEXISTINGZIP 922 if (pzlib_filefunc32_def !=
NULL)
926 return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);
934 if (pzlib_filefunc_def !=
NULL)
937 zlib_filefunc64_32_def_fill.
zfile_func64 = *pzlib_filefunc_def;
940 return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);
962 uInt size_filename = (
uInt)strlen(filename);
963 uInt size_extrafield = size_extrafield_local;
1007 size_extrafield += 20;
1013 if ((err==
ZIP_OK) && (size_filename > 0))
1015 if (
ZWRITE64(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename)
1019 if ((err==
ZIP_OK) && (size_extrafield_local > 0))
1021 if (
ZWRITE64(zi->z_filefunc, zi->filestream, extrafield_local, size_extrafield_local) != size_extrafield_local)
1026 if ((err==
ZIP_OK) && (zi->ci.zip64))
1030 short DataSize = 16;
1035 zi->ci.pos_zip64extrainfo =
ZTELL64(zi->z_filefunc,zi->filestream);
1056 const void* extrafield_local,
uInt size_extrafield_local,
1057 const void* extrafield_global,
uInt size_extrafield_global,
1058 const char* comment,
int method,
int level,
int raw,
1061 uLong versionMadeBy,
uLong flagBase,
int zip64)
1071 if (password !=
NULL)
1086 zi = (zip64_internal*)file;
1088 if (zi->in_opened_file_inzip == 1)
1101 size_comment = (
uInt)strlen(comment);
1103 size_filename = (
uInt)strlen(filename);
1110 zi->ci.dosDate = zipfi->
dosDate;
1115 zi->ci.flag = flagBase;
1116 if ((level==8) || (level==9))
1122 if (password !=
NULL)
1128 zi->ci.stream_initialised = 0;
1129 zi->ci.pos_in_buffered_data = 0;
1131 zi->ci.pos_local_header =
ZTELL64(zi->z_filefunc,zi->filestream);
1133 zi->ci.size_centralheader =
SIZECENTRALHEADER + size_filename + size_extrafield_global + size_comment;
1134 zi->ci.size_centralExtraFree = 32;
1136 zi->ci.central_header = (
char*)
ALLOC((
uInt)zi->ci.size_centralheader + zi->ci.size_centralExtraFree);
1138 zi->ci.size_centralExtra = size_extrafield_global;
1164 if(zi->ci.pos_local_header >= 0xffffffff)
1169 for (i=0;i<size_filename;i++)
1172 for (i=0;i<size_extrafield_global;i++)
1174 *(((
const char*)extrafield_global)+
i);
1176 for (i=0;i<size_comment;i++)
1178 size_extrafield_global+i) = *(comment+
i);
1179 if (zi->ci.central_header ==
NULL)
1182 zi->ci.zip64 = zip64;
1183 zi->ci.totalCompressedData = 0;
1184 zi->ci.totalUncompressedData = 0;
1185 zi->ci.pos_zip64extrainfo = 0;
1190 zi->ci.bstream.avail_in = (
uInt)0;
1192 zi->ci.bstream.next_out = (
char*)zi->ci.buffered_data;
1193 zi->ci.bstream.total_in_hi32 = 0;
1194 zi->ci.bstream.total_in_lo32 = 0;
1195 zi->ci.bstream.total_out_hi32 = 0;
1196 zi->ci.bstream.total_out_lo32 = 0;
1199 zi->ci.stream.avail_in = (
uInt)0;
1201 zi->ci.stream.next_out = zi->ci.buffered_data;
1202 zi->ci.stream.total_in = 0;
1203 zi->ci.stream.total_out = 0;
1204 zi->ci.stream.data_type =
Z_BINARY;
1214 zi->ci.stream.zalloc = (alloc_func)0;
1215 zi->ci.stream.zfree = (free_func)0;
1216 zi->ci.stream.opaque = (
voidpf)0;
1230 zi->ci.bstream.bzalloc = 0;
1231 zi->ci.bstream.bzfree = 0;
1232 zi->ci.bstream.opaque = (
voidpf)0;
1234 err = BZ2_bzCompressInit(&zi->ci.bstream, level, 0,35);
1243 zi->ci.crypt_header_size = 0;
1244 if ((err==
Z_OK) && (password !=
NULL))
1246 unsigned char bufHead[RAND_HEAD_LEN];
1247 unsigned int sizeHead;
1252 sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting);
1253 zi->ci.crypt_header_size = sizeHead;
1255 if (
ZWRITE64(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead)
1261 zi->in_opened_file_inzip = 1;
1266 const void* extrafield_local,
uInt size_extrafield_local,
1267 const void* extrafield_global,
uInt size_extrafield_global,
1268 const char* comment,
int method,
int level,
int raw,
1274 extrafield_local, size_extrafield_local,
1275 extrafield_global, size_extrafield_global,
1276 comment, method, level, raw,
1277 windowBits, memLevel, strategy,
1278 password, crcForCrypting, versionMadeBy, flagBase, 0);
1282 const void* extrafield_local,
uInt size_extrafield_local,
1283 const void* extrafield_global,
uInt size_extrafield_global,
1284 const char* comment,
int method,
int level,
int raw,
1289 extrafield_local, size_extrafield_local,
1290 extrafield_global, size_extrafield_global,
1291 comment, method, level, raw,
1292 windowBits, memLevel, strategy,
1297 const void* extrafield_local,
uInt size_extrafield_local,
1298 const void* extrafield_global,
uInt size_extrafield_global,
1299 const char* comment,
int method,
int level,
int raw,
1304 extrafield_local, size_extrafield_local,
1305 extrafield_global, size_extrafield_global,
1306 comment, method, level, raw,
1307 windowBits, memLevel, strategy,
1312 const void* extrafield_local,
uInt size_extrafield_local,
1313 const void* extrafield_global,
uInt size_extrafield_global,
1314 const char* comment,
int method,
int level,
int raw)
1317 extrafield_local, size_extrafield_local,
1318 extrafield_global, size_extrafield_global,
1319 comment, method, level, raw,
1325 const void* extrafield_local,
uInt size_extrafield_local,
1326 const void* extrafield_global,
uInt size_extrafield_global,
1327 const char* comment,
int method,
int level,
int raw,
int zip64)
1330 extrafield_local, size_extrafield_local,
1331 extrafield_global, size_extrafield_global,
1332 comment, method, level, raw,
1338 const void* extrafield_local,
uInt size_extrafield_local,
1339 const void*extrafield_global,
uInt size_extrafield_global,
1340 const char* comment,
int method,
int level,
int zip64)
1343 extrafield_local, size_extrafield_local,
1344 extrafield_global, size_extrafield_global,
1345 comment, method, level, 0,
1351 const void* extrafield_local,
uInt size_extrafield_local,
1352 const void*extrafield_global,
uInt size_extrafield_global,
1356 extrafield_local, size_extrafield_local,
1357 extrafield_global, size_extrafield_global,
1358 comment, method, level, 0,
1367 if (zi->ci.encrypt != 0)
1372 for (i=0;i<zi->ci.pos_in_buffered_data;i++)
1373 zi->ci.buffered_data[i] =
zencode(zi->ci.keys, zi->ci.pcrc_32_tab, zi->ci.buffered_data[i],t);
1377 if (
ZWRITE64(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data) != zi->ci.pos_in_buffered_data)
1380 zi->ci.totalCompressedData += zi->ci.pos_in_buffered_data;
1385 zi->ci.totalUncompressedData += zi->ci.bstream.total_in_lo32;
1386 zi->ci.bstream.total_in_lo32 = 0;
1387 zi->ci.bstream.total_in_hi32 = 0;
1392 zi->ci.totalUncompressedData += zi->ci.stream.total_in;
1393 zi->ci.stream.total_in = 0;
1397 zi->ci.pos_in_buffered_data = 0;
1409 zi = (zip64_internal*)file;
1411 if (zi->in_opened_file_inzip == 0)
1414 zi->ci.crc32 =
crc32(zi->ci.crc32,buf,(
uInt)len);
1417 if(zi->ci.method ==
Z_BZIP2ED && (!zi->ci.raw))
1419 zi->ci.bstream.next_in = (
void*)buf;
1420 zi->ci.bstream.avail_in =
len;
1423 while ((err==BZ_RUN_OK) && (zi->ci.bstream.avail_in>0))
1425 if (zi->ci.bstream.avail_out == 0)
1430 zi->ci.bstream.next_out = (
char*)zi->ci.buffered_data;
1434 if(err != BZ_RUN_OK)
1437 if ((zi->ci.method ==
Z_BZIP2ED) && (!zi->ci.raw))
1439 uLong uTotalOutBefore_lo = zi->ci.bstream.total_out_lo32;
1441 err=BZ2_bzCompress(&zi->ci.bstream, BZ_RUN);
1443 zi->ci.pos_in_buffered_data += (
uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore_lo) ;
1447 if(err == BZ_RUN_OK)
1453 zi->ci.stream.next_in = (
Bytef*)buf;
1454 zi->ci.stream.avail_in =
len;
1456 while ((err==
ZIP_OK) && (zi->ci.stream.avail_in>0))
1458 if (zi->ci.stream.avail_out == 0)
1463 zi->ci.stream.next_out = zi->ci.buffered_data;
1470 if ((zi->ci.method ==
Z_DEFLATED) && (!zi->ci.raw))
1472 uLong uTotalOutBefore = zi->ci.stream.total_out;
1474 if(uTotalOutBefore > zi->ci.stream.total_out)
1480 zi->ci.pos_in_buffered_data += (
uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
1485 if (zi->ci.stream.avail_in < zi->ci.stream.avail_out)
1486 copy_this = zi->ci.stream.avail_in;
1488 copy_this = zi->ci.stream.avail_out;
1490 for (i = 0; i < copy_this; i++)
1491 *(((
char*)zi->ci.stream.next_out)+
i) =
1492 *(((
const char*)zi->ci.stream.next_in)+
i);
1494 zi->ci.stream.avail_in -= copy_this;
1495 zi->ci.stream.avail_out-= copy_this;
1496 zi->ci.stream.next_in+= copy_this;
1497 zi->ci.stream.next_out+= copy_this;
1498 zi->ci.stream.total_in+= copy_this;
1499 zi->ci.stream.total_out+= copy_this;
1500 zi->ci.pos_in_buffered_data += copy_this;
1518 uLong invalidValue = 0xffffffff;
1524 zi = (zip64_internal*)file;
1526 if (zi->in_opened_file_inzip == 0)
1528 zi->ci.stream.avail_in = 0;
1530 if ((zi->ci.method ==
Z_DEFLATED) && (!zi->ci.raw))
1534 uLong uTotalOutBefore;
1535 if (zi->ci.stream.avail_out == 0)
1540 zi->ci.stream.next_out = zi->ci.buffered_data;
1542 uTotalOutBefore = zi->ci.stream.total_out;
1544 zi->ci.pos_in_buffered_data += (
uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
1547 else if ((zi->ci.method ==
Z_BZIP2ED) && (!zi->ci.raw))
1551 while (err==BZ_FINISH_OK)
1553 uLong uTotalOutBefore;
1554 if (zi->ci.bstream.avail_out == 0)
1559 zi->ci.bstream.next_out = (
char*)zi->ci.buffered_data;
1561 uTotalOutBefore = zi->ci.bstream.total_out_lo32;
1562 err=BZ2_bzCompress(&zi->ci.bstream, BZ_FINISH);
1563 if(err == BZ_STREAM_END)
1566 zi->ci.pos_in_buffered_data += (
uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore);
1569 if(err == BZ_FINISH_OK)
1577 if ((zi->ci.pos_in_buffered_data>0) && (err==
ZIP_OK))
1583 if ((zi->ci.method ==
Z_DEFLATED) && (!zi->ci.raw))
1588 zi->ci.stream_initialised = 0;
1591 else if((zi->ci.method ==
Z_BZIP2ED) && (!zi->ci.raw))
1593 int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream);
1596 zi->ci.stream_initialised = 0;
1602 crc32 = (
uLong)zi->ci.crc32;
1603 uncompressed_size = zi->ci.totalUncompressedData;
1605 compressed_size = zi->ci.totalCompressedData;
1608 compressed_size += zi->ci.crypt_header_size;
1612 if(compressed_size >= 0xffffffff || uncompressed_size >= 0xffffffff || zi->ci.pos_local_header >= 0xffffffff)
1624 if(compressed_size >= 0xffffffff)
1630 if (zi->ci.stream.data_type ==
Z_ASCII)
1633 if(uncompressed_size >= 0xffffffff)
1639 if(uncompressed_size >= 0xffffffff)
1643 if(compressed_size >= 0xffffffff)
1647 if(zi->ci.pos_local_header >= 0xffffffff)
1654 if((
uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
1660 p = zi->ci.central_header + zi->ci.size_centralheader;
1668 if(uncompressed_size >= 0xffffffff)
1674 if(compressed_size >= 0xffffffff)
1680 if(zi->ci.pos_local_header >= 0xffffffff)
1689 zi->ci.size_centralExtraFree -= datasize + 4;
1690 zi->ci.size_centralheader += datasize + 4;
1693 zi->ci.size_centralExtra += datasize + 4;
1700 free(zi->ci.central_header);
1714 if(uncompressed_size >= 0xffffffff || compressed_size >= 0xffffffff )
1716 if(zi->ci.pos_zip64extrainfo > 0)
1744 zi->number_entry ++;
1745 zi->in_opened_file_inzip = 0;
1758 ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset;
1781 uLong Zip64DataSize = 44;
1811 ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
1832 if(zi->number_entry >= 0xFFFF)
1841 if(zi->number_entry >= 0xFFFF)
1852 ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
1853 if(pos >= 0xffffffff)
1858 err =
zip64local_putValue(&zi->z_filefunc,zi->filestream, (
uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4);
1867 uInt size_global_comment = 0;
1869 if(global_comment !=
NULL)
1870 size_global_comment = (
uInt)strlen(global_comment);
1874 if (err ==
ZIP_OK && size_global_comment > 0)
1876 if (
ZWRITE64(zi->z_filefunc,zi->filestream, global_comment, size_global_comment) != size_global_comment)
1886 uLong size_centraldir = 0;
1893 zi = (zip64_internal*)file;
1895 if (zi->in_opened_file_inzip == 1)
1900 #ifndef NO_ADDFILEINEXISTINGZIP 1901 if (global_comment==
NULL)
1902 global_comment = zi->globalcomment;
1905 centraldir_pos_inzip =
ZTELL64(zi->z_filefunc,zi->filestream);
1912 if ((err==
ZIP_OK) && (ldi->filled_in_this_block>0))
1914 if (
ZWRITE64(zi->z_filefunc,zi->filestream, ldi->data, ldi->filled_in_this_block) != ldi->filled_in_this_block)
1918 size_centraldir += ldi->filled_in_this_block;
1919 ldi = ldi->next_datablock;
1924 pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
1925 if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
1939 if (
ZCLOSE64(zi->z_filefunc,zi->filestream) != 0)
1943 #ifndef NO_ADDFILEINEXISTINGZIP 1962 if(pData ==
NULL || *dataLen < 4)
1965 pNewHeader = (
char*)
ALLOC(*dataLen);
1968 while(p < (pData + *dataLen))
1970 header = *(
short*)p;
1971 dataSize = *(((
short*)p)+1);
1973 if( header == sHeader )
1980 memcpy(pTmp, p, dataSize + 4);
1982 size += dataSize + 4;
1990 memset(pData,0, *dataLen);
1994 memcpy(pData, pNewHeader, size);
struct linkedlist_datablock_internal_s linkedlist_datablock_internal
#define ZIP64ENDLOCHEADERMAGIC
#define ZIP_INTERNALERROR
#define SIZEDATA_INDATABLOCK
int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw)
#define SIZECENTRALHEADER
local uLong zip64local_TmzDateToDosDate(const tm_zip *ptm)
int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting)
const z_crc_t FAR *ZEXPORT get_crc_table()
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
#define ZERROR64(filefunc, filestream)
GLint GLint GLint GLint GLint x
#define APPEND_STATUS_CREATEAFTER
#define ZLIB_FILEFUNC_MODE_READ
local linkedlist_datablock_internal * allocate_new_datablock()
int Write_EndOfCentralDirectoryRecord(zip64_internal *zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
int ZEXPORT zipRemoveExtraInfoBlock(char *pData, int *dataLen, short sHeader)
int ZEXPORT deflateEnd(z_streamp strm)
struct linkedlist_data_s linkedlist_data
zipFile ZEXPORT zipOpen(const char *pathname, int append)
local void init_linkedlist(linkedlist_data *ll)
int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32)
local int zip64local_getLong(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int zip64)
GLenum GLuint GLenum GLsizei const GLchar * buf
local int zip64local_getByte(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc *globalcomment, zlib_filefunc_def *pzlib_filefunc32_def)
int ZEXPORT zipWriteInFileInZip(zipFile file, const void *buf, unsigned int len)
seek_file_func zseek32_file
local int zip64FlushWriteBuffer(zip64_internal *zi)
#define ZCLOSE64(filefunc, filestream)
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
int Write_LocalFileHeader(zip64_internal *zi, const char *filename, uInt size_extrafield_local, const void *extrafield_local)
#define ZREAD64(filefunc, filestream, buf, size)
GLsizei GLsizei GLenum GLenum const GLvoid * data
#define ZOPEN64(filefunc, filename, mode)
int LoadCentralDirectoryRecord(zip64_internal *pziinit)
local int zip64local_putValue(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
#define Z_DEFAULT_STRATEGY
#define zencode(pkeys, pcrc_32_tab, c, t)
local void free_linkedlist(linkedlist_data *ll)
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
zlib_filefunc64_def zfile_func64
local int zip64local_getShort(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
#define ZLIB_FILEFUNC_MODE_CREATE
unsigned long long int ZPOS64_T
local int add_data_in_datablock(linkedlist_data *ll, const void *buf, uLong len)
void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def)
#define ZLIB_FILEFUNC_MODE_EXISTING
#define ZIP64ENDHEADERMAGIC
#define ZTELL64(filefunc, filestream)
T1_FIELD_DICT_PRIVATE password
int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal *zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
int ZEXPORT deflate(z_streamp strm, int flush)
int ZEXPORT zipOpenNewFileInZip(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level)
zipFile ZEXPORT zipOpen64(const void *pathname, int append)
tell_file_func ztell32_file
int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, int zip64)
int Write_GlobalComment(zip64_internal *zi, const char *global_comment)
if(!abbox) return FT_THROW(Invalid_Argument)
local int zip64local_getLong64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy)
int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal *zi, ZPOS64_T zip64eocd_pos_inzip)
local void zip64local_putValue_inmemory(void *dest, ZPOS64_T x, int nbByte)
int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int zip64)
local int zip64local_putValue OF((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte))
zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc *globalcomment, zlib_filefunc64_def *pzlib_filefunc_def)
local void free_datablock(linkedlist_datablock_internal *ldi)
#define ZLIB_FILEFUNC_MODE_WRITE
#define ZSEEK64(filefunc, filestream, pos, mode)
int ZEXPORT zipCloseFileInZip(zipFile file)
#define ZLIB_FILEFUNC_SEEK_END
int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase)
int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase, int zip64)
png_infop png_uint_32 flag
#define APPEND_STATUS_ADDINZIP
const char zip_copyright[]
zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc *globalcomment, zlib_filefunc64_32_def *pzlib_filefunc64_32_def)
#define ZLIB_FILEFUNC_SEEK_SET
#define APPEND_STATUS_CREATE
int ZEXPORT zipClose(zipFile file, const char *global_comment)
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def *p_filefunc64_32, const zlib_filefunc_def *p_filefunc32)
#define ZWRITE64(filefunc, filestream, buf, size)
#define CENTRALHEADERMAGIC