mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
deps: zlib upgrade 1.2.13 -> 1.3.1
This commit is contained in:
parent
61171a0db6
commit
fc9423e65b
262 changed files with 6962 additions and 4373 deletions
|
@ -180,9 +180,9 @@ if (WIN32)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
|
|
||||||
# Bundled zlib
|
# Bundled zlib
|
||||||
add_subdirectory(dependencies/zlib-1.2.13)
|
add_subdirectory(dependencies/zlib-1.3.1)
|
||||||
set(ZLIB_LIBRARY zlibstatic)
|
set(ZLIB_LIBRARY zlibstatic)
|
||||||
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib-1.2.13 CACHE PATH "zlib include dir")
|
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib-1.3.1 CACHE PATH "zlib include dir")
|
||||||
|
|
||||||
# Bundled libcurl
|
# Bundled libcurl
|
||||||
set(CMAKE_CURL_INCLUDES)
|
set(CMAKE_CURL_INCLUDES)
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
|
|
||||||
MiniZip 1.1 was derrived from MiniZip at version 1.01f
|
|
||||||
|
|
||||||
Change in 1.0 (Okt 2009)
|
|
||||||
- **TODO - Add history**
|
|
||||||
|
|
|
@ -1,367 +0,0 @@
|
||||||
/* zip.h -- IO on .zip files using zlib
|
|
||||||
Version 1.1, February 14h, 2010
|
|
||||||
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
|
||||||
|
|
||||||
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
|
||||||
|
|
||||||
Modifications for Zip64 support
|
|
||||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
|
||||||
|
|
||||||
For more info read MiniZip_info.txt
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Condition of use and distribution are the same than zlib :
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Changes
|
|
||||||
|
|
||||||
See header of zip.h
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _zip12_H
|
|
||||||
#define _zip12_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define HAVE_BZIP2
|
|
||||||
|
|
||||||
#ifndef _ZLIB_H
|
|
||||||
#include "zlib.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _ZLIBIOAPI_H
|
|
||||||
#include "ioapi.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_BZIP2
|
|
||||||
#include "bzlib.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Z_BZIP2ED 12
|
|
||||||
|
|
||||||
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
|
|
||||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
|
||||||
from (void*) without cast */
|
|
||||||
typedef struct TagzipFile__ { int unused; } zipFile__;
|
|
||||||
typedef zipFile__ *zipFile;
|
|
||||||
#else
|
|
||||||
typedef voidp zipFile;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ZIP_OK (0)
|
|
||||||
#define ZIP_EOF (0)
|
|
||||||
#define ZIP_ERRNO (Z_ERRNO)
|
|
||||||
#define ZIP_PARAMERROR (-102)
|
|
||||||
#define ZIP_BADZIPFILE (-103)
|
|
||||||
#define ZIP_INTERNALERROR (-104)
|
|
||||||
|
|
||||||
#ifndef DEF_MEM_LEVEL
|
|
||||||
# if MAX_MEM_LEVEL >= 8
|
|
||||||
# define DEF_MEM_LEVEL 8
|
|
||||||
# else
|
|
||||||
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
/* default memLevel */
|
|
||||||
|
|
||||||
/* tm_zip contain date/time info */
|
|
||||||
typedef struct tm_zip_s
|
|
||||||
{
|
|
||||||
int tm_sec; /* seconds after the minute - [0,59] */
|
|
||||||
int tm_min; /* minutes after the hour - [0,59] */
|
|
||||||
int tm_hour; /* hours since midnight - [0,23] */
|
|
||||||
int tm_mday; /* day of the month - [1,31] */
|
|
||||||
int tm_mon; /* months since January - [0,11] */
|
|
||||||
int tm_year; /* years - [1980..2044] */
|
|
||||||
} tm_zip;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
tm_zip tmz_date; /* date in understandable format */
|
|
||||||
uLong dosDate; /* if dos_date == 0, tmu_date is used */
|
|
||||||
/* uLong flag; */ /* general purpose bit flag 2 bytes */
|
|
||||||
|
|
||||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
|
||||||
uLong external_fa; /* external file attributes 4 bytes */
|
|
||||||
} zip_fileinfo;
|
|
||||||
|
|
||||||
typedef const char* zipcharpc;
|
|
||||||
|
|
||||||
|
|
||||||
#define APPEND_STATUS_CREATE (0)
|
|
||||||
#define APPEND_STATUS_CREATEAFTER (1)
|
|
||||||
#define APPEND_STATUS_ADDINZIP (2)
|
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
|
|
||||||
extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
|
|
||||||
/*
|
|
||||||
Create a zipfile.
|
|
||||||
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
|
||||||
an Unix computer "zlib/zlib113.zip".
|
|
||||||
if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
|
|
||||||
will be created at the end of the file.
|
|
||||||
(useful if the file contain a self extractor code)
|
|
||||||
if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
|
|
||||||
add files in existing zip (be sure you don't add file that doesn't exist)
|
|
||||||
If the zipfile cannot be opened, the return value is NULL.
|
|
||||||
Else, the return value is a zipFile Handle, usable with other function
|
|
||||||
of this zip package.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Note : there is no delete function into a zipfile.
|
|
||||||
If you want delete file into a zipfile, you must open a zipfile, and create another
|
|
||||||
Of couse, you can use RAW reading and writing to copy the file you did not want delte
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
|
|
||||||
int append,
|
|
||||||
zipcharpc* globalcomment,
|
|
||||||
zlib_filefunc_def* pzlib_filefunc_def));
|
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
|
|
||||||
int append,
|
|
||||||
zipcharpc* globalcomment,
|
|
||||||
zlib_filefunc64_def* pzlib_filefunc_def));
|
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen3 OF((const void *pathname,
|
|
||||||
int append,
|
|
||||||
zipcharpc* globalcomment,
|
|
||||||
zlib_filefunc64_32_def* pzlib_filefunc64_32_def));
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip OF((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));
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip64 OF((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));
|
|
||||||
|
|
||||||
/*
|
|
||||||
Open a file in the ZIP for writing.
|
|
||||||
filename : the filename in zip (if NULL, '-' without quote will be used
|
|
||||||
*zipfi contain supplemental information
|
|
||||||
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
|
|
||||||
contains the extrafield data the the local header
|
|
||||||
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
|
|
||||||
contains the extrafield data the the local header
|
|
||||||
if comment != NULL, comment contain the comment string
|
|
||||||
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
|
||||||
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
|
||||||
zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
|
|
||||||
this MUST be '1' if the uncompressed size is >= 0xffffffff.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip2 OF((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));
|
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip2_64 OF((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));
|
|
||||||
/*
|
|
||||||
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip3 OF((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));
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip3_64 OF((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
|
|
||||||
));
|
|
||||||
|
|
||||||
/*
|
|
||||||
Same than zipOpenNewFileInZip2, except
|
|
||||||
windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
|
|
||||||
password : crypting password (NULL for no crypting)
|
|
||||||
crcForCrypting : crc of file to compress (needed for crypting)
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip4 OF((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
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip4_64 OF((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
|
|
||||||
));
|
|
||||||
/*
|
|
||||||
Same than zipOpenNewFileInZip4, except
|
|
||||||
versionMadeBy : value for Version made by field
|
|
||||||
flag : value for flag field (compression level info will be added)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
|
|
||||||
const void* buf,
|
|
||||||
unsigned len));
|
|
||||||
/*
|
|
||||||
Write data in the zipfile
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
|
|
||||||
/*
|
|
||||||
Close the current file in the zipfile
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
|
|
||||||
uLong uncompressed_size,
|
|
||||||
uLong crc32));
|
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
|
|
||||||
ZPOS64_T uncompressed_size,
|
|
||||||
uLong crc32));
|
|
||||||
|
|
||||||
/*
|
|
||||||
Close the current file in the zipfile, for file opened with
|
|
||||||
parameter raw=1 in zipOpenNewFileInZip2
|
|
||||||
uncompressed_size and crc32 are value for the uncompressed size
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int ZEXPORT zipClose OF((zipFile file,
|
|
||||||
const char* global_comment));
|
|
||||||
/*
|
|
||||||
Close the zipfile
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader));
|
|
||||||
/*
|
|
||||||
zipRemoveExtraInfoBlock - Added by Mathias Svensson
|
|
||||||
|
|
||||||
Remove extra information block from a extra information data for the local file header or central directory header
|
|
||||||
|
|
||||||
It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode.
|
|
||||||
|
|
||||||
0x0001 is the signature header for the ZIP64 extra information blocks
|
|
||||||
|
|
||||||
usage.
|
|
||||||
Remove ZIP64 Extra information from a central director extra field data
|
|
||||||
zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001);
|
|
||||||
|
|
||||||
Remove ZIP64 Extra information from a Local File Header extra field data
|
|
||||||
zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _zip64_H */
|
|
|
@ -1,32 +0,0 @@
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#define IDR_VERSION1 1
|
|
||||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
|
||||||
FILEVERSION 1, 2, 13, 0
|
|
||||||
PRODUCTVERSION 1, 2, 13, 0
|
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
|
||||||
FILEFLAGS 0
|
|
||||||
FILEOS VOS_DOS_WINDOWS32
|
|
||||||
FILETYPE VFT_DLL
|
|
||||||
FILESUBTYPE 0 // not used
|
|
||||||
BEGIN
|
|
||||||
BLOCK "StringFileInfo"
|
|
||||||
BEGIN
|
|
||||||
BLOCK "040904E4"
|
|
||||||
//language ID = U.S. English, char set = Windows, Multilingual
|
|
||||||
|
|
||||||
BEGIN
|
|
||||||
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
|
||||||
VALUE "FileVersion", "1.2.13\0"
|
|
||||||
VALUE "InternalName", "zlib\0"
|
|
||||||
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
|
||||||
VALUE "ProductName", "ZLib.DLL\0"
|
|
||||||
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
|
||||||
VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0"
|
|
||||||
END
|
|
||||||
END
|
|
||||||
BLOCK "VarFileInfo"
|
|
||||||
BEGIN
|
|
||||||
VALUE "Translation", 0x0409, 1252
|
|
||||||
END
|
|
||||||
END
|
|
|
@ -1,158 +0,0 @@
|
||||||
LIBRARY
|
|
||||||
; zlib data compression and ZIP file I/O library
|
|
||||||
|
|
||||||
VERSION 1.2
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
adler32 @1
|
|
||||||
compress @2
|
|
||||||
crc32 @3
|
|
||||||
deflate @4
|
|
||||||
deflateCopy @5
|
|
||||||
deflateEnd @6
|
|
||||||
deflateInit2_ @7
|
|
||||||
deflateInit_ @8
|
|
||||||
deflateParams @9
|
|
||||||
deflateReset @10
|
|
||||||
deflateSetDictionary @11
|
|
||||||
gzclose @12
|
|
||||||
gzdopen @13
|
|
||||||
gzerror @14
|
|
||||||
gzflush @15
|
|
||||||
gzopen @16
|
|
||||||
gzread @17
|
|
||||||
gzwrite @18
|
|
||||||
inflate @19
|
|
||||||
inflateEnd @20
|
|
||||||
inflateInit2_ @21
|
|
||||||
inflateInit_ @22
|
|
||||||
inflateReset @23
|
|
||||||
inflateSetDictionary @24
|
|
||||||
inflateSync @25
|
|
||||||
uncompress @26
|
|
||||||
zlibVersion @27
|
|
||||||
gzprintf @28
|
|
||||||
gzputc @29
|
|
||||||
gzgetc @30
|
|
||||||
gzseek @31
|
|
||||||
gzrewind @32
|
|
||||||
gztell @33
|
|
||||||
gzeof @34
|
|
||||||
gzsetparams @35
|
|
||||||
zError @36
|
|
||||||
inflateSyncPoint @37
|
|
||||||
get_crc_table @38
|
|
||||||
compress2 @39
|
|
||||||
gzputs @40
|
|
||||||
gzgets @41
|
|
||||||
inflateCopy @42
|
|
||||||
inflateBackInit_ @43
|
|
||||||
inflateBack @44
|
|
||||||
inflateBackEnd @45
|
|
||||||
compressBound @46
|
|
||||||
deflateBound @47
|
|
||||||
gzclearerr @48
|
|
||||||
gzungetc @49
|
|
||||||
zlibCompileFlags @50
|
|
||||||
deflatePrime @51
|
|
||||||
deflatePending @52
|
|
||||||
|
|
||||||
unzOpen @61
|
|
||||||
unzClose @62
|
|
||||||
unzGetGlobalInfo @63
|
|
||||||
unzGetCurrentFileInfo @64
|
|
||||||
unzGoToFirstFile @65
|
|
||||||
unzGoToNextFile @66
|
|
||||||
unzOpenCurrentFile @67
|
|
||||||
unzReadCurrentFile @68
|
|
||||||
unzOpenCurrentFile3 @69
|
|
||||||
unztell @70
|
|
||||||
unzeof @71
|
|
||||||
unzCloseCurrentFile @72
|
|
||||||
unzGetGlobalComment @73
|
|
||||||
unzStringFileNameCompare @74
|
|
||||||
unzLocateFile @75
|
|
||||||
unzGetLocalExtrafield @76
|
|
||||||
unzOpen2 @77
|
|
||||||
unzOpenCurrentFile2 @78
|
|
||||||
unzOpenCurrentFilePassword @79
|
|
||||||
|
|
||||||
zipOpen @80
|
|
||||||
zipOpenNewFileInZip @81
|
|
||||||
zipWriteInFileInZip @82
|
|
||||||
zipCloseFileInZip @83
|
|
||||||
zipClose @84
|
|
||||||
zipOpenNewFileInZip2 @86
|
|
||||||
zipCloseFileInZipRaw @87
|
|
||||||
zipOpen2 @88
|
|
||||||
zipOpenNewFileInZip3 @89
|
|
||||||
|
|
||||||
unzGetFilePos @100
|
|
||||||
unzGoToFilePos @101
|
|
||||||
|
|
||||||
fill_win32_filefunc @110
|
|
||||||
|
|
||||||
; zlibwapi v1.2.4 added:
|
|
||||||
fill_win32_filefunc64 @111
|
|
||||||
fill_win32_filefunc64A @112
|
|
||||||
fill_win32_filefunc64W @113
|
|
||||||
|
|
||||||
unzOpen64 @120
|
|
||||||
unzOpen2_64 @121
|
|
||||||
unzGetGlobalInfo64 @122
|
|
||||||
unzGetCurrentFileInfo64 @124
|
|
||||||
unzGetCurrentFileZStreamPos64 @125
|
|
||||||
unztell64 @126
|
|
||||||
unzGetFilePos64 @127
|
|
||||||
unzGoToFilePos64 @128
|
|
||||||
|
|
||||||
zipOpen64 @130
|
|
||||||
zipOpen2_64 @131
|
|
||||||
zipOpenNewFileInZip64 @132
|
|
||||||
zipOpenNewFileInZip2_64 @133
|
|
||||||
zipOpenNewFileInZip3_64 @134
|
|
||||||
zipOpenNewFileInZip4_64 @135
|
|
||||||
zipCloseFileInZipRaw64 @136
|
|
||||||
|
|
||||||
; zlib1 v1.2.4 added:
|
|
||||||
adler32_combine @140
|
|
||||||
crc32_combine @142
|
|
||||||
deflateSetHeader @144
|
|
||||||
deflateTune @145
|
|
||||||
gzbuffer @146
|
|
||||||
gzclose_r @147
|
|
||||||
gzclose_w @148
|
|
||||||
gzdirect @149
|
|
||||||
gzoffset @150
|
|
||||||
inflateGetHeader @156
|
|
||||||
inflateMark @157
|
|
||||||
inflatePrime @158
|
|
||||||
inflateReset2 @159
|
|
||||||
inflateUndermine @160
|
|
||||||
|
|
||||||
; zlib1 v1.2.6 added:
|
|
||||||
gzgetc_ @161
|
|
||||||
inflateResetKeep @163
|
|
||||||
deflateResetKeep @164
|
|
||||||
|
|
||||||
; zlib1 v1.2.7 added:
|
|
||||||
gzopen_w @165
|
|
||||||
|
|
||||||
; zlib1 v1.2.8 added:
|
|
||||||
inflateGetDictionary @166
|
|
||||||
gzvprintf @167
|
|
||||||
|
|
||||||
; zlib1 v1.2.9 added:
|
|
||||||
inflateCodesUsed @168
|
|
||||||
inflateValidate @169
|
|
||||||
uncompress2 @170
|
|
||||||
gzfread @171
|
|
||||||
gzfwrite @172
|
|
||||||
deflateGetDictionary @173
|
|
||||||
adler32_z @174
|
|
||||||
crc32_z @175
|
|
||||||
|
|
||||||
; zlib1 v1.2.12 added:
|
|
||||||
crc32_combine_gen @176
|
|
||||||
crc32_combine_gen64 @177
|
|
||||||
crc32_combine_op @178
|
|
|
@ -1,479 +0,0 @@
|
||||||
/* zran.c -- example of zlib/gzip stream indexing and random access
|
|
||||||
* Copyright (C) 2005, 2012, 2018 Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
* Version 1.2 14 Oct 2018 Mark Adler */
|
|
||||||
|
|
||||||
/* Version History:
|
|
||||||
1.0 29 May 2005 First version
|
|
||||||
1.1 29 Sep 2012 Fix memory reallocation error
|
|
||||||
1.2 14 Oct 2018 Handle gzip streams with multiple members
|
|
||||||
Add a header file to facilitate usage in applications
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary()
|
|
||||||
for random access of a compressed file. A file containing a zlib or gzip
|
|
||||||
stream is provided on the command line. The compressed stream is decoded in
|
|
||||||
its entirety, and an index built with access points about every SPAN bytes
|
|
||||||
in the uncompressed output. The compressed file is left open, and can then
|
|
||||||
be read randomly, having to decompress on the average SPAN/2 uncompressed
|
|
||||||
bytes before getting to the desired block of data.
|
|
||||||
|
|
||||||
An access point can be created at the start of any deflate block, by saving
|
|
||||||
the starting file offset and bit of that block, and the 32K bytes of
|
|
||||||
uncompressed data that precede that block. Also the uncompressed offset of
|
|
||||||
that block is saved to provide a reference for locating a desired starting
|
|
||||||
point in the uncompressed stream. deflate_index_build() works by
|
|
||||||
decompressing the input zlib or gzip stream a block at a time, and at the
|
|
||||||
end of each block deciding if enough uncompressed data has gone by to
|
|
||||||
justify the creation of a new access point. If so, that point is saved in a
|
|
||||||
data structure that grows as needed to accommodate the points.
|
|
||||||
|
|
||||||
To use the index, an offset in the uncompressed data is provided, for which
|
|
||||||
the latest access point at or preceding that offset is located in the index.
|
|
||||||
The input file is positioned to the specified location in the index, and if
|
|
||||||
necessary the first few bits of the compressed data is read from the file.
|
|
||||||
inflate is initialized with those bits and the 32K of uncompressed data, and
|
|
||||||
the decompression then proceeds until the desired offset in the file is
|
|
||||||
reached. Then the decompression continues to read the desired uncompressed
|
|
||||||
data from the file.
|
|
||||||
|
|
||||||
Another approach would be to generate the index on demand. In that case,
|
|
||||||
requests for random access reads from the compressed data would try to use
|
|
||||||
the index, but if a read far enough past the end of the index is required,
|
|
||||||
then further index entries would be generated and added.
|
|
||||||
|
|
||||||
There is some fair bit of overhead to starting inflation for the random
|
|
||||||
access, mainly copying the 32K byte dictionary. So if small pieces of the
|
|
||||||
file are being accessed, it would make sense to implement a cache to hold
|
|
||||||
some lookahead and avoid many calls to deflate_index_extract() for small
|
|
||||||
lengths.
|
|
||||||
|
|
||||||
Another way to build an index would be to use inflateCopy(). That would
|
|
||||||
not be constrained to have access points at block boundaries, but requires
|
|
||||||
more memory per access point, and also cannot be saved to file due to the
|
|
||||||
use of pointers in the state. The approach here allows for storage of the
|
|
||||||
index in a file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "zlib.h"
|
|
||||||
#include "zran.h"
|
|
||||||
|
|
||||||
#define WINSIZE 32768U /* sliding window size */
|
|
||||||
#define CHUNK 16384 /* file input buffer size */
|
|
||||||
|
|
||||||
/* Access point entry. */
|
|
||||||
struct point {
|
|
||||||
off_t out; /* corresponding offset in uncompressed data */
|
|
||||||
off_t in; /* offset in input file of first full byte */
|
|
||||||
int bits; /* number of bits (1-7) from byte at in-1, or 0 */
|
|
||||||
unsigned char window[WINSIZE]; /* preceding 32K of uncompressed data */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* See comments in zran.h. */
|
|
||||||
void deflate_index_free(struct deflate_index *index)
|
|
||||||
{
|
|
||||||
if (index != NULL) {
|
|
||||||
free(index->list);
|
|
||||||
free(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add an entry to the access point list. If out of memory, deallocate the
|
|
||||||
existing list and return NULL. index->gzip is the allocated size of the
|
|
||||||
index in point entries, until it is time for deflate_index_build() to
|
|
||||||
return, at which point gzip is set to indicate a gzip file or not.
|
|
||||||
*/
|
|
||||||
static struct deflate_index *addpoint(struct deflate_index *index, int bits,
|
|
||||||
off_t in, off_t out, unsigned left,
|
|
||||||
unsigned char *window)
|
|
||||||
{
|
|
||||||
struct point *next;
|
|
||||||
|
|
||||||
/* if list is empty, create it (start with eight points) */
|
|
||||||
if (index == NULL) {
|
|
||||||
index = malloc(sizeof(struct deflate_index));
|
|
||||||
if (index == NULL) return NULL;
|
|
||||||
index->list = malloc(sizeof(struct point) << 3);
|
|
||||||
if (index->list == NULL) {
|
|
||||||
free(index);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
index->gzip = 8;
|
|
||||||
index->have = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if list is full, make it bigger */
|
|
||||||
else if (index->have == index->gzip) {
|
|
||||||
index->gzip <<= 1;
|
|
||||||
next = realloc(index->list, sizeof(struct point) * index->gzip);
|
|
||||||
if (next == NULL) {
|
|
||||||
deflate_index_free(index);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
index->list = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fill in entry and increment how many we have */
|
|
||||||
next = (struct point *)(index->list) + index->have;
|
|
||||||
next->bits = bits;
|
|
||||||
next->in = in;
|
|
||||||
next->out = out;
|
|
||||||
if (left)
|
|
||||||
memcpy(next->window, window + WINSIZE - left, left);
|
|
||||||
if (left < WINSIZE)
|
|
||||||
memcpy(next->window + left, window, WINSIZE - left);
|
|
||||||
index->have++;
|
|
||||||
|
|
||||||
/* return list, possibly reallocated */
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See comments in zran.h. */
|
|
||||||
int deflate_index_build(FILE *in, off_t span, struct deflate_index **built)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
int gzip = 0; /* true if reading a gzip file */
|
|
||||||
off_t totin, totout; /* our own total counters to avoid 4GB limit */
|
|
||||||
off_t last; /* totout value of last access point */
|
|
||||||
struct deflate_index *index; /* access points being generated */
|
|
||||||
z_stream strm;
|
|
||||||
unsigned char input[CHUNK];
|
|
||||||
unsigned char window[WINSIZE];
|
|
||||||
|
|
||||||
/* initialize inflate */
|
|
||||||
strm.zalloc = Z_NULL;
|
|
||||||
strm.zfree = Z_NULL;
|
|
||||||
strm.opaque = Z_NULL;
|
|
||||||
strm.avail_in = 0;
|
|
||||||
strm.next_in = Z_NULL;
|
|
||||||
ret = inflateInit2(&strm, 47); /* automatic zlib or gzip decoding */
|
|
||||||
if (ret != Z_OK)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
/* inflate the input, maintain a sliding window, and build an index -- this
|
|
||||||
also validates the integrity of the compressed data using the check
|
|
||||||
information in the gzip or zlib stream */
|
|
||||||
totin = totout = last = 0;
|
|
||||||
index = NULL; /* will be allocated by first addpoint() */
|
|
||||||
strm.avail_out = 0;
|
|
||||||
do {
|
|
||||||
/* get some compressed data from input file */
|
|
||||||
strm.avail_in = fread(input, 1, CHUNK, in);
|
|
||||||
if (ferror(in)) {
|
|
||||||
ret = Z_ERRNO;
|
|
||||||
goto deflate_index_build_error;
|
|
||||||
}
|
|
||||||
if (strm.avail_in == 0) {
|
|
||||||
ret = Z_DATA_ERROR;
|
|
||||||
goto deflate_index_build_error;
|
|
||||||
}
|
|
||||||
strm.next_in = input;
|
|
||||||
|
|
||||||
/* check for a gzip stream */
|
|
||||||
if (totin == 0 && strm.avail_in >= 3 &&
|
|
||||||
input[0] == 31 && input[1] == 139 && input[2] == 8)
|
|
||||||
gzip = 1;
|
|
||||||
|
|
||||||
/* process all of that, or until end of stream */
|
|
||||||
do {
|
|
||||||
/* reset sliding window if necessary */
|
|
||||||
if (strm.avail_out == 0) {
|
|
||||||
strm.avail_out = WINSIZE;
|
|
||||||
strm.next_out = window;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* inflate until out of input, output, or at end of block --
|
|
||||||
update the total input and output counters */
|
|
||||||
totin += strm.avail_in;
|
|
||||||
totout += strm.avail_out;
|
|
||||||
ret = inflate(&strm, Z_BLOCK); /* return at end of block */
|
|
||||||
totin -= strm.avail_in;
|
|
||||||
totout -= strm.avail_out;
|
|
||||||
if (ret == Z_NEED_DICT)
|
|
||||||
ret = Z_DATA_ERROR;
|
|
||||||
if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR)
|
|
||||||
goto deflate_index_build_error;
|
|
||||||
if (ret == Z_STREAM_END) {
|
|
||||||
if (gzip &&
|
|
||||||
(strm.avail_in || ungetc(getc(in), in) != EOF)) {
|
|
||||||
ret = inflateReset(&strm);
|
|
||||||
if (ret != Z_OK)
|
|
||||||
goto deflate_index_build_error;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if at end of block, consider adding an index entry (note that if
|
|
||||||
data_type indicates an end-of-block, then all of the
|
|
||||||
uncompressed data from that block has been delivered, and none
|
|
||||||
of the compressed data after that block has been consumed,
|
|
||||||
except for up to seven bits) -- the totout == 0 provides an
|
|
||||||
entry point after the zlib or gzip header, and assures that the
|
|
||||||
index always has at least one access point; we avoid creating an
|
|
||||||
access point after the last block by checking bit 6 of data_type
|
|
||||||
*/
|
|
||||||
if ((strm.data_type & 128) && !(strm.data_type & 64) &&
|
|
||||||
(totout == 0 || totout - last > span)) {
|
|
||||||
index = addpoint(index, strm.data_type & 7, totin,
|
|
||||||
totout, strm.avail_out, window);
|
|
||||||
if (index == NULL) {
|
|
||||||
ret = Z_MEM_ERROR;
|
|
||||||
goto deflate_index_build_error;
|
|
||||||
}
|
|
||||||
last = totout;
|
|
||||||
}
|
|
||||||
} while (strm.avail_in != 0);
|
|
||||||
} while (ret != Z_STREAM_END);
|
|
||||||
|
|
||||||
/* clean up and return index (release unused entries in list) */
|
|
||||||
(void)inflateEnd(&strm);
|
|
||||||
index->list = realloc(index->list, sizeof(struct point) * index->have);
|
|
||||||
index->gzip = gzip;
|
|
||||||
index->length = totout;
|
|
||||||
*built = index;
|
|
||||||
return index->have;
|
|
||||||
|
|
||||||
/* return error */
|
|
||||||
deflate_index_build_error:
|
|
||||||
(void)inflateEnd(&strm);
|
|
||||||
deflate_index_free(index);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See comments in zran.h. */
|
|
||||||
int deflate_index_extract(FILE *in, struct deflate_index *index, off_t offset,
|
|
||||||
unsigned char *buf, int len)
|
|
||||||
{
|
|
||||||
int ret, skip;
|
|
||||||
z_stream strm;
|
|
||||||
struct point *here;
|
|
||||||
unsigned char input[CHUNK];
|
|
||||||
unsigned char discard[WINSIZE];
|
|
||||||
|
|
||||||
/* proceed only if something reasonable to do */
|
|
||||||
if (len < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* find where in stream to start */
|
|
||||||
here = index->list;
|
|
||||||
ret = index->have;
|
|
||||||
while (--ret && here[1].out <= offset)
|
|
||||||
here++;
|
|
||||||
|
|
||||||
/* initialize file and inflate state to start there */
|
|
||||||
strm.zalloc = Z_NULL;
|
|
||||||
strm.zfree = Z_NULL;
|
|
||||||
strm.opaque = Z_NULL;
|
|
||||||
strm.avail_in = 0;
|
|
||||||
strm.next_in = Z_NULL;
|
|
||||||
ret = inflateInit2(&strm, -15); /* raw inflate */
|
|
||||||
if (ret != Z_OK)
|
|
||||||
return ret;
|
|
||||||
ret = fseeko(in, here->in - (here->bits ? 1 : 0), SEEK_SET);
|
|
||||||
if (ret == -1)
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
if (here->bits) {
|
|
||||||
ret = getc(in);
|
|
||||||
if (ret == -1) {
|
|
||||||
ret = ferror(in) ? Z_ERRNO : Z_DATA_ERROR;
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
}
|
|
||||||
(void)inflatePrime(&strm, here->bits, ret >> (8 - here->bits));
|
|
||||||
}
|
|
||||||
(void)inflateSetDictionary(&strm, here->window, WINSIZE);
|
|
||||||
|
|
||||||
/* skip uncompressed bytes until offset reached, then satisfy request */
|
|
||||||
offset -= here->out;
|
|
||||||
strm.avail_in = 0;
|
|
||||||
skip = 1; /* while skipping to offset */
|
|
||||||
do {
|
|
||||||
/* define where to put uncompressed data, and how much */
|
|
||||||
if (offset > WINSIZE) { /* skip WINSIZE bytes */
|
|
||||||
strm.avail_out = WINSIZE;
|
|
||||||
strm.next_out = discard;
|
|
||||||
offset -= WINSIZE;
|
|
||||||
}
|
|
||||||
else if (offset > 0) { /* last skip */
|
|
||||||
strm.avail_out = (unsigned)offset;
|
|
||||||
strm.next_out = discard;
|
|
||||||
offset = 0;
|
|
||||||
}
|
|
||||||
else if (skip) { /* at offset now */
|
|
||||||
strm.avail_out = len;
|
|
||||||
strm.next_out = buf;
|
|
||||||
skip = 0; /* only do this once */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* uncompress until avail_out filled, or end of stream */
|
|
||||||
do {
|
|
||||||
if (strm.avail_in == 0) {
|
|
||||||
strm.avail_in = fread(input, 1, CHUNK, in);
|
|
||||||
if (ferror(in)) {
|
|
||||||
ret = Z_ERRNO;
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
}
|
|
||||||
if (strm.avail_in == 0) {
|
|
||||||
ret = Z_DATA_ERROR;
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
}
|
|
||||||
strm.next_in = input;
|
|
||||||
}
|
|
||||||
ret = inflate(&strm, Z_NO_FLUSH); /* normal inflate */
|
|
||||||
if (ret == Z_NEED_DICT)
|
|
||||||
ret = Z_DATA_ERROR;
|
|
||||||
if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR)
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
if (ret == Z_STREAM_END) {
|
|
||||||
/* the raw deflate stream has ended */
|
|
||||||
if (index->gzip == 0)
|
|
||||||
/* this is a zlib stream that has ended -- done */
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* near the end of a gzip member, which might be followed by
|
|
||||||
another gzip member -- skip the gzip trailer and see if
|
|
||||||
there is more input after it */
|
|
||||||
if (strm.avail_in < 8) {
|
|
||||||
fseeko(in, 8 - strm.avail_in, SEEK_CUR);
|
|
||||||
strm.avail_in = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
strm.avail_in -= 8;
|
|
||||||
strm.next_in += 8;
|
|
||||||
}
|
|
||||||
if (strm.avail_in == 0 && ungetc(getc(in), in) == EOF)
|
|
||||||
/* the input ended after the gzip trailer -- done */
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* there is more input, so another gzip member should follow --
|
|
||||||
validate and skip the gzip header */
|
|
||||||
ret = inflateReset2(&strm, 31);
|
|
||||||
if (ret != Z_OK)
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
do {
|
|
||||||
if (strm.avail_in == 0) {
|
|
||||||
strm.avail_in = fread(input, 1, CHUNK, in);
|
|
||||||
if (ferror(in)) {
|
|
||||||
ret = Z_ERRNO;
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
}
|
|
||||||
if (strm.avail_in == 0) {
|
|
||||||
ret = Z_DATA_ERROR;
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
}
|
|
||||||
strm.next_in = input;
|
|
||||||
}
|
|
||||||
ret = inflate(&strm, Z_BLOCK);
|
|
||||||
if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR)
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
} while ((strm.data_type & 128) == 0);
|
|
||||||
|
|
||||||
/* set up to continue decompression of the raw deflate stream
|
|
||||||
that follows the gzip header */
|
|
||||||
ret = inflateReset2(&strm, -15);
|
|
||||||
if (ret != Z_OK)
|
|
||||||
goto deflate_index_extract_ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* continue to process the available input before reading more */
|
|
||||||
} while (strm.avail_out != 0);
|
|
||||||
|
|
||||||
if (ret == Z_STREAM_END)
|
|
||||||
/* reached the end of the compressed data -- return the data that
|
|
||||||
was available, possibly less than requested */
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* do until offset reached and requested data read */
|
|
||||||
} while (skip);
|
|
||||||
|
|
||||||
/* compute the number of uncompressed bytes read after the offset */
|
|
||||||
ret = skip ? 0 : len - strm.avail_out;
|
|
||||||
|
|
||||||
/* clean up and return the bytes read, or the negative error */
|
|
||||||
deflate_index_extract_ret:
|
|
||||||
(void)inflateEnd(&strm);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TEST
|
|
||||||
|
|
||||||
#define SPAN 1048576L /* desired distance between access points */
|
|
||||||
#define LEN 16384 /* number of bytes to extract */
|
|
||||||
|
|
||||||
/* Demonstrate the use of deflate_index_build() and deflate_index_extract() by
|
|
||||||
processing the file provided on the command line, and extracting LEN bytes
|
|
||||||
from 2/3rds of the way through the uncompressed output, writing that to
|
|
||||||
stdout. An offset can be provided as the second argument, in which case the
|
|
||||||
data is extracted from there instead. */
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
off_t offset = -1;
|
|
||||||
FILE *in;
|
|
||||||
struct deflate_index *index = NULL;
|
|
||||||
unsigned char buf[LEN];
|
|
||||||
|
|
||||||
/* open input file */
|
|
||||||
if (argc < 2 || argc > 3) {
|
|
||||||
fprintf(stderr, "usage: zran file.gz [offset]\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
in = fopen(argv[1], "rb");
|
|
||||||
if (in == NULL) {
|
|
||||||
fprintf(stderr, "zran: could not open %s for reading\n", argv[1]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get optional offset */
|
|
||||||
if (argc == 3) {
|
|
||||||
char *end;
|
|
||||||
offset = strtoll(argv[2], &end, 10);
|
|
||||||
if (*end || offset < 0) {
|
|
||||||
fprintf(stderr, "zran: %s is not a valid offset\n", argv[2]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* build index */
|
|
||||||
len = deflate_index_build(in, SPAN, &index);
|
|
||||||
if (len < 0) {
|
|
||||||
fclose(in);
|
|
||||||
switch (len) {
|
|
||||||
case Z_MEM_ERROR:
|
|
||||||
fprintf(stderr, "zran: out of memory\n");
|
|
||||||
break;
|
|
||||||
case Z_DATA_ERROR:
|
|
||||||
fprintf(stderr, "zran: compressed data error in %s\n", argv[1]);
|
|
||||||
break;
|
|
||||||
case Z_ERRNO:
|
|
||||||
fprintf(stderr, "zran: read error on %s\n", argv[1]);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "zran: error %d while building index\n", len);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
fprintf(stderr, "zran: built index with %d access points\n", len);
|
|
||||||
|
|
||||||
/* use index by reading some bytes from an arbitrary offset */
|
|
||||||
if (offset == -1)
|
|
||||||
offset = (index->length << 1) / 3;
|
|
||||||
len = deflate_index_extract(in, index, offset, buf, LEN);
|
|
||||||
if (len < 0)
|
|
||||||
fprintf(stderr, "zran: extraction failed: %s error\n",
|
|
||||||
len == Z_MEM_ERROR ? "out of memory" : "input corrupted");
|
|
||||||
else {
|
|
||||||
fwrite(buf, 1, len, stdout);
|
|
||||||
fprintf(stderr, "zran: extracted %d bytes at %llu\n", len, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* clean up and exit */
|
|
||||||
deflate_index_free(index);
|
|
||||||
fclose(in);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,40 +0,0 @@
|
||||||
/* zran.h -- example of zlib/gzip stream indexing and random access
|
|
||||||
* Copyright (C) 2005, 2012, 2018 Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
* Version 1.2 14 Oct 2018 Mark Adler */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "zlib.h"
|
|
||||||
|
|
||||||
/* Access point list. */
|
|
||||||
struct deflate_index {
|
|
||||||
int have; /* number of list entries */
|
|
||||||
int gzip; /* 1 if the index is of a gzip file, 0 if it is of a
|
|
||||||
zlib stream */
|
|
||||||
off_t length; /* total length of uncompressed data */
|
|
||||||
void *list; /* allocated list of entries */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Make one entire pass through a zlib or gzip compressed stream and build an
|
|
||||||
index, with access points about every span bytes of uncompressed output.
|
|
||||||
gzip files with multiple members are indexed in their entirety. span should
|
|
||||||
be chosen to balance the speed of random access against the memory
|
|
||||||
requirements of the list, about 32K bytes per access point. The return value
|
|
||||||
is the number of access points on success (>= 1), Z_MEM_ERROR for out of
|
|
||||||
memory, Z_DATA_ERROR for an error in the input file, or Z_ERRNO for a file
|
|
||||||
read error. On success, *built points to the resulting index. */
|
|
||||||
int deflate_index_build(FILE *in, off_t span, struct deflate_index **built);
|
|
||||||
|
|
||||||
/* Deallocate an index built by deflate_index_build() */
|
|
||||||
void deflate_index_free(struct deflate_index *index);
|
|
||||||
|
|
||||||
/* Use the index to read len bytes from offset into buf. Return bytes read or
|
|
||||||
negative for error (Z_DATA_ERROR or Z_MEM_ERROR). If data is requested past
|
|
||||||
the end of the uncompressed data, then deflate_index_extract() will return a
|
|
||||||
value less than len, indicating how much was actually read into buf. This
|
|
||||||
function should not return a data error unless the file was modified since
|
|
||||||
the index was generated, since deflate_index_build() validated all of the
|
|
||||||
input. deflate_index_extract() will return Z_ERRNO if there is an error on
|
|
||||||
reading or seeking the input file. */
|
|
||||||
int deflate_index_extract(FILE *in, struct deflate_index *index, off_t offset,
|
|
||||||
unsigned char *buf, int len);
|
|
Binary file not shown.
|
@ -1,152 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
# Transform K&R C function definitions into ANSI equivalent.
|
|
||||||
#
|
|
||||||
# Author: Paul Marquess
|
|
||||||
# Version: 1.0
|
|
||||||
# Date: 3 October 2006
|
|
||||||
|
|
||||||
# TODO
|
|
||||||
#
|
|
||||||
# Assumes no function pointer parameters. unless they are typedefed.
|
|
||||||
# Assumes no literal strings that look like function definitions
|
|
||||||
# Assumes functions start at the beginning of a line
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
local $/;
|
|
||||||
$_ = <>;
|
|
||||||
|
|
||||||
my $sp = qr{ \s* (?: /\* .*? \*/ )? \s* }x; # assume no nested comments
|
|
||||||
|
|
||||||
my $d1 = qr{ $sp (?: [\w\*\s]+ $sp)* $sp \w+ $sp [\[\]\s]* $sp }x ;
|
|
||||||
my $decl = qr{ $sp (?: \w+ $sp )+ $d1 }xo ;
|
|
||||||
my $dList = qr{ $sp $decl (?: $sp , $d1 )* $sp ; $sp }xo ;
|
|
||||||
|
|
||||||
|
|
||||||
while (s/^
|
|
||||||
( # Start $1
|
|
||||||
( # Start $2
|
|
||||||
.*? # Minimal eat content
|
|
||||||
( ^ \w [\w\s\*]+ ) # $3 -- function name
|
|
||||||
\s* # optional whitespace
|
|
||||||
) # $2 - Matched up to before parameter list
|
|
||||||
|
|
||||||
\( \s* # Literal "(" + optional whitespace
|
|
||||||
( [^\)]+ ) # $4 - one or more anythings except ")"
|
|
||||||
\s* \) # optional whitespace surrounding a Literal ")"
|
|
||||||
|
|
||||||
( (?: $dList )+ ) # $5
|
|
||||||
|
|
||||||
$sp ^ { # literal "{" at start of line
|
|
||||||
) # Remember to $1
|
|
||||||
//xsom
|
|
||||||
)
|
|
||||||
{
|
|
||||||
my $all = $1 ;
|
|
||||||
my $prefix = $2;
|
|
||||||
my $param_list = $4 ;
|
|
||||||
my $params = $5;
|
|
||||||
|
|
||||||
StripComments($params);
|
|
||||||
StripComments($param_list);
|
|
||||||
$param_list =~ s/^\s+//;
|
|
||||||
$param_list =~ s/\s+$//;
|
|
||||||
|
|
||||||
my $i = 0 ;
|
|
||||||
my %pList = map { $_ => $i++ }
|
|
||||||
split /\s*,\s*/, $param_list;
|
|
||||||
my $pMatch = '(\b' . join('|', keys %pList) . '\b)\W*$' ;
|
|
||||||
|
|
||||||
my @params = split /\s*;\s*/, $params;
|
|
||||||
my @outParams = ();
|
|
||||||
foreach my $p (@params)
|
|
||||||
{
|
|
||||||
if ($p =~ /,/)
|
|
||||||
{
|
|
||||||
my @bits = split /\s*,\s*/, $p;
|
|
||||||
my $first = shift @bits;
|
|
||||||
$first =~ s/^\s*//;
|
|
||||||
push @outParams, $first;
|
|
||||||
$first =~ /^(\w+\s*)/;
|
|
||||||
my $type = $1 ;
|
|
||||||
push @outParams, map { $type . $_ } @bits;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$p =~ s/^\s+//;
|
|
||||||
push @outParams, $p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
my %tmp = map { /$pMatch/; $_ => $pList{$1} }
|
|
||||||
@outParams ;
|
|
||||||
|
|
||||||
@outParams = map { " $_" }
|
|
||||||
sort { $tmp{$a} <=> $tmp{$b} }
|
|
||||||
@outParams ;
|
|
||||||
|
|
||||||
print $prefix ;
|
|
||||||
print "(\n" . join(",\n", @outParams) . ")\n";
|
|
||||||
print "{" ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# Output any trailing code.
|
|
||||||
print ;
|
|
||||||
exit 0;
|
|
||||||
|
|
||||||
|
|
||||||
sub StripComments
|
|
||||||
{
|
|
||||||
|
|
||||||
no warnings;
|
|
||||||
|
|
||||||
# Strip C & C++ comments
|
|
||||||
# From the perlfaq
|
|
||||||
$_[0] =~
|
|
||||||
|
|
||||||
s{
|
|
||||||
/\* ## Start of /* ... */ comment
|
|
||||||
[^*]*\*+ ## Non-* followed by 1-or-more *'s
|
|
||||||
(
|
|
||||||
[^/*][^*]*\*+
|
|
||||||
)* ## 0-or-more things which don't start with /
|
|
||||||
## but do end with '*'
|
|
||||||
/ ## End of /* ... */ comment
|
|
||||||
|
|
||||||
| ## OR C++ Comment
|
|
||||||
// ## Start of C++ comment //
|
|
||||||
[^\n]* ## followed by 0-or-more non end of line characters
|
|
||||||
|
|
||||||
| ## OR various things which aren't comments:
|
|
||||||
|
|
||||||
(
|
|
||||||
" ## Start of " ... " string
|
|
||||||
(
|
|
||||||
\\. ## Escaped char
|
|
||||||
| ## OR
|
|
||||||
[^"\\] ## Non "\
|
|
||||||
)*
|
|
||||||
" ## End of " ... " string
|
|
||||||
|
|
||||||
| ## OR
|
|
||||||
|
|
||||||
' ## Start of ' ... ' string
|
|
||||||
(
|
|
||||||
\\. ## Escaped char
|
|
||||||
| ## OR
|
|
||||||
[^'\\] ## Non '\
|
|
||||||
)*
|
|
||||||
' ## End of ' ... ' string
|
|
||||||
|
|
||||||
| ## OR
|
|
||||||
|
|
||||||
. ## Anything other char
|
|
||||||
[^/"'\\]* ## Chars which doesn't start a comment, string or escape
|
|
||||||
)
|
|
||||||
}{$2}gxs;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,9 +1,11 @@
|
||||||
cmake_minimum_required(VERSION 2.4.4)
|
cmake_minimum_required(VERSION 2.4.4...3.15.0)
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
||||||
|
|
||||||
project(zlib C)
|
project(zlib C)
|
||||||
|
|
||||||
set(VERSION "1.2.13")
|
set(VERSION "1.3.1")
|
||||||
|
|
||||||
|
option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON)
|
||||||
|
|
||||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
||||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
||||||
|
@ -148,7 +150,9 @@ if(MINGW)
|
||||||
endif(MINGW)
|
endif(MINGW)
|
||||||
|
|
||||||
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||||
|
target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||||
|
target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||||
set_target_properties(zlib PROPERTIES SOVERSION 1)
|
set_target_properties(zlib PROPERTIES SOVERSION 1)
|
||||||
|
|
||||||
|
@ -166,7 +170,7 @@ endif()
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
# On unix-like platforms the library is almost always called libz
|
# On unix-like platforms the library is almost always called libz
|
||||||
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
|
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
|
||||||
if(NOT APPLE)
|
if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
|
||||||
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
||||||
endif()
|
endif()
|
||||||
elseif(BUILD_SHARED_LIBS AND WIN32)
|
elseif(BUILD_SHARED_LIBS AND WIN32)
|
||||||
|
@ -193,21 +197,22 @@ endif()
|
||||||
#============================================================================
|
#============================================================================
|
||||||
# Example binaries
|
# Example binaries
|
||||||
#============================================================================
|
#============================================================================
|
||||||
|
if(ZLIB_BUILD_EXAMPLES)
|
||||||
|
add_executable(example test/example.c)
|
||||||
|
target_link_libraries(example zlib)
|
||||||
|
add_test(example example)
|
||||||
|
|
||||||
add_executable(example test/example.c)
|
add_executable(minigzip test/minigzip.c)
|
||||||
target_link_libraries(example zlib)
|
target_link_libraries(minigzip zlib)
|
||||||
add_test(example example)
|
|
||||||
|
|
||||||
add_executable(minigzip test/minigzip.c)
|
if(HAVE_OFF64_T)
|
||||||
target_link_libraries(minigzip zlib)
|
add_executable(example64 test/example.c)
|
||||||
|
target_link_libraries(example64 zlib)
|
||||||
|
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
||||||
|
add_test(example64 example64)
|
||||||
|
|
||||||
if(HAVE_OFF64_T)
|
add_executable(minigzip64 test/minigzip.c)
|
||||||
add_executable(example64 test/example.c)
|
target_link_libraries(minigzip64 zlib)
|
||||||
target_link_libraries(example64 zlib)
|
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
||||||
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
endif()
|
||||||
add_test(example64 example64)
|
|
||||||
|
|
||||||
add_executable(minigzip64 test/minigzip.c)
|
|
||||||
target_link_libraries(minigzip64 zlib)
|
|
||||||
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
|
||||||
endif()
|
endif()
|
|
@ -1,6 +1,34 @@
|
||||||
|
|
||||||
ChangeLog file for zlib
|
ChangeLog file for zlib
|
||||||
|
|
||||||
|
Changes in 1.3.1 (22 Jan 2024)
|
||||||
|
- Reject overflows of zip header fields in minizip
|
||||||
|
- Fix bug in inflateSync() for data held in bit buffer
|
||||||
|
- Add LIT_MEM define to use more memory for a small deflate speedup
|
||||||
|
- Fix decision on the emission of Zip64 end records in minizip
|
||||||
|
- Add bounds checking to ERR_MSG() macro, used by zError()
|
||||||
|
- Neutralize zip file traversal attacks in miniunz
|
||||||
|
- Fix a bug in ZLIB_DEBUG compiles in check_match()
|
||||||
|
- Various portability and appearance improvements
|
||||||
|
|
||||||
|
Changes in 1.3 (18 Aug 2023)
|
||||||
|
- Remove K&R function definitions and zlib2ansi
|
||||||
|
- Fix bug in deflateBound() for level 0 and memLevel 9
|
||||||
|
- Fix bug when gzungetc() is used immediately after gzopen()
|
||||||
|
- Fix bug when using gzflush() with a very small buffer
|
||||||
|
- Fix crash when gzsetparams() attempted for transparent write
|
||||||
|
- Fix test/example.c to work with FORCE_STORED
|
||||||
|
- Rewrite of zran in examples (see zran.c version history)
|
||||||
|
- Fix minizip to allow it to open an empty zip file
|
||||||
|
- Fix reading disk number start on zip64 files in minizip
|
||||||
|
- Fix logic error in minizip argument processing
|
||||||
|
- Add minizip testing to Makefile
|
||||||
|
- Read multiple bytes instead of byte-by-byte in minizip unzip.c
|
||||||
|
- Add memory sanitizer to configure (--memory)
|
||||||
|
- Various portability improvements
|
||||||
|
- Various documentation improvements
|
||||||
|
- Various spelling and typo corrections
|
||||||
|
|
||||||
Changes in 1.2.13 (13 Oct 2022)
|
Changes in 1.2.13 (13 Oct 2022)
|
||||||
- Fix configure issue that discarded provided CC definition
|
- Fix configure issue that discarded provided CC definition
|
||||||
- Correct incorrect inputs provided to the CRC functions
|
- Correct incorrect inputs provided to the CRC functions
|
||||||
|
@ -1445,7 +1473,7 @@ Changes in 0.99 (27 Jan 96)
|
||||||
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
|
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
|
||||||
- in fcalloc, normalize pointer if size > 65520 bytes
|
- in fcalloc, normalize pointer if size > 65520 bytes
|
||||||
- don't use special fcalloc for 32 bit Borland C++
|
- don't use special fcalloc for 32 bit Borland C++
|
||||||
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
|
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
|
||||||
- use Z_BINARY instead of BINARY
|
- use Z_BINARY instead of BINARY
|
||||||
- document that gzclose after gzdopen will close the file
|
- document that gzclose after gzdopen will close the file
|
||||||
- allow "a" as mode in gzopen
|
- allow "a" as mode in gzopen
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
If your question is not there, please check the zlib home page
|
If your question is not there, please check the zlib home page
|
||||||
http://zlib.net/ which may have more recent information.
|
http://zlib.net/ which may have more recent information.
|
||||||
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
|
The latest zlib FAQ is at http://zlib.net/zlib_faq.html
|
||||||
|
|
||||||
|
|
||||||
1. Is zlib Y2K-compliant?
|
1. Is zlib Y2K-compliant?
|
||||||
|
@ -14,8 +14,7 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
|
||||||
2. Where can I get a Windows DLL version?
|
2. Where can I get a Windows DLL version?
|
||||||
|
|
||||||
The zlib sources can be compiled without change to produce a DLL. See the
|
The zlib sources can be compiled without change to produce a DLL. See the
|
||||||
file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
|
file win32/DLL_FAQ.txt in the zlib distribution.
|
||||||
precompiled DLL are found in the zlib web site at http://zlib.net/ .
|
|
||||||
|
|
||||||
3. Where can I get a Visual Basic interface to zlib?
|
3. Where can I get a Visual Basic interface to zlib?
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Makefile for zlib
|
# Makefile for zlib
|
||||||
# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
|
# Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
|
||||||
# For conditions of distribution and use, see copyright notice in zlib.h
|
# For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
|
||||||
# To compile and test, type:
|
# To compile and test, type:
|
||||||
|
@ -22,13 +22,13 @@ CFLAGS=-O
|
||||||
|
|
||||||
SFLAGS=-O
|
SFLAGS=-O
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
TEST_LDFLAGS=$(LDFLAGS) -L. libz.a
|
TEST_LIBS=-L. libz.a
|
||||||
LDSHARED=$(CC)
|
LDSHARED=$(CC)
|
||||||
CPP=$(CC) -E
|
CPP=$(CC) -E
|
||||||
|
|
||||||
STATICLIB=libz.a
|
STATICLIB=libz.a
|
||||||
SHAREDLIB=libz.so
|
SHAREDLIB=libz.so
|
||||||
SHAREDLIBV=libz.so.1.2.13
|
SHAREDLIBV=libz.so.1.3.1
|
||||||
SHAREDLIBM=libz.so.1
|
SHAREDLIBM=libz.so.1
|
||||||
LIBS=$(STATICLIB) $(SHAREDLIBV)
|
LIBS=$(STATICLIB) $(SHAREDLIBV)
|
||||||
|
|
||||||
|
@ -282,10 +282,10 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
|
||||||
-@rmdir objs
|
-@rmdir objs
|
||||||
|
|
||||||
example$(EXE): example.o $(STATICLIB)
|
example$(EXE): example.o $(STATICLIB)
|
||||||
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
|
||||||
|
|
||||||
minigzip$(EXE): minigzip.o $(STATICLIB)
|
minigzip$(EXE): minigzip.o $(STATICLIB)
|
||||||
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
|
||||||
|
|
||||||
examplesh$(EXE): example.o $(SHAREDLIBV)
|
examplesh$(EXE): example.o $(SHAREDLIBV)
|
||||||
$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
|
$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
|
||||||
|
@ -294,10 +294,10 @@ minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
|
||||||
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
|
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
|
||||||
|
|
||||||
example64$(EXE): example64.o $(STATICLIB)
|
example64$(EXE): example64.o $(STATICLIB)
|
||||||
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS)
|
||||||
|
|
||||||
minigzip64$(EXE): minigzip64.o $(STATICLIB)
|
minigzip64$(EXE): minigzip64.o $(STATICLIB)
|
||||||
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS)
|
||||||
|
|
||||||
install-libs: $(LIBS)
|
install-libs: $(LIBS)
|
||||||
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
|
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
|
||||||
|
@ -359,8 +359,14 @@ zconf.h.cmakein: $(SRCDIR)zconf.h.in
|
||||||
zconf: $(SRCDIR)zconf.h.in
|
zconf: $(SRCDIR)zconf.h.in
|
||||||
cp -p $(SRCDIR)zconf.h.in zconf.h
|
cp -p $(SRCDIR)zconf.h.in zconf.h
|
||||||
|
|
||||||
|
minizip-test: static
|
||||||
|
cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
|
||||||
|
|
||||||
|
minizip-clean:
|
||||||
|
cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
|
||||||
|
|
||||||
mostlyclean: clean
|
mostlyclean: clean
|
||||||
clean:
|
clean: minizip-clean
|
||||||
rm -f *.o *.lo *~ \
|
rm -f *.o *.lo *~ \
|
||||||
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
|
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
|
||||||
example64$(EXE) minigzip64$(EXE) \
|
example64$(EXE) minigzip64$(EXE) \
|
|
@ -1,6 +1,6 @@
|
||||||
ZLIB DATA COMPRESSION LIBRARY
|
ZLIB DATA COMPRESSION LIBRARY
|
||||||
|
|
||||||
zlib 1.2.13 is a general purpose data compression library. All the code is
|
zlib 1.3.1 is a general purpose data compression library. All the code is
|
||||||
thread safe. The data format used by the zlib library is described by RFCs
|
thread safe. The data format used by the zlib library is described by RFCs
|
||||||
(Request for Comments) 1950 to 1952 in the files
|
(Request for Comments) 1950 to 1952 in the files
|
||||||
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
||||||
|
@ -29,18 +29,17 @@ PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
|
||||||
|
|
||||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||||
issue of Dr. Dobb's Journal; a copy of the article is available at
|
issue of Dr. Dobb's Journal; a copy of the article is available at
|
||||||
http://marknelson.us/1997/01/01/zlib-engine/ .
|
https://marknelson.us/posts/1997/01/01/zlib-engine.html .
|
||||||
|
|
||||||
The changes made in version 1.2.13 are documented in the file ChangeLog.
|
The changes made in version 1.3.1 are documented in the file ChangeLog.
|
||||||
|
|
||||||
Unsupported third party contributions are provided in directory contrib/ .
|
Unsupported third party contributions are provided in directory contrib/ .
|
||||||
|
|
||||||
zlib is available in Java using the java.util.zip package, documented at
|
zlib is available in Java using the java.util.zip package. Follow the API
|
||||||
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
|
Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
|
||||||
|
|
||||||
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
|
A Perl interface to zlib and bzip2 written by Paul Marquess <pmqs@cpan.org>
|
||||||
at CPAN (Comprehensive Perl Archive Network) sites, including
|
can be found at https://github.com/pmqs/IO-Compress .
|
||||||
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
|
|
||||||
|
|
||||||
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
||||||
available in Python 1.5 and later versions, see
|
available in Python 1.5 and later versions, see
|
||||||
|
@ -64,7 +63,7 @@ Notes for some targets:
|
||||||
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
|
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
|
||||||
when compiled with cc.
|
when compiled with cc.
|
||||||
|
|
||||||
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
|
- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
|
||||||
necessary to get gzprintf working correctly. This is done by configure.
|
necessary to get gzprintf working correctly. This is done by configure.
|
||||||
|
|
||||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
||||||
|
@ -84,7 +83,7 @@ Acknowledgments:
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
(C) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
#include "zutil.h"
|
#include "zutil.h"
|
||||||
|
|
||||||
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
|
||||||
|
|
||||||
#define BASE 65521U /* largest prime smaller than 65536 */
|
#define BASE 65521U /* largest prime smaller than 65536 */
|
||||||
#define NMAX 5552
|
#define NMAX 5552
|
||||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
||||||
|
@ -60,11 +58,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32_z(adler, buf, len)
|
uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
unsigned long sum2;
|
unsigned long sum2;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
|
@ -131,20 +125,12 @@ uLong ZEXPORT adler32_z(adler, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32(adler, buf, len)
|
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
return adler32_z(adler, buf, len);
|
return adler32_z(adler, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
local uLong adler32_combine_(adler1, adler2, len2)
|
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
unsigned long sum1;
|
unsigned long sum1;
|
||||||
unsigned long sum2;
|
unsigned long sum2;
|
||||||
unsigned rem;
|
unsigned rem;
|
||||||
|
@ -169,18 +155,10 @@ local uLong adler32_combine_(adler1, adler2, len2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
}
|
}
|
||||||
|
|
||||||
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
|
uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
}
|
}
|
|
@ -19,13 +19,8 @@
|
||||||
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
||||||
Z_STREAM_ERROR if the level parameter is invalid.
|
Z_STREAM_ERROR if the level parameter is invalid.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
|
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong sourceLen, int level) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
int level;
|
|
||||||
{
|
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
int err;
|
int err;
|
||||||
const uInt max = (uInt)-1;
|
const uInt max = (uInt)-1;
|
||||||
|
@ -65,12 +60,8 @@ int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
*/
|
*/
|
||||||
int ZEXPORT compress(dest, destLen, source, sourceLen)
|
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong sourceLen) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,9 +69,7 @@ int ZEXPORT compress(dest, destLen, source, sourceLen)
|
||||||
If the default memLevel or windowBits for deflateInit() is changed, then
|
If the default memLevel or windowBits for deflateInit() is changed, then
|
||||||
this function needs to be updated.
|
this function needs to be updated.
|
||||||
*/
|
*/
|
||||||
uLong ZEXPORT compressBound(sourceLen)
|
uLong ZEXPORT compressBound(uLong sourceLen) {
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
||||||
(sourceLen >> 25) + 13;
|
(sourceLen >> 25) + 13;
|
||||||
}
|
}
|
|
@ -25,7 +25,7 @@ if test $SRCDIR = "."; then
|
||||||
ZINCOUT="-I."
|
ZINCOUT="-I."
|
||||||
SRCDIR=""
|
SRCDIR=""
|
||||||
else
|
else
|
||||||
ZINC='-include zconf.h'
|
ZINC='-I. -include zconf.h'
|
||||||
ZINCOUT='-I. -I$(SRCDIR)'
|
ZINCOUT='-I. -I$(SRCDIR)'
|
||||||
SRCDIR="$SRCDIR/"
|
SRCDIR="$SRCDIR/"
|
||||||
fi
|
fi
|
||||||
|
@ -44,9 +44,8 @@ STATICLIB=libz.a
|
||||||
|
|
||||||
# extract zlib version numbers from zlib.h
|
# extract zlib version numbers from zlib.h
|
||||||
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
|
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
|
||||||
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h`
|
VER3=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\(\\.[0-9]\{1,\}\)\{1,2\}\).*/\1/p'`
|
||||||
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
|
VER1=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\)\\..*/\1/p'`
|
||||||
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
|
|
||||||
|
|
||||||
# establish commands for library building
|
# establish commands for library building
|
||||||
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
||||||
|
@ -90,7 +89,8 @@ build64=0
|
||||||
gcc=0
|
gcc=0
|
||||||
warn=0
|
warn=0
|
||||||
debug=0
|
debug=0
|
||||||
sanitize=0
|
address=0
|
||||||
|
memory=0
|
||||||
old_cc="$CC"
|
old_cc="$CC"
|
||||||
old_cflags="$CFLAGS"
|
old_cflags="$CFLAGS"
|
||||||
OBJC='$(OBJZ) $(OBJG)'
|
OBJC='$(OBJZ) $(OBJG)'
|
||||||
|
@ -102,7 +102,7 @@ leave()
|
||||||
if test "$*" != "0"; then
|
if test "$*" != "0"; then
|
||||||
echo "** $0 aborting." | tee -a configure.log
|
echo "** $0 aborting." | tee -a configure.log
|
||||||
fi
|
fi
|
||||||
rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
|
rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version
|
||||||
echo -------------------- >> configure.log
|
echo -------------------- >> configure.log
|
||||||
echo >> configure.log
|
echo >> configure.log
|
||||||
echo >> configure.log
|
echo >> configure.log
|
||||||
|
@ -141,7 +141,9 @@ case "$1" in
|
||||||
-c* | --const) zconst=1; shift ;;
|
-c* | --const) zconst=1; shift ;;
|
||||||
-w* | --warn) warn=1; shift ;;
|
-w* | --warn) warn=1; shift ;;
|
||||||
-d* | --debug) debug=1; shift ;;
|
-d* | --debug) debug=1; shift ;;
|
||||||
--sanitize) sanitize=1; shift ;;
|
--sanitize) address=1; shift ;;
|
||||||
|
--address) address=1; shift ;;
|
||||||
|
--memory) memory=1; shift ;;
|
||||||
*)
|
*)
|
||||||
echo "unknown option: $1" | tee -a configure.log
|
echo "unknown option: $1" | tee -a configure.log
|
||||||
echo "$0 --help for help" | tee -a configure.log
|
echo "$0 --help for help" | tee -a configure.log
|
||||||
|
@ -211,8 +213,11 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
|
||||||
CFLAGS="${CFLAGS} -Wall -Wextra"
|
CFLAGS="${CFLAGS} -Wall -Wextra"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test $sanitize -eq 1; then
|
if test $address -eq 1; then
|
||||||
CFLAGS="${CFLAGS} -g -fsanitize=address"
|
CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer"
|
||||||
|
fi
|
||||||
|
if test $memory -eq 1; then
|
||||||
|
CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer"
|
||||||
fi
|
fi
|
||||||
if test $debug -eq 1; then
|
if test $debug -eq 1; then
|
||||||
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
|
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
|
||||||
|
@ -260,7 +265,9 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
|
||||||
SHAREDLIBV=libz.$VER$shared_ext
|
SHAREDLIBV=libz.$VER$shared_ext
|
||||||
SHAREDLIBM=libz.$VER1$shared_ext
|
SHAREDLIBM=libz.$VER1$shared_ext
|
||||||
LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
|
LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
|
||||||
if libtool -V 2>&1 | grep Apple > /dev/null; then
|
if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then
|
||||||
|
AR="${CROSS_PREFIX}libtool"
|
||||||
|
elif libtool -V 2>&1 | grep Apple > /dev/null; then
|
||||||
AR="libtool"
|
AR="libtool"
|
||||||
else
|
else
|
||||||
AR="/usr/bin/libtool"
|
AR="/usr/bin/libtool"
|
||||||
|
@ -435,7 +442,7 @@ EOF
|
||||||
if test $shared -eq 1; then
|
if test $shared -eq 1; then
|
||||||
echo Checking for shared library support... | tee -a configure.log
|
echo Checking for shared library support... | tee -a configure.log
|
||||||
# we must test in two steps (cc then ld), required at least on SunOS 4.x
|
# we must test in two steps (cc then ld), required at least on SunOS 4.x
|
||||||
if try $CC -w -c $SFLAGS $test.c &&
|
if try $CC -c $SFLAGS $test.c &&
|
||||||
try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
|
try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
|
||||||
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
|
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
|
||||||
elif test -z "$old_cc" -a -z "$old_cflags"; then
|
elif test -z "$old_cc" -a -z "$old_cflags"; then
|
||||||
|
@ -860,7 +867,7 @@ echo prefix = $prefix >> configure.log
|
||||||
echo sharedlibdir = $sharedlibdir >> configure.log
|
echo sharedlibdir = $sharedlibdir >> configure.log
|
||||||
echo uname = $uname >> configure.log
|
echo uname = $uname >> configure.log
|
||||||
|
|
||||||
# udpate Makefile with the configure results
|
# update Makefile with the configure results
|
||||||
sed < ${SRCDIR}Makefile.in "
|
sed < ${SRCDIR}Makefile.in "
|
||||||
/^CC *=/s#=.*#=$CC#
|
/^CC *=/s#=.*#=$CC#
|
||||||
/^CFLAGS *=/s#=.*#=$CFLAGS#
|
/^CFLAGS *=/s#=.*#=$CFLAGS#
|
|
@ -8,8 +8,8 @@ It provides Ada-style access to the ZLib C library.
|
||||||
|
|
||||||
Here are the main changes since ZLib.Ada 1.2:
|
Here are the main changes since ZLib.Ada 1.2:
|
||||||
|
|
||||||
- Attension: ZLib.Read generic routine have a initialization requirement
|
- Attention: ZLib.Read generic routine have a initialization requirement
|
||||||
for Read_Last parameter now. It is a bit incompartible with previous version,
|
for Read_Last parameter now. It is a bit incompatible with previous version,
|
||||||
but extends functionality, we could use new parameters Allow_Read_Some and
|
but extends functionality, we could use new parameters Allow_Read_Some and
|
||||||
Flush now.
|
Flush now.
|
||||||
|
|
|
@ -65,12 +65,12 @@ procedure Test is
|
||||||
Time_Stamp : Ada.Calendar.Time;
|
Time_Stamp : Ada.Calendar.Time;
|
||||||
|
|
||||||
procedure Generate_File;
|
procedure Generate_File;
|
||||||
-- Generate file of spetsified size with some random data.
|
-- Generate file of specified size with some random data.
|
||||||
-- The random data is repeatable, for the good compression.
|
-- The random data is repeatable, for the good compression.
|
||||||
|
|
||||||
procedure Compare_Streams
|
procedure Compare_Streams
|
||||||
(Left, Right : in out Root_Stream_Type'Class);
|
(Left, Right : in out Root_Stream_Type'Class);
|
||||||
-- The procedure compearing data in 2 streams.
|
-- The procedure comparing data in 2 streams.
|
||||||
-- It is for compare data before and after compression/decompression.
|
-- It is for compare data before and after compression/decompression.
|
||||||
|
|
||||||
procedure Compare_Files (Left, Right : String);
|
procedure Compare_Files (Left, Right : String);
|
|
@ -62,7 +62,7 @@ package ZLib.Streams is
|
||||||
:= Default_Buffer_Size;
|
:= Default_Buffer_Size;
|
||||||
Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
|
Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
|
||||||
:= Default_Buffer_Size);
|
:= Default_Buffer_Size);
|
||||||
-- Create the Comression/Decompression stream.
|
-- Create the Compression/Decompression stream.
|
||||||
-- If mode is In_Stream then Write operation is disabled.
|
-- If mode is In_Stream then Write operation is disabled.
|
||||||
-- If mode is Out_Stream then Read operation is disabled.
|
-- If mode is Out_Stream then Read operation is disabled.
|
||||||
|
|
|
@ -204,7 +204,7 @@ package body ZLib is
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- We allow ZLib to make header only in case of default header type.
|
-- We allow ZLib to make header only in case of default header type.
|
||||||
-- Otherwise we would either do header by ourselfs, or do not do
|
-- Otherwise we would either do header by ourselves, or do not do
|
||||||
-- header at all.
|
-- header at all.
|
||||||
|
|
||||||
if Header = None or else Header = GZip then
|
if Header = None or else Header = GZip then
|
|
@ -114,7 +114,7 @@ package ZLib is
|
||||||
-- Compression strategy constants --
|
-- Compression strategy constants --
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
-- RLE stategy could be used only in version 1.2.0 and later.
|
-- RLE strategy could be used only in version 1.2.0 and later.
|
||||||
|
|
||||||
Filtered : constant Strategy_Type;
|
Filtered : constant Strategy_Type;
|
||||||
Huffman_Only : constant Strategy_Type;
|
Huffman_Only : constant Strategy_Type;
|
|
@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
|
||||||
const OutBuf: Pointer; BufSize: Integer);
|
const OutBuf: Pointer; BufSize: Integer);
|
||||||
|
|
||||||
const
|
const
|
||||||
zlib_version = '1.2.13';
|
zlib_version = '1.3.1';
|
||||||
|
|
||||||
type
|
type
|
||||||
EZlibError = class(Exception);
|
EZlibError = class(Exception);
|
|
@ -34,7 +34,7 @@ namespace DotZLib
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the checksum generator basewith a specified value
|
/// Initializes a new instance of the checksum generator base with a specified value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
/// <param name="initialValue">The value to set the current checksum to</param>
|
||||||
public ChecksumGeneratorBase(uint initialValue)
|
public ChecksumGeneratorBase(uint initialValue)
|
||||||
|
@ -61,7 +61,7 @@ namespace DotZLib
|
||||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||||
/// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one.
|
/// <remarks>All the other <c>Update</c> methods are implemented in terms of this one.
|
||||||
/// This is therefore the only method a derived class has to implement</remarks>
|
/// This is therefore the only method a derived class has to implement</remarks>
|
||||||
public abstract void Update(byte[] data, int offset, int count);
|
public abstract void Update(byte[] data, int offset, int count);
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace DotZLib
|
||||||
/// <remarks>This must be implemented by a derived class</remarks>
|
/// <remarks>This must be implemented by a derived class</remarks>
|
||||||
protected abstract void CleanUp();
|
protected abstract void CleanUp();
|
||||||
|
|
||||||
// performs the release of the handles and calls the dereived CleanUp()
|
// performs the release of the handles and calls the derived CleanUp()
|
||||||
private void CleanUp(bool isDisposing)
|
private void CleanUp(bool isDisposing)
|
||||||
{
|
{
|
||||||
if (!_isDisposed)
|
if (!_isDisposed)
|
||||||
|
@ -160,7 +160,7 @@ namespace DotZLib
|
||||||
#region Helper methods
|
#region Helper methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies a number of bytes to the internal codec buffer - ready for proccesing
|
/// Copies a number of bytes to the internal codec buffer - ready for processing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data">The byte array that contains the data to copy</param>
|
/// <param name="data">The byte array that contains the data to copy</param>
|
||||||
/// <param name="startIndex">The index of the first byte to copy</param>
|
/// <param name="startIndex">The index of the first byte to copy</param>
|
|
@ -246,7 +246,7 @@ namespace DotZLib
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Not suppported.
|
/// Not supported.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <param name="offset"></param>
|
||||||
/// <param name="origin"></param>
|
/// <param name="origin"></param>
|
||||||
|
@ -268,7 +268,7 @@ namespace DotZLib
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.
|
/// Gets/sets the current position in the <c>GZipStream</c>. Not supported.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>In this implementation this property is not supported</remarks>
|
/// <remarks>In this implementation this property is not supported</remarks>
|
||||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||||
|
@ -285,7 +285,7 @@ namespace DotZLib
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the size of the stream. Not suppported.
|
/// Gets the size of the stream. Not supported.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>In this implementation this property is not supported</remarks>
|
/// <remarks>In this implementation this property is not supported</remarks>
|
||||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
/// <exception cref="NotSupportedException">Always thrown</exception>
|
|
@ -156,7 +156,7 @@ namespace DotZLibTests
|
||||||
public void Info_Version()
|
public void Info_Version()
|
||||||
{
|
{
|
||||||
Info info = new Info();
|
Info info = new Info();
|
||||||
Assert.AreEqual("1.2.13", Info.Version);
|
Assert.AreEqual("1.3.1", Info.Version);
|
||||||
Assert.AreEqual(32, info.SizeOfUInt);
|
Assert.AreEqual(32, info.SizeOfUInt);
|
||||||
Assert.AreEqual(32, info.SizeOfULong);
|
Assert.AreEqual(32, info.SizeOfULong);
|
||||||
Assert.AreEqual(32, info.SizeOfPointer);
|
Assert.AreEqual(32, info.SizeOfPointer);
|
|
@ -36,7 +36,7 @@ Build instructions:
|
||||||
in the same directory as the DotZLib.build file.
|
in the same directory as the DotZLib.build file.
|
||||||
You can define 2 properties on the nant command-line to control the build:
|
You can define 2 properties on the nant command-line to control the build:
|
||||||
debug={true|false} to toggle between release/debug builds (default=true).
|
debug={true|false} to toggle between release/debug builds (default=true).
|
||||||
nunit={true|false} to include or esclude unit tests (default=true).
|
nunit={true|false} to include or exclude unit tests (default=true).
|
||||||
Also the target clean will remove binaries.
|
Also the target clean will remove binaries.
|
||||||
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
|
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
|
||||||
or ./DotZLib/bin/debug, depending on whether you are building the release
|
or ./DotZLib/bin/debug, depending on whether you are building the release
|
|
@ -16,12 +16,8 @@
|
||||||
|
|
||||||
window is a user-supplied window and output buffer that is 64K bytes.
|
window is a user-supplied window and output buffer that is 64K bytes.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
|
int ZEXPORT inflateBack9Init_(z_stream FAR *strm, unsigned char FAR *window,
|
||||||
z_stream FAR *strm;
|
const char *version, int stream_size) {
|
||||||
unsigned char FAR *window;
|
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
||||||
|
@ -51,8 +47,7 @@ int stream_size;
|
||||||
#ifdef MAKEFIXED
|
#ifdef MAKEFIXED
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void makefixed9(void)
|
void makefixed9(void) {
|
||||||
{
|
|
||||||
unsigned sym, bits, low, size;
|
unsigned sym, bits, low, size;
|
||||||
code *next, *lenfix, *distfix;
|
code *next, *lenfix, *distfix;
|
||||||
struct inflate_state state;
|
struct inflate_state state;
|
||||||
|
@ -214,13 +209,8 @@ void makefixed9(void)
|
||||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
||||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
|
int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc,
|
||||||
z_stream FAR *strm;
|
out_func out, void FAR *out_desc) {
|
||||||
in_func in;
|
|
||||||
void FAR *in_desc;
|
|
||||||
out_func out;
|
|
||||||
void FAR *out_desc;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
z_const unsigned char FAR *next; /* next input */
|
z_const unsigned char FAR *next; /* next input */
|
||||||
unsigned char FAR *put; /* next output */
|
unsigned char FAR *put; /* next output */
|
||||||
|
@ -603,9 +593,7 @@ void FAR *out_desc;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateBack9End(strm)
|
int ZEXPORT inflateBack9End(z_stream FAR *strm) {
|
||||||
z_stream FAR *strm;
|
|
||||||
{
|
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
ZFREE(strm, strm->state);
|
ZFREE(strm, strm->state);
|
|
@ -20,14 +20,14 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
|
ZEXTERN int ZEXPORT inflateBack9(z_stream FAR *strm,
|
||||||
in_func in, void FAR *in_desc,
|
in_func in, void FAR *in_desc,
|
||||||
out_func out, void FAR *out_desc));
|
out_func out, void FAR *out_desc);
|
||||||
ZEXTERN int ZEXPORT inflateBack9End OF((z_stream FAR *strm));
|
ZEXTERN int ZEXPORT inflateBack9End(z_stream FAR *strm);
|
||||||
ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm,
|
ZEXTERN int ZEXPORT inflateBack9Init_(z_stream FAR *strm,
|
||||||
unsigned char FAR *window,
|
unsigned char FAR *window,
|
||||||
const char *version,
|
const char *version,
|
||||||
int stream_size));
|
int stream_size);
|
||||||
#define inflateBack9Init(strm, window) \
|
#define inflateBack9Init(strm, window) \
|
||||||
inflateBack9Init_((strm), (window), \
|
inflateBack9Init_((strm), (window), \
|
||||||
ZLIB_VERSION, sizeof(z_stream))
|
ZLIB_VERSION, sizeof(z_stream))
|
|
@ -1,5 +1,5 @@
|
||||||
/* inftree9.c -- generate Huffman trees for efficient decoding
|
/* inftree9.c -- generate Huffman trees for efficient decoding
|
||||||
* Copyright (C) 1995-2022 Mark Adler
|
* Copyright (C) 1995-2024 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#define MAXBITS 15
|
#define MAXBITS 15
|
||||||
|
|
||||||
const char inflate9_copyright[] =
|
const char inflate9_copyright[] =
|
||||||
" inflate9 1.2.13 Copyright 1995-2022 Mark Adler ";
|
" inflate9 1.3.1 Copyright 1995-2024 Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
|
@ -29,14 +29,9 @@ const char inflate9_copyright[] =
|
||||||
table index bits. It will differ if the request is greater than the
|
table index bits. It will differ if the request is greater than the
|
||||||
longest code or if it is less than the shortest code.
|
longest code or if it is less than the shortest code.
|
||||||
*/
|
*/
|
||||||
int inflate_table9(type, lens, codes, table, bits, work)
|
int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes,
|
||||||
codetype type;
|
code FAR * FAR *table, unsigned FAR *bits,
|
||||||
unsigned short FAR *lens;
|
unsigned short FAR *work) {
|
||||||
unsigned codes;
|
|
||||||
code FAR * FAR *table;
|
|
||||||
unsigned FAR *bits;
|
|
||||||
unsigned short FAR *work;
|
|
||||||
{
|
|
||||||
unsigned len; /* a code's length in bits */
|
unsigned len; /* a code's length in bits */
|
||||||
unsigned sym; /* index of code symbols */
|
unsigned sym; /* index of code symbols */
|
||||||
unsigned min, max; /* minimum and maximum code lengths */
|
unsigned min, max; /* minimum and maximum code lengths */
|
||||||
|
@ -64,7 +59,7 @@ unsigned short FAR *work;
|
||||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||||
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
|
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
|
||||||
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
|
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
|
||||||
133, 133, 133, 133, 144, 194, 65};
|
133, 133, 133, 133, 144, 203, 77};
|
||||||
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
||||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
|
||||||
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
|
@ -41,8 +41,8 @@ typedef struct {
|
||||||
examples/enough.c found in the zlib distribution. The arguments to that
|
examples/enough.c found in the zlib distribution. The arguments to that
|
||||||
program are the number of symbols, the initial root table size, and the
|
program are the number of symbols, the initial root table size, and the
|
||||||
maximum bit length of a code. "enough 286 9 15" for literal/length codes
|
maximum bit length of a code. "enough 286 9 15" for literal/length codes
|
||||||
returns returns 852, and "enough 32 6 15" for distance codes returns 594.
|
returns 852, and "enough 32 6 15" for distance codes returns 594. The
|
||||||
The initial root table size (9 or 6) is found in the fifth argument of the
|
initial root table size (9 or 6) is found in the fifth argument of the
|
||||||
inflate_table() calls in infback9.c. If the root table size is changed,
|
inflate_table() calls in infback9.c. If the root table size is changed,
|
||||||
then these maximum sizes would be need to be recalculated and updated. */
|
then these maximum sizes would be need to be recalculated and updated. */
|
||||||
#define ENOUGH_LENS 852
|
#define ENOUGH_LENS 852
|
||||||
|
@ -56,6 +56,6 @@ typedef enum {
|
||||||
DISTS
|
DISTS
|
||||||
} codetype;
|
} codetype;
|
||||||
|
|
||||||
extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
|
extern int inflate_table9(codetype type, unsigned short FAR *lens,
|
||||||
unsigned codes, code FAR * FAR *table,
|
unsigned codes, code FAR * FAR *table,
|
||||||
unsigned FAR *bits, unsigned short FAR *work));
|
unsigned FAR *bits, unsigned short FAR *work);
|
|
@ -413,7 +413,7 @@ template<typename T1, typename T2>
|
||||||
class gzomanip2
|
class gzomanip2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Allows insertor to peek at internals
|
// Allows inserter to peek at internals
|
||||||
template <typename Ta, typename Tb>
|
template <typename Ta, typename Tb>
|
||||||
friend gzofstream&
|
friend gzofstream&
|
||||||
operator<<(gzofstream&,
|
operator<<(gzofstream&,
|
||||||
|
@ -452,7 +452,7 @@ template<typename T1, typename T2>
|
||||||
: func(f), val1(v1), val2(v2)
|
: func(f), val1(v1), val2(v2)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// Insertor applies underlying manipulator function to stream
|
// Inserter applies underlying manipulator function to stream
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
inline gzofstream&
|
inline gzofstream&
|
||||||
operator<<(gzofstream& s, const gzomanip2<T1,T2>& m)
|
operator<<(gzofstream& s, const gzomanip2<T1,T2>& m)
|
|
@ -1,4 +1,4 @@
|
||||||
CC=cc
|
CC?=cc
|
||||||
CFLAGS := $(CFLAGS) -O -I../..
|
CFLAGS := $(CFLAGS) -O -I../..
|
||||||
|
|
||||||
UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
|
UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
MiniZip 1.1 was derived from MiniZip at version 1.01f
|
||||||
|
|
||||||
|
Change in 1.0 (Okt 2009)
|
||||||
|
- **TODO - Add history**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- Autoconf -*-
|
# -*- Autoconf -*-
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_INIT([minizip], [1.2.13], [bugzilla.redhat.com])
|
AC_INIT([minizip], [1.3.1], [bugzilla.redhat.com])
|
||||||
AC_CONFIG_SRCDIR([minizip.c])
|
AC_CONFIG_SRCDIR([minizip.c])
|
||||||
AM_INIT_AUTOMAKE([foreign])
|
AM_INIT_AUTOMAKE([foreign])
|
||||||
LT_INIT
|
LT_INIT
|
|
@ -32,8 +32,7 @@
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Return the next byte in the pseudo-random sequence
|
* Return the next byte in the pseudo-random sequence
|
||||||
*/
|
*/
|
||||||
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
|
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
|
||||||
{
|
|
||||||
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||||
* unpredictable manner on 16-bit systems; not a problem
|
* unpredictable manner on 16-bit systems; not a problem
|
||||||
* with any known compiler so far, though */
|
* with any known compiler so far, though */
|
||||||
|
@ -46,8 +45,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Update the encryption keys with the next byte of plain text
|
* Update the encryption keys with the next byte of plain text
|
||||||
*/
|
*/
|
||||||
static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
|
static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) {
|
||||||
{
|
|
||||||
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
||||||
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
||||||
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
||||||
|
@ -63,8 +61,7 @@ static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
|
||||||
* Initialize the encryption keys and the random header according to
|
* Initialize the encryption keys and the random header according to
|
||||||
* the given password.
|
* the given password.
|
||||||
*/
|
*/
|
||||||
static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
|
static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
|
||||||
{
|
|
||||||
*(pkeys+0) = 305419896L;
|
*(pkeys+0) = 305419896L;
|
||||||
*(pkeys+1) = 591751049L;
|
*(pkeys+1) = 591751049L;
|
||||||
*(pkeys+2) = 878082192L;
|
*(pkeys+2) = 878082192L;
|
||||||
|
@ -93,8 +90,7 @@ static unsigned crypthead(const char* passwd, /* password string */
|
||||||
int bufSize,
|
int bufSize,
|
||||||
unsigned long* pkeys,
|
unsigned long* pkeys,
|
||||||
const z_crc_t* pcrc_32_tab,
|
const z_crc_t* pcrc_32_tab,
|
||||||
unsigned long crcForCrypting)
|
unsigned long crcForCrypting) {
|
||||||
{
|
|
||||||
unsigned n; /* index in random header */
|
unsigned n; /* index in random header */
|
||||||
int t; /* temporary */
|
int t; /* temporary */
|
||||||
int c; /* random byte */
|
int c; /* random byte */
|
|
@ -14,7 +14,7 @@
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(IOAPI_NO_64)
|
#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
|
||||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||||
#define FTELLO_FUNC(stream) ftello(stream)
|
#define FTELLO_FUNC(stream) ftello(stream)
|
||||||
|
@ -28,8 +28,7 @@
|
||||||
|
|
||||||
#include "ioapi.h"
|
#include "ioapi.h"
|
||||||
|
|
||||||
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
|
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc, const void*filename, int mode) {
|
||||||
{
|
|
||||||
if (pfilefunc->zfile_func64.zopen64_file != NULL)
|
if (pfilefunc->zfile_func64.zopen64_file != NULL)
|
||||||
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
|
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
|
||||||
else
|
else
|
||||||
|
@ -38,8 +37,7 @@ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
|
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) {
|
||||||
{
|
|
||||||
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
||||||
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
|
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
|
||||||
else
|
else
|
||||||
|
@ -52,8 +50,7 @@ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
|
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) {
|
||||||
{
|
|
||||||
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
||||||
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
|
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
|
||||||
else
|
else
|
||||||
|
@ -66,11 +63,9 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
|
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32, const zlib_filefunc_def* p_filefunc32) {
|
||||||
{
|
|
||||||
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
|
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
|
||||||
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
|
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
|
||||||
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
|
|
||||||
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
|
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
|
||||||
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
|
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
|
||||||
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
|
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
|
||||||
|
@ -84,16 +79,7 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
|
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
|
||||||
static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
|
||||||
static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
|
|
||||||
static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
|
||||||
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
|
|
||||||
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
|
|
||||||
{
|
|
||||||
FILE* file = NULL;
|
FILE* file = NULL;
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
@ -111,8 +97,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
|
static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) {
|
||||||
{
|
|
||||||
FILE* file = NULL;
|
FILE* file = NULL;
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
@ -131,24 +116,21 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
|
static uLong ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uLong size) {
|
||||||
{
|
|
||||||
uLong ret;
|
uLong ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
|
static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
|
||||||
{
|
|
||||||
uLong ret;
|
uLong ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
long ret;
|
long ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = ftell((FILE *)stream);
|
ret = ftell((FILE *)stream);
|
||||||
|
@ -156,16 +138,14 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
|
static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
ZPOS64_T ret;
|
ZPOS64_T ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
|
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
|
static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
|
||||||
{
|
|
||||||
int fseek_origin=0;
|
int fseek_origin=0;
|
||||||
long ret;
|
long ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
@ -188,8 +168,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
|
static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
|
||||||
{
|
|
||||||
int fseek_origin=0;
|
int fseek_origin=0;
|
||||||
long ret;
|
long ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
@ -208,32 +187,28 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if(FSEEKO_FUNC((FILE *)stream, (z_off_t)offset, fseek_origin) != 0)
|
if(FSEEKO_FUNC((FILE *)stream, (z_off64_t)offset, fseek_origin) != 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
|
static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = fclose((FILE *)stream);
|
ret = fclose((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
|
static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = ferror((FILE *)stream);
|
ret = ferror((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_fopen_filefunc (pzlib_filefunc_def)
|
void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
|
||||||
zlib_filefunc_def* pzlib_filefunc_def;
|
|
||||||
{
|
|
||||||
pzlib_filefunc_def->zopen_file = fopen_file_func;
|
pzlib_filefunc_def->zopen_file = fopen_file_func;
|
||||||
pzlib_filefunc_def->zread_file = fread_file_func;
|
pzlib_filefunc_def->zread_file = fread_file_func;
|
||||||
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
||||||
|
@ -244,8 +219,7 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
|
||||||
pzlib_filefunc_def->opaque = NULL;
|
pzlib_filefunc_def->opaque = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
|
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
|
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
|
||||||
pzlib_filefunc_def->zread_file = fread_file_func;
|
pzlib_filefunc_def->zread_file = fread_file_func;
|
||||||
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
|
@ -50,7 +50,7 @@
|
||||||
#define ftello64 ftell
|
#define ftello64 ftell
|
||||||
#define fseeko64 fseek
|
#define fseeko64 fseek
|
||||||
#else
|
#else
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
|
||||||
#define fopen64 fopen
|
#define fopen64 fopen
|
||||||
#define ftello64 ftello
|
#define ftello64 ftello
|
||||||
#define fseeko64 fseeko
|
#define fseeko64 fseeko
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
#include "mz64conf.h"
|
#include "mz64conf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* a type choosen by DEFINE */
|
/* a type chosen by DEFINE */
|
||||||
#ifdef HAVE_64BIT_INT_CUSTOM
|
#ifdef HAVE_64BIT_INT_CUSTOM
|
||||||
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
||||||
#else
|
#else
|
||||||
|
@ -134,17 +134,17 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
|
||||||
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
|
||||||
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
|
||||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
|
||||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
|
||||||
|
|
||||||
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
|
||||||
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin);
|
||||||
|
|
||||||
|
|
||||||
/* here is the "old" 32 bits structure structure */
|
/* here is the "old" 32 bits structure */
|
||||||
typedef struct zlib_filefunc_def_s
|
typedef struct zlib_filefunc_def_s
|
||||||
{
|
{
|
||||||
open_file_func zopen_file;
|
open_file_func zopen_file;
|
||||||
|
@ -157,9 +157,9 @@ typedef struct zlib_filefunc_def_s
|
||||||
voidpf opaque;
|
voidpf opaque;
|
||||||
} zlib_filefunc_def;
|
} zlib_filefunc_def;
|
||||||
|
|
||||||
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
|
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
|
||||||
typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
|
||||||
typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
|
typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode);
|
||||||
|
|
||||||
typedef struct zlib_filefunc64_def_s
|
typedef struct zlib_filefunc64_def_s
|
||||||
{
|
{
|
||||||
|
@ -173,8 +173,8 @@ typedef struct zlib_filefunc64_def_s
|
||||||
voidpf opaque;
|
voidpf opaque;
|
||||||
} zlib_filefunc64_def;
|
} zlib_filefunc64_def;
|
||||||
|
|
||||||
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
|
||||||
|
|
||||||
/* now internal definition, only for zip.c and unzip.h */
|
/* now internal definition, only for zip.c and unzip.h */
|
||||||
typedef struct zlib_filefunc64_32_def_s
|
typedef struct zlib_filefunc64_32_def_s
|
||||||
|
@ -193,11 +193,11 @@ typedef struct zlib_filefunc64_32_def_s
|
||||||
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
|
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
|
||||||
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
|
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
|
||||||
|
|
||||||
voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
|
voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
|
||||||
long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
|
long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
|
||||||
ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
|
ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
|
||||||
|
|
||||||
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
|
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
|
||||||
|
|
||||||
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
|
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
|
||||||
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
|
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
|
|
@ -38,14 +38,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode));
|
|
||||||
uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
|
||||||
uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
|
||||||
ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
|
||||||
int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
HANDLE hf;
|
HANDLE hf;
|
||||||
|
@ -57,8 +49,7 @@ static void win32_translate_open_mode(int mode,
|
||||||
DWORD* lpdwDesiredAccess,
|
DWORD* lpdwDesiredAccess,
|
||||||
DWORD* lpdwCreationDisposition,
|
DWORD* lpdwCreationDisposition,
|
||||||
DWORD* lpdwShareMode,
|
DWORD* lpdwShareMode,
|
||||||
DWORD* lpdwFlagsAndAttributes)
|
DWORD* lpdwFlagsAndAttributes) {
|
||||||
{
|
|
||||||
*lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
|
*lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
|
||||||
|
|
||||||
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||||
|
@ -79,8 +70,7 @@ static void win32_translate_open_mode(int mode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static voidpf win32_build_iowin(HANDLE hFile)
|
static voidpf win32_build_iowin(HANDLE hFile) {
|
||||||
{
|
|
||||||
voidpf ret=NULL;
|
voidpf ret=NULL;
|
||||||
|
|
||||||
if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
|
if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
|
||||||
|
@ -98,8 +88,7 @@ static voidpf win32_build_iowin(HANDLE hFile)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode)
|
voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) {
|
||||||
{
|
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
|
@ -127,8 +116,7 @@ voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode)
|
voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) {
|
||||||
{
|
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
|
@ -151,8 +139,7 @@ voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode)
|
voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) {
|
||||||
{
|
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
|
@ -171,8 +158,7 @@ voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode)
|
voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) {
|
||||||
{
|
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
|
@ -200,8 +186,7 @@ voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size)
|
uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) {
|
||||||
{
|
|
||||||
uLong ret=0;
|
uLong ret=0;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
if (stream!=NULL)
|
if (stream!=NULL)
|
||||||
|
@ -222,8 +207,7 @@ uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size)
|
uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
|
||||||
{
|
|
||||||
uLong ret=0;
|
uLong ret=0;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
if (stream!=NULL)
|
if (stream!=NULL)
|
||||||
|
@ -243,8 +227,7 @@ uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* b
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
|
static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) {
|
||||||
{
|
|
||||||
#ifdef IOWIN32_USING_WINRT_API
|
#ifdef IOWIN32_USING_WINRT_API
|
||||||
return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
|
return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
|
||||||
#else
|
#else
|
||||||
|
@ -263,8 +246,7 @@ static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *n
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream)
|
long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
long ret=-1;
|
long ret=-1;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
if (stream!=NULL)
|
if (stream!=NULL)
|
||||||
|
@ -286,8 +268,7 @@ long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream)
|
ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
ZPOS64_T ret= (ZPOS64_T)-1;
|
ZPOS64_T ret= (ZPOS64_T)-1;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
if (stream!=NULL)
|
if (stream!=NULL)
|
||||||
|
@ -311,8 +292,7 @@ ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin)
|
long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
|
||||||
{
|
|
||||||
DWORD dwMoveMethod=0xFFFFFFFF;
|
DWORD dwMoveMethod=0xFFFFFFFF;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
|
|
||||||
|
@ -349,8 +329,7 @@ long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,in
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin)
|
long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
|
||||||
{
|
|
||||||
DWORD dwMoveMethod=0xFFFFFFFF;
|
DWORD dwMoveMethod=0xFFFFFFFF;
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile = NULL;
|
||||||
long ret=-1;
|
long ret=-1;
|
||||||
|
@ -388,8 +367,7 @@ long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T off
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream)
|
int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
int ret=-1;
|
int ret=-1;
|
||||||
|
|
||||||
if (stream!=NULL)
|
if (stream!=NULL)
|
||||||
|
@ -406,8 +384,7 @@ int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream)
|
int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
int ret=-1;
|
int ret=-1;
|
||||||
if (stream!=NULL)
|
if (stream!=NULL)
|
||||||
{
|
{
|
||||||
|
@ -416,8 +393,7 @@ int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
|
void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
pzlib_filefunc_def->zopen_file = win32_open_file_func;
|
pzlib_filefunc_def->zopen_file = win32_open_file_func;
|
||||||
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
||||||
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
||||||
|
@ -428,8 +404,7 @@ void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
|
||||||
pzlib_filefunc_def->opaque = NULL;
|
pzlib_filefunc_def->opaque = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def)
|
void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
|
pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
|
||||||
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
||||||
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
||||||
|
@ -441,8 +416,7 @@ void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def)
|
void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
|
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
|
||||||
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
||||||
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
||||||
|
@ -454,8 +428,7 @@ void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def)
|
void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
|
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
|
||||||
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
||||||
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
|
@ -18,10 +18,10 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
|
||||||
void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
|
||||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||||
#define FTELLO_FUNC(stream) ftello(stream)
|
#define FTELLO_FUNC(stream) ftello(stream)
|
||||||
|
@ -79,13 +79,9 @@
|
||||||
|
|
||||||
/* change_file_date : change the date/time of a file
|
/* change_file_date : change the date/time of a file
|
||||||
filename : the filename of the file where date/time must be modified
|
filename : the filename of the file where date/time must be modified
|
||||||
dosdate : the new date at the MSDos format (4 bytes)
|
dosdate : the new date at the MSDOS format (4 bytes)
|
||||||
tmu_date : the SAME new date at the tm_unz format */
|
tmu_date : the SAME new date at the tm_unz format */
|
||||||
static void change_file_date(filename,dosdate,tmu_date)
|
static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) {
|
||||||
const char *filename;
|
|
||||||
uLong dosdate;
|
|
||||||
tm_unz tmu_date;
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
|
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
|
||||||
|
@ -115,6 +111,10 @@ static void change_file_date(filename,dosdate,tmu_date)
|
||||||
|
|
||||||
ut.actime=ut.modtime=mktime(&newdate);
|
ut.actime=ut.modtime=mktime(&newdate);
|
||||||
utime(filename,&ut);
|
utime(filename,&ut);
|
||||||
|
#else
|
||||||
|
(void)filename;
|
||||||
|
(void)dosdate;
|
||||||
|
(void)tmu_date;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -123,9 +123,7 @@ static void change_file_date(filename,dosdate,tmu_date)
|
||||||
/* mymkdir and change_file_date are not 100 % portable
|
/* mymkdir and change_file_date are not 100 % portable
|
||||||
As I don't know well Unix, I wait feedback for the unix portion */
|
As I don't know well Unix, I wait feedback for the unix portion */
|
||||||
|
|
||||||
static int mymkdir(dirname)
|
static int mymkdir(const char* dirname) {
|
||||||
const char* dirname;
|
|
||||||
{
|
|
||||||
int ret=0;
|
int ret=0;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ret = _mkdir(dirname);
|
ret = _mkdir(dirname);
|
||||||
|
@ -133,13 +131,13 @@ static int mymkdir(dirname)
|
||||||
ret = mkdir (dirname,0775);
|
ret = mkdir (dirname,0775);
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
ret = mkdir (dirname,0775);
|
ret = mkdir (dirname,0775);
|
||||||
|
#else
|
||||||
|
(void)dirname;
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int makedir (newdir)
|
static int makedir(const char *newdir) {
|
||||||
const char *newdir;
|
|
||||||
{
|
|
||||||
char *buffer ;
|
char *buffer ;
|
||||||
char *p;
|
char *p;
|
||||||
size_t len = strlen(newdir);
|
size_t len = strlen(newdir);
|
||||||
|
@ -187,14 +185,12 @@ static int makedir (newdir)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_banner()
|
static void do_banner(void) {
|
||||||
{
|
printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n");
|
||||||
printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
|
|
||||||
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
|
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_help()
|
static void do_help(void) {
|
||||||
{
|
|
||||||
printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
|
printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
|
||||||
" -e Extract without pathname (junk paths)\n" \
|
" -e Extract without pathname (junk paths)\n" \
|
||||||
" -x Extract with pathname\n" \
|
" -x Extract with pathname\n" \
|
||||||
|
@ -202,11 +198,10 @@ static void do_help()
|
||||||
" -l list files\n" \
|
" -l list files\n" \
|
||||||
" -d directory to extract into\n" \
|
" -d directory to extract into\n" \
|
||||||
" -o overwrite files without prompting\n" \
|
" -o overwrite files without prompting\n" \
|
||||||
" -p extract crypted file using password\n\n");
|
" -p extract encrypted file using password\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Display64BitsSize(ZPOS64_T n, int size_char)
|
static void Display64BitsSize(ZPOS64_T n, int size_char) {
|
||||||
{
|
|
||||||
/* to avoid compatibility problem , we do here the conversion */
|
/* to avoid compatibility problem , we do here the conversion */
|
||||||
char number[21];
|
char number[21];
|
||||||
int offset=19;
|
int offset=19;
|
||||||
|
@ -233,9 +228,7 @@ static void Display64BitsSize(ZPOS64_T n, int size_char)
|
||||||
printf("%s",&number[pos_string]);
|
printf("%s",&number[pos_string]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_list(uf)
|
static int do_list(unzFile uf) {
|
||||||
unzFile uf;
|
|
||||||
{
|
|
||||||
uLong i;
|
uLong i;
|
||||||
unz_global_info64 gi;
|
unz_global_info64 gi;
|
||||||
int err;
|
int err;
|
||||||
|
@ -250,7 +243,7 @@ static int do_list(uf)
|
||||||
char filename_inzip[256];
|
char filename_inzip[256];
|
||||||
unz_file_info64 file_info;
|
unz_file_info64 file_info;
|
||||||
uLong ratio=0;
|
uLong ratio=0;
|
||||||
const char *string_method;
|
const char *string_method = "";
|
||||||
char charCrypt=' ';
|
char charCrypt=' ';
|
||||||
err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK)
|
||||||
|
@ -261,7 +254,7 @@ static int do_list(uf)
|
||||||
if (file_info.uncompressed_size>0)
|
if (file_info.uncompressed_size>0)
|
||||||
ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size);
|
ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size);
|
||||||
|
|
||||||
/* display a '*' if the file is crypted */
|
/* display a '*' if the file is encrypted */
|
||||||
if ((file_info.flag & 1) != 0)
|
if ((file_info.flag & 1) != 0)
|
||||||
charCrypt='*';
|
charCrypt='*';
|
||||||
|
|
||||||
|
@ -311,12 +304,7 @@ static int do_list(uf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
|
||||||
unzFile uf;
|
|
||||||
const int* popt_extract_without_path;
|
|
||||||
int* popt_overwrite;
|
|
||||||
const char* password;
|
|
||||||
{
|
|
||||||
char filename_inzip[256];
|
char filename_inzip[256];
|
||||||
char* filename_withoutpath;
|
char* filename_withoutpath;
|
||||||
char* p;
|
char* p;
|
||||||
|
@ -368,6 +356,20 @@ static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,pa
|
||||||
else
|
else
|
||||||
write_filename = filename_withoutpath;
|
write_filename = filename_withoutpath;
|
||||||
|
|
||||||
|
if (write_filename[0]!='\0')
|
||||||
|
{
|
||||||
|
const char* relative_check = write_filename;
|
||||||
|
while (relative_check[1]!='\0')
|
||||||
|
{
|
||||||
|
if (relative_check[0]=='.' && relative_check[1]=='.')
|
||||||
|
write_filename = relative_check;
|
||||||
|
relative_check++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (write_filename[0]=='/' || write_filename[0]=='.')
|
||||||
|
write_filename++;
|
||||||
|
|
||||||
err = unzOpenCurrentFilePassword(uf,password);
|
err = unzOpenCurrentFilePassword(uf,password);
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK)
|
||||||
{
|
{
|
||||||
|
@ -473,12 +475,7 @@ static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,pa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
|
static int do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password) {
|
||||||
unzFile uf;
|
|
||||||
int opt_extract_without_path;
|
|
||||||
int opt_overwrite;
|
|
||||||
const char* password;
|
|
||||||
{
|
|
||||||
uLong i;
|
uLong i;
|
||||||
unz_global_info64 gi;
|
unz_global_info64 gi;
|
||||||
int err;
|
int err;
|
||||||
|
@ -508,13 +505,7 @@ static int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
|
static int do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password) {
|
||||||
unzFile uf;
|
|
||||||
const char* filename;
|
|
||||||
int opt_extract_without_path;
|
|
||||||
int opt_overwrite;
|
|
||||||
const char* password;
|
|
||||||
{
|
|
||||||
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
|
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
|
||||||
{
|
{
|
||||||
printf("file %s not found in the zipfile\n",filename);
|
printf("file %s not found in the zipfile\n",filename);
|
||||||
|
@ -530,10 +521,7 @@ static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(argc,argv)
|
int main(int argc, char *argv[]) {
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
|
||||||
const char *zipfilename=NULL;
|
const char *zipfilename=NULL;
|
||||||
const char *filename_to_extract=NULL;
|
const char *filename_to_extract=NULL;
|
||||||
const char *password=NULL;
|
const char *password=NULL;
|
||||||
|
@ -606,7 +594,7 @@ int main(argc,argv)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
strncpy(filename_try, zipfilename,MAXFILENAME-1);
|
strncpy(filename_try, zipfilename,MAXFILENAME-1);
|
||||||
/* strncpy doesnt append the trailing NULL, of the string is too long. */
|
/* strncpy doesn't append the trailing NULL, of the string is too long. */
|
||||||
filename_try[ MAXFILENAME ] = '\0';
|
filename_try[ MAXFILENAME ] = '\0';
|
||||||
|
|
||||||
# ifdef USEWIN32IOAPI
|
# ifdef USEWIN32IOAPI
|
|
@ -28,7 +28,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
|
||||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||||
#define FTELLO_FUNC(stream) ftello(stream)
|
#define FTELLO_FUNC(stream) ftello(stream)
|
||||||
|
@ -71,11 +71,9 @@
|
||||||
#define MAXFILENAME (256)
|
#define MAXFILENAME (256)
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static int filetime(f, tmzip, dt)
|
/* f: name of file to get info on, tmzip: return value: access,
|
||||||
const char *f; /* name of file to get info on */
|
modification and creation times, dt: dostime */
|
||||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||||
uLong *dt; /* dostime */
|
|
||||||
{
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
{
|
{
|
||||||
FILETIME ftLocal;
|
FILETIME ftLocal;
|
||||||
|
@ -95,11 +93,9 @@ static int filetime(f, tmzip, dt)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if defined(unix) || defined(__APPLE__)
|
#if defined(unix) || defined(__APPLE__)
|
||||||
static int filetime(f, tmzip, dt)
|
/* f: name of file to get info on, tmzip: return value: access,
|
||||||
const char *f; /* name of file to get info on */
|
modification and creation times, dt: dostime */
|
||||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||||
uLong *dt; /* dostime */
|
|
||||||
{
|
|
||||||
(void)dt;
|
(void)dt;
|
||||||
int ret=0;
|
int ret=0;
|
||||||
struct stat s; /* results of stat() */
|
struct stat s; /* results of stat() */
|
||||||
|
@ -114,7 +110,7 @@ static int filetime(f, tmzip, dt)
|
||||||
len = MAXFILENAME;
|
len = MAXFILENAME;
|
||||||
|
|
||||||
strncpy(name, f,MAXFILENAME-1);
|
strncpy(name, f,MAXFILENAME-1);
|
||||||
/* strncpy doesnt append the trailing NULL, of the string is too long. */
|
/* strncpy doesn't append the trailing NULL, of the string is too long. */
|
||||||
name[ MAXFILENAME ] = '\0';
|
name[ MAXFILENAME ] = '\0';
|
||||||
|
|
||||||
if (name[len - 1] == '/')
|
if (name[len - 1] == '/')
|
||||||
|
@ -138,11 +134,12 @@ static int filetime(f, tmzip, dt)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
uLong filetime(f, tmzip, dt)
|
/* f: name of file to get info on, tmzip: return value: access,
|
||||||
const char *f; /* name of file to get info on */
|
modification and creation times, dt: dostime */
|
||||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||||
uLong *dt; /* dostime */
|
(void)f;
|
||||||
{
|
(void)tmzip;
|
||||||
|
(void)dt;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -151,9 +148,7 @@ uLong filetime(f, tmzip, dt)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int check_exist_file(filename)
|
static int check_exist_file(const char* filename) {
|
||||||
const char* filename;
|
|
||||||
{
|
|
||||||
FILE* ftestexist;
|
FILE* ftestexist;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
ftestexist = FOPEN_FUNC(filename,"rb");
|
ftestexist = FOPEN_FUNC(filename,"rb");
|
||||||
|
@ -164,14 +159,12 @@ static int check_exist_file(filename)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_banner()
|
static void do_banner(void) {
|
||||||
{
|
|
||||||
printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
|
printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
|
||||||
printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
|
printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_help()
|
static void do_help(void) {
|
||||||
{
|
|
||||||
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
|
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
|
||||||
" -o Overwrite existing file.zip\n" \
|
" -o Overwrite existing file.zip\n" \
|
||||||
" -a Append to existing file.zip\n" \
|
" -a Append to existing file.zip\n" \
|
||||||
|
@ -183,8 +176,7 @@ static void do_help()
|
||||||
|
|
||||||
/* calculate the CRC32 of a file,
|
/* calculate the CRC32 of a file,
|
||||||
because to encrypt a file, we need known the CRC32 of the file before */
|
because to encrypt a file, we need known the CRC32 of the file before */
|
||||||
static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
|
static int getFileCrc(const char* filenameinzip, void* buf, unsigned long size_buf, unsigned long* result_crc) {
|
||||||
{
|
|
||||||
unsigned long calculate_crc=0;
|
unsigned long calculate_crc=0;
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
FILE * fin = FOPEN_FUNC(filenameinzip,"rb");
|
FILE * fin = FOPEN_FUNC(filenameinzip,"rb");
|
||||||
|
@ -222,8 +214,7 @@ static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int isLargeFile(const char* filename)
|
static int isLargeFile(const char* filename) {
|
||||||
{
|
|
||||||
int largeFile = 0;
|
int largeFile = 0;
|
||||||
ZPOS64_T pos = 0;
|
ZPOS64_T pos = 0;
|
||||||
FILE* pFile = FOPEN_FUNC(filename, "rb");
|
FILE* pFile = FOPEN_FUNC(filename, "rb");
|
||||||
|
@ -233,7 +224,7 @@ static int isLargeFile(const char* filename)
|
||||||
FSEEKO_FUNC(pFile, 0, SEEK_END);
|
FSEEKO_FUNC(pFile, 0, SEEK_END);
|
||||||
pos = (ZPOS64_T)FTELLO_FUNC(pFile);
|
pos = (ZPOS64_T)FTELLO_FUNC(pFile);
|
||||||
|
|
||||||
printf("File : %s is %lld bytes\n", filename, pos);
|
printf("File : %s is %llu bytes\n", filename, pos);
|
||||||
|
|
||||||
if(pos >= 0xffffffff)
|
if(pos >= 0xffffffff)
|
||||||
largeFile = 1;
|
largeFile = 1;
|
||||||
|
@ -244,10 +235,7 @@ static int isLargeFile(const char* filename)
|
||||||
return largeFile;
|
return largeFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(argc,argv)
|
int main(int argc, char *argv[]) {
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
int opt_overwrite=0;
|
int opt_overwrite=0;
|
||||||
int opt_compress_level=Z_DEFAULT_COMPRESSION;
|
int opt_compress_level=Z_DEFAULT_COMPRESSION;
|
||||||
|
@ -323,7 +311,7 @@ int main(argc,argv)
|
||||||
|
|
||||||
zipok = 1 ;
|
zipok = 1 ;
|
||||||
strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
|
strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
|
||||||
/* strncpy doesnt append the trailing NULL, of the string is too long. */
|
/* strncpy doesn't append the trailing NULL, of the string is too long. */
|
||||||
filename_try[ MAXFILENAME ] = '\0';
|
filename_try[ MAXFILENAME ] = '\0';
|
||||||
|
|
||||||
len=(int)strlen(filename_try);
|
len=(int)strlen(filename_try);
|
||||||
|
@ -393,10 +381,10 @@ int main(argc,argv)
|
||||||
((argv[i][1]=='o') || (argv[i][1]=='O') ||
|
((argv[i][1]=='o') || (argv[i][1]=='O') ||
|
||||||
(argv[i][1]=='a') || (argv[i][1]=='A') ||
|
(argv[i][1]=='a') || (argv[i][1]=='A') ||
|
||||||
(argv[i][1]=='p') || (argv[i][1]=='P') ||
|
(argv[i][1]=='p') || (argv[i][1]=='P') ||
|
||||||
((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
|
((argv[i][1]>='0') && (argv[i][1]<='9'))) &&
|
||||||
(strlen(argv[i]) == 2)))
|
(strlen(argv[i]) == 2)))
|
||||||
{
|
{
|
||||||
FILE * fin;
|
FILE * fin = NULL;
|
||||||
size_t size_read;
|
size_t size_read;
|
||||||
const char* filenameinzip = argv[i];
|
const char* filenameinzip = argv[i];
|
||||||
const char *savefilenameinzip;
|
const char *savefilenameinzip;
|
|
@ -27,13 +27,7 @@
|
||||||
WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
|
WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
|
extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered) {
|
||||||
const char* file;
|
|
||||||
const char* fileOut;
|
|
||||||
const char* fileOutTmp;
|
|
||||||
uLong* nRecovered;
|
|
||||||
uLong* bytesRecovered;
|
|
||||||
{
|
|
||||||
int err = Z_OK;
|
int err = Z_OK;
|
||||||
FILE* fpZip = fopen(file, "rb");
|
FILE* fpZip = fopen(file, "rb");
|
||||||
FILE* fpOut = fopen(fileOut, "wb");
|
FILE* fpOut = fopen(fileOut, "wb");
|
|
@ -49,12 +49,12 @@
|
||||||
Copyright (C) 2007-2008 Even Rouault
|
Copyright (C) 2007-2008 Even Rouault
|
||||||
|
|
||||||
|
|
||||||
Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again).
|
Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again).
|
||||||
Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
|
Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
|
||||||
should only read the compressed/uncompressed size from the Zip64 format if
|
should only read the compressed/uncompressed size from the Zip64 format if
|
||||||
the size from normal header was 0xFFFFFFFF
|
the size from normal header was 0xFFFFFFFF
|
||||||
Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant
|
Oct-2009 - Mathias Svensson - Applied some bug fixes from patches received from Gilles Vollant
|
||||||
Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required)
|
Oct-2009 - Mathias Svensson - Applied support to unzip files with compression method BZIP2 (bzip2 lib is required)
|
||||||
Patch created by Daniel Borca
|
Patch created by Daniel Borca
|
||||||
|
|
||||||
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
||||||
|
@ -77,8 +77,6 @@
|
||||||
|
|
||||||
#ifdef STDC
|
#ifdef STDC
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include <string.h>
|
|
||||||
# include <stdlib.h>
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_ERRNO_H
|
#ifdef NO_ERRNO_H
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
@ -111,9 +109,6 @@
|
||||||
#ifndef ALLOC
|
#ifndef ALLOC
|
||||||
# define ALLOC(size) (malloc(size))
|
# define ALLOC(size) (malloc(size))
|
||||||
#endif
|
#endif
|
||||||
#ifndef TRYFREE
|
|
||||||
# define TRYFREE(p) { free(p);}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SIZECENTRALDIRITEM (0x2e)
|
#define SIZECENTRALDIRITEM (0x2e)
|
||||||
#define SIZEZIPLOCALHEADER (0x1e)
|
#define SIZEZIPLOCALHEADER (0x1e)
|
||||||
|
@ -122,7 +117,7 @@
|
||||||
const char unz_copyright[] =
|
const char unz_copyright[] =
|
||||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||||
|
|
||||||
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
/* unz_file_info64_internal contain internal info about a file in zipfile*/
|
||||||
typedef struct unz_file_info64_internal_s
|
typedef struct unz_file_info64_internal_s
|
||||||
{
|
{
|
||||||
ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */
|
ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */
|
||||||
|
@ -153,7 +148,7 @@ typedef struct
|
||||||
ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
|
ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
|
||||||
ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
|
ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
|
||||||
zlib_filefunc64_32_def z_filefunc;
|
zlib_filefunc64_32_def z_filefunc;
|
||||||
voidpf filestream; /* io structore of the zipfile */
|
voidpf filestream; /* io structure of the zipfile */
|
||||||
uLong compression_method; /* compression method (0==store) */
|
uLong compression_method; /* compression method (0==store) */
|
||||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||||
int raw;
|
int raw;
|
||||||
|
@ -166,7 +161,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def z_filefunc;
|
zlib_filefunc64_32_def z_filefunc;
|
||||||
int is64bitOpenFunction;
|
int is64bitOpenFunction;
|
||||||
voidpf filestream; /* io structore of the zipfile */
|
voidpf filestream; /* io structure of the zipfile */
|
||||||
unz_global_info64 gi; /* public global information */
|
unz_global_info64 gi; /* public global information */
|
||||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||||
ZPOS64_T num_file; /* number of the current file in the zipfile*/
|
ZPOS64_T num_file; /* number of the current file in the zipfile*/
|
||||||
|
@ -197,29 +192,44 @@ typedef struct
|
||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
|
Reads a long in LSB order from the given gz_stream. Sets
|
||||||
for end of file.
|
|
||||||
IN assertion: the stream s has been successfully opened for reading.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
local int unz64local_getByte OF((
|
voidpf filestream,
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
uLong *pX) {
|
||||||
voidpf filestream,
|
unsigned char c[2];
|
||||||
int *pi));
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,2);
|
||||||
|
if (err==2)
|
||||||
local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
|
|
||||||
{
|
|
||||||
unsigned char c;
|
|
||||||
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
|
|
||||||
if (err==1)
|
|
||||||
{
|
{
|
||||||
*pi = (int)c;
|
*pX = c[0] | ((uLong)c[1] << 8);
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*pX = 0;
|
||||||
|
if (ZERROR64(*pzlib_filefunc_def,filestream))
|
||||||
|
return UNZ_ERRNO;
|
||||||
|
else
|
||||||
|
return UNZ_EOF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local int unz64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
|
voidpf filestream,
|
||||||
|
uLong *pX) {
|
||||||
|
unsigned char c[4];
|
||||||
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,4);
|
||||||
|
if (err==4)
|
||||||
|
{
|
||||||
|
*pX = c[0] | ((uLong)c[1] << 8) | ((uLong)c[2] << 16) | ((uLong)c[3] << 24);
|
||||||
|
return UNZ_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pX = 0;
|
||||||
if (ZERROR64(*pzlib_filefunc_def,filestream))
|
if (ZERROR64(*pzlib_filefunc_def,filestream))
|
||||||
return UNZ_ERRNO;
|
return UNZ_ERRNO;
|
||||||
else
|
else
|
||||||
|
@ -228,126 +238,29 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
local int unz64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
Reads a long in LSB order from the given gz_stream. Sets
|
voidpf filestream,
|
||||||
*/
|
ZPOS64_T *pX) {
|
||||||
local int unz64local_getShort OF((
|
unsigned char c[8];
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,8);
|
||||||
voidpf filestream,
|
if (err==8)
|
||||||
uLong *pX));
|
{
|
||||||
|
*pX = c[0] | ((ZPOS64_T)c[1] << 8) | ((ZPOS64_T)c[2] << 16) | ((ZPOS64_T)c[3] << 24)
|
||||||
local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
| ((ZPOS64_T)c[4] << 32) | ((ZPOS64_T)c[5] << 40) | ((ZPOS64_T)c[6] << 48) | ((ZPOS64_T)c[7] << 56);
|
||||||
voidpf filestream,
|
return UNZ_OK;
|
||||||
uLong *pX)
|
}
|
||||||
{
|
|
||||||
uLong x ;
|
|
||||||
int i = 0;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x = (uLong)i;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((uLong)i)<<8;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
*pX = x;
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*pX = 0;
|
*pX = 0;
|
||||||
return err;
|
if (ZERROR64(*pzlib_filefunc_def,filestream))
|
||||||
}
|
return UNZ_ERRNO;
|
||||||
|
else
|
||||||
local int unz64local_getLong OF((
|
return UNZ_EOF;
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
}
|
||||||
voidpf filestream,
|
|
||||||
uLong *pX));
|
|
||||||
|
|
||||||
local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
||||||
voidpf filestream,
|
|
||||||
uLong *pX)
|
|
||||||
{
|
|
||||||
uLong x ;
|
|
||||||
int i = 0;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x = (uLong)i;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((uLong)i)<<8;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((uLong)i)<<16;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x += ((uLong)i)<<24;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
*pX = x;
|
|
||||||
else
|
|
||||||
*pX = 0;
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
local int unz64local_getLong64 OF((
|
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
||||||
voidpf filestream,
|
|
||||||
ZPOS64_T *pX));
|
|
||||||
|
|
||||||
|
|
||||||
local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
||||||
voidpf filestream,
|
|
||||||
ZPOS64_T *pX)
|
|
||||||
{
|
|
||||||
ZPOS64_T x ;
|
|
||||||
int i = 0;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x = (ZPOS64_T)i;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<8;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<16;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<24;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<32;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<40;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<48;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<56;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
*pX = x;
|
|
||||||
else
|
|
||||||
*pX = 0;
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* My own strcmpi / strcasecmp */
|
/* My own strcmpi / strcasecmp */
|
||||||
local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)
|
local int strcmpcasenosensitive_internal(const char* fileName1, const char* fileName2) {
|
||||||
{
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
char c1=*(fileName1++);
|
char c1=*(fileName1++);
|
||||||
|
@ -379,19 +292,17 @@ local int strcmpcasenosensitive_internal (const char* fileName1, const char* fil
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compare two filename (fileName1,fileName2).
|
Compare two filenames (fileName1,fileName2).
|
||||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
|
||||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
|
||||||
or strcasecmp)
|
or strcasecmp)
|
||||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
If iCaseSensitivity = 0, case sensitivity is default of your operating system
|
||||||
(like 1 on Unix, 2 on Windows)
|
(like 1 on Unix, 2 on Windows)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
|
extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
|
||||||
const char* fileName2,
|
const char* fileName2,
|
||||||
int iCaseSensitivity)
|
int iCaseSensitivity) {
|
||||||
|
|
||||||
{
|
|
||||||
if (iCaseSensitivity==0)
|
if (iCaseSensitivity==0)
|
||||||
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
|
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
|
||||||
|
|
||||||
|
@ -405,21 +316,23 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
|
||||||
#define BUFREADCOMMENT (0x400)
|
#define BUFREADCOMMENT (0x400)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CENTRALDIRINVALID
|
||||||
|
#define CENTRALDIRINVALID ((ZPOS64_T)(-1))
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Locate the Central directory of a zipfile (at the end, just before
|
Locate the Central directory of a zipfile (at the end, just before
|
||||||
the global comment)
|
the global comment)
|
||||||
*/
|
*/
|
||||||
local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
||||||
local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
|
||||||
{
|
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ZPOS64_T uSizeFile;
|
ZPOS64_T uSizeFile;
|
||||||
ZPOS64_T uBackRead;
|
ZPOS64_T uBackRead;
|
||||||
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
|
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
|
||||||
ZPOS64_T uPosFound=0;
|
ZPOS64_T uPosFound=CENTRALDIRINVALID;
|
||||||
|
|
||||||
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
|
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
|
|
||||||
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
|
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
|
||||||
|
@ -429,7 +342,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
|
|
||||||
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
|
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
|
||||||
if (buf==NULL)
|
if (buf==NULL)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
uBackRead = 4;
|
uBackRead = 4;
|
||||||
while (uBackRead<uMaxBack)
|
while (uBackRead<uMaxBack)
|
||||||
|
@ -459,10 +372,10 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uPosFound!=0)
|
if (uPosFound!=CENTRALDIRINVALID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRYFREE(buf);
|
free(buf);
|
||||||
return uPosFound;
|
return uPosFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,23 +384,18 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
Locate the Central directory 64 of a zipfile (at the end, just before
|
Locate the Central directory 64 of a zipfile (at the end, just before
|
||||||
the global comment)
|
the global comment)
|
||||||
*/
|
*/
|
||||||
local ZPOS64_T unz64local_SearchCentralDir64 OF((
|
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
||||||
voidpf filestream));
|
|
||||||
|
|
||||||
local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
voidpf filestream)
|
voidpf filestream) {
|
||||||
{
|
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ZPOS64_T uSizeFile;
|
ZPOS64_T uSizeFile;
|
||||||
ZPOS64_T uBackRead;
|
ZPOS64_T uBackRead;
|
||||||
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
|
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
|
||||||
ZPOS64_T uPosFound=0;
|
ZPOS64_T uPosFound=CENTRALDIRINVALID;
|
||||||
uLong uL;
|
uLong uL;
|
||||||
ZPOS64_T relativeOffset;
|
ZPOS64_T relativeOffset;
|
||||||
|
|
||||||
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
|
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
|
|
||||||
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
|
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
|
||||||
|
@ -497,7 +405,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
|
|
||||||
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
|
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
|
||||||
if (buf==NULL)
|
if (buf==NULL)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
uBackRead = 4;
|
uBackRead = 4;
|
||||||
while (uBackRead<uMaxBack)
|
while (uBackRead<uMaxBack)
|
||||||
|
@ -527,47 +435,47 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uPosFound!=0)
|
if (uPosFound!=CENTRALDIRINVALID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRYFREE(buf);
|
free(buf);
|
||||||
if (uPosFound == 0)
|
if (uPosFound == CENTRALDIRINVALID)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* Zip64 end of central directory locator */
|
/* Zip64 end of central directory locator */
|
||||||
if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* the signature, already checked */
|
/* the signature, already checked */
|
||||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* number of the disk with the start of the zip64 end of central directory */
|
/* number of the disk with the start of the zip64 end of central directory */
|
||||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
if (uL != 0)
|
if (uL != 0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* relative offset of the zip64 end of central directory record */
|
/* relative offset of the zip64 end of central directory record */
|
||||||
if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
|
if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* total number of disks */
|
/* total number of disks */
|
||||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
if (uL != 1)
|
if (uL != 1)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* Goto end of central directory record */
|
/* Goto end of central directory record */
|
||||||
if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* the signature */
|
/* the signature */
|
||||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
if (uL != 0x06064b50)
|
if (uL != 0x06064b50)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
return relativeOffset;
|
return relativeOffset;
|
||||||
}
|
}
|
||||||
|
@ -581,19 +489,18 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
Else, the return value is a unzFile Handle, usable with other function
|
Else, the return value is a unzFile Handle, usable with other function
|
||||||
of this unzip package.
|
of this unzip package.
|
||||||
*/
|
*/
|
||||||
local unzFile unzOpenInternal (const void *path,
|
local unzFile unzOpenInternal(const void *path,
|
||||||
zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
|
zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
|
||||||
int is64bitOpenFunction)
|
int is64bitOpenFunction) {
|
||||||
{
|
|
||||||
unz64_s us;
|
unz64_s us;
|
||||||
unz64_s *s;
|
unz64_s *s;
|
||||||
ZPOS64_T central_pos;
|
ZPOS64_T central_pos;
|
||||||
uLong uL;
|
uLong uL;
|
||||||
|
|
||||||
uLong number_disk; /* number of the current dist, used for
|
uLong number_disk; /* number of the current disk, used for
|
||||||
spaning ZIP, unsupported, always 0*/
|
spanning ZIP, unsupported, always 0*/
|
||||||
uLong number_disk_with_CD; /* number the the disk with central dir, used
|
uLong number_disk_with_CD; /* number the disk with central dir, used
|
||||||
for spaning ZIP, unsupported, always 0*/
|
for spanning ZIP, unsupported, always 0*/
|
||||||
ZPOS64_T number_entry_CD; /* total number of entries in
|
ZPOS64_T number_entry_CD; /* total number of entries in
|
||||||
the central dir
|
the central dir
|
||||||
(same than number_entry on nospan) */
|
(same than number_entry on nospan) */
|
||||||
|
@ -621,7 +528,7 @@ local unzFile unzOpenInternal (const void *path,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
|
central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
|
||||||
if (central_pos)
|
if (central_pos!=CENTRALDIRINVALID)
|
||||||
{
|
{
|
||||||
uLong uS;
|
uLong uS;
|
||||||
ZPOS64_T uL64;
|
ZPOS64_T uL64;
|
||||||
|
@ -683,7 +590,7 @@ local unzFile unzOpenInternal (const void *path,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
|
central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
|
||||||
if (central_pos==0)
|
if (central_pos==CENTRALDIRINVALID)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
|
||||||
us.isZip64 = 0;
|
us.isZip64 = 0;
|
||||||
|
@ -762,9 +669,8 @@ local unzFile unzOpenInternal (const void *path,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen2 (const char *path,
|
extern unzFile ZEXPORT unzOpen2(const char *path,
|
||||||
zlib_filefunc_def* pzlib_filefunc32_def)
|
zlib_filefunc_def* pzlib_filefunc32_def) {
|
||||||
{
|
|
||||||
if (pzlib_filefunc32_def != NULL)
|
if (pzlib_filefunc32_def != NULL)
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||||
|
@ -775,9 +681,8 @@ extern unzFile ZEXPORT unzOpen2 (const char *path,
|
||||||
return unzOpenInternal(path, NULL, 0);
|
return unzOpenInternal(path, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen2_64 (const void *path,
|
extern unzFile ZEXPORT unzOpen2_64(const void *path,
|
||||||
zlib_filefunc64_def* pzlib_filefunc_def)
|
zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
if (pzlib_filefunc_def != NULL)
|
if (pzlib_filefunc_def != NULL)
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||||
|
@ -790,13 +695,11 @@ extern unzFile ZEXPORT unzOpen2_64 (const void *path,
|
||||||
return unzOpenInternal(path, NULL, 1);
|
return unzOpenInternal(path, NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen (const char *path)
|
extern unzFile ZEXPORT unzOpen(const char *path) {
|
||||||
{
|
|
||||||
return unzOpenInternal(path, NULL, 0);
|
return unzOpenInternal(path, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen64 (const void *path)
|
extern unzFile ZEXPORT unzOpen64(const void *path) {
|
||||||
{
|
|
||||||
return unzOpenInternal(path, NULL, 1);
|
return unzOpenInternal(path, NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,8 +708,7 @@ extern unzFile ZEXPORT unzOpen64 (const void *path)
|
||||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||||
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
||||||
return UNZ_OK if there is no problem. */
|
return UNZ_OK if there is no problem. */
|
||||||
extern int ZEXPORT unzClose (unzFile file)
|
extern int ZEXPORT unzClose(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
|
@ -816,7 +718,7 @@ extern int ZEXPORT unzClose (unzFile file)
|
||||||
unzCloseCurrentFile(file);
|
unzCloseCurrentFile(file);
|
||||||
|
|
||||||
ZCLOSE64(s->z_filefunc, s->filestream);
|
ZCLOSE64(s->z_filefunc, s->filestream);
|
||||||
TRYFREE(s);
|
free(s);
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,8 +727,7 @@ extern int ZEXPORT unzClose (unzFile file)
|
||||||
Write info about the ZipFile in the *pglobal_info structure.
|
Write info about the ZipFile in the *pglobal_info structure.
|
||||||
No preparation of the structure is needed
|
No preparation of the structure is needed
|
||||||
return UNZ_OK if there is no problem. */
|
return UNZ_OK if there is no problem. */
|
||||||
extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info)
|
extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64* pglobal_info) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
|
@ -835,8 +736,7 @@ extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32)
|
extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
|
@ -847,10 +747,9 @@ extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Translate date/time from Dos format to tm_unz (readable more easilty)
|
Translate date/time from Dos format to tm_unz (readable more easily)
|
||||||
*/
|
*/
|
||||||
local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
|
local void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz* ptm) {
|
||||||
{
|
|
||||||
ZPOS64_T uDate;
|
ZPOS64_T uDate;
|
||||||
uDate = (ZPOS64_T)(ulDosDate>>16);
|
uDate = (ZPOS64_T)(ulDosDate>>16);
|
||||||
ptm->tm_mday = (int)(uDate&0x1f) ;
|
ptm->tm_mday = (int)(uDate&0x1f) ;
|
||||||
|
@ -865,28 +764,16 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
|
||||||
/*
|
/*
|
||||||
Get Info about the current file in the zipfile, with internal only info
|
Get Info about the current file in the zipfile, with internal only info
|
||||||
*/
|
*/
|
||||||
local int unz64local_GetCurrentFileInfoInternal OF((unzFile file,
|
local int unz64local_GetCurrentFileInfoInternal(unzFile file,
|
||||||
unz_file_info64 *pfile_info,
|
unz_file_info64 *pfile_info,
|
||||||
unz_file_info64_internal
|
unz_file_info64_internal
|
||||||
*pfile_info_internal,
|
*pfile_info_internal,
|
||||||
char *szFileName,
|
char *szFileName,
|
||||||
uLong fileNameBufferSize,
|
uLong fileNameBufferSize,
|
||||||
void *extraField,
|
void *extraField,
|
||||||
uLong extraFieldBufferSize,
|
uLong extraFieldBufferSize,
|
||||||
char *szComment,
|
char *szComment,
|
||||||
uLong commentBufferSize));
|
uLong commentBufferSize) {
|
||||||
|
|
||||||
local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
|
||||||
unz_file_info64 *pfile_info,
|
|
||||||
unz_file_info64_internal
|
|
||||||
*pfile_info_internal,
|
|
||||||
char *szFileName,
|
|
||||||
uLong fileNameBufferSize,
|
|
||||||
void *extraField,
|
|
||||||
uLong extraFieldBufferSize,
|
|
||||||
char *szComment,
|
|
||||||
uLong commentBufferSize)
|
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
unz_file_info64 file_info;
|
unz_file_info64 file_info;
|
||||||
unz_file_info64_internal file_info_internal;
|
unz_file_info64_internal file_info_internal;
|
||||||
|
@ -1038,33 +925,31 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||||
/* ZIP64 extra fields */
|
/* ZIP64 extra fields */
|
||||||
if (headerId == 0x0001)
|
if (headerId == 0x0001)
|
||||||
{
|
{
|
||||||
uLong uL;
|
if(file_info.uncompressed_size == MAXU32)
|
||||||
|
{
|
||||||
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
|
||||||
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
|
|
||||||
if(file_info.uncompressed_size == MAXU32)
|
if(file_info.compressed_size == MAXU32)
|
||||||
{
|
{
|
||||||
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_info.compressed_size == MAXU32)
|
if(file_info_internal.offset_curfile == MAXU32)
|
||||||
{
|
{
|
||||||
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
|
/* Relative Header offset */
|
||||||
err=UNZ_ERRNO;
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
|
||||||
}
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
|
|
||||||
if(file_info_internal.offset_curfile == MAXU32)
|
if(file_info.disk_num_start == 0xffff)
|
||||||
{
|
{
|
||||||
/* Relative Header offset */
|
/* Disk Start Number */
|
||||||
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
|
if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_info.disk_num_start == MAXU32)
|
|
||||||
{
|
|
||||||
/* Disk Start Number */
|
|
||||||
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
|
|
||||||
err=UNZ_ERRNO;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1121,24 +1006,22 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||||
No preparation of the structure is needed
|
No preparation of the structure is needed
|
||||||
return UNZ_OK if there is no problem.
|
return UNZ_OK if there is no problem.
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file,
|
extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
|
||||||
unz_file_info64 * pfile_info,
|
unz_file_info64 * pfile_info,
|
||||||
char * szFileName, uLong fileNameBufferSize,
|
char * szFileName, uLong fileNameBufferSize,
|
||||||
void *extraField, uLong extraFieldBufferSize,
|
void *extraField, uLong extraFieldBufferSize,
|
||||||
char* szComment, uLong commentBufferSize)
|
char* szComment, uLong commentBufferSize) {
|
||||||
{
|
|
||||||
return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
|
return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
|
||||||
szFileName,fileNameBufferSize,
|
szFileName,fileNameBufferSize,
|
||||||
extraField,extraFieldBufferSize,
|
extraField,extraFieldBufferSize,
|
||||||
szComment,commentBufferSize);
|
szComment,commentBufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
|
extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
|
||||||
unz_file_info * pfile_info,
|
unz_file_info * pfile_info,
|
||||||
char * szFileName, uLong fileNameBufferSize,
|
char * szFileName, uLong fileNameBufferSize,
|
||||||
void *extraField, uLong extraFieldBufferSize,
|
void *extraField, uLong extraFieldBufferSize,
|
||||||
char* szComment, uLong commentBufferSize)
|
char* szComment, uLong commentBufferSize) {
|
||||||
{
|
|
||||||
int err;
|
int err;
|
||||||
unz_file_info64 file_info64;
|
unz_file_info64 file_info64;
|
||||||
err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
|
err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
|
||||||
|
@ -1162,7 +1045,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
|
||||||
pfile_info->internal_fa = file_info64.internal_fa;
|
pfile_info->internal_fa = file_info64.internal_fa;
|
||||||
pfile_info->external_fa = file_info64.external_fa;
|
pfile_info->external_fa = file_info64.external_fa;
|
||||||
|
|
||||||
pfile_info->tmu_date = file_info64.tmu_date,
|
pfile_info->tmu_date = file_info64.tmu_date;
|
||||||
|
|
||||||
|
|
||||||
pfile_info->compressed_size = (uLong)file_info64.compressed_size;
|
pfile_info->compressed_size = (uLong)file_info64.compressed_size;
|
||||||
|
@ -1175,8 +1058,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
|
||||||
Set the current file of the zipfile to the first file.
|
Set the current file of the zipfile to the first file.
|
||||||
return UNZ_OK if there is no problem
|
return UNZ_OK if there is no problem
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGoToFirstFile (unzFile file)
|
extern int ZEXPORT unzGoToFirstFile(unzFile file) {
|
||||||
{
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
@ -1196,8 +1078,7 @@ extern int ZEXPORT unzGoToFirstFile (unzFile file)
|
||||||
return UNZ_OK if there is no problem
|
return UNZ_OK if there is no problem
|
||||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGoToNextFile (unzFile file)
|
extern int ZEXPORT unzGoToNextFile(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -1229,8 +1110,7 @@ extern int ZEXPORT unzGoToNextFile (unzFile file)
|
||||||
UNZ_OK if the file is found. It becomes the current file.
|
UNZ_OK if the file is found. It becomes the current file.
|
||||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
|
extern int ZEXPORT unzLocateFile(unzFile file, const char *szFileName, int iCaseSensitivity) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -1305,8 +1185,7 @@ typedef struct unz_file_pos_s
|
||||||
} unz_file_pos;
|
} unz_file_pos;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos)
|
extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
|
||||||
if (file==NULL || file_pos==NULL)
|
if (file==NULL || file_pos==NULL)
|
||||||
|
@ -1321,10 +1200,7 @@ extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos)
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGetFilePos(
|
extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos) {
|
||||||
unzFile file,
|
|
||||||
unz_file_pos* file_pos)
|
|
||||||
{
|
|
||||||
unz64_file_pos file_pos64;
|
unz64_file_pos file_pos64;
|
||||||
int err = unzGetFilePos64(file,&file_pos64);
|
int err = unzGetFilePos64(file,&file_pos64);
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK)
|
||||||
|
@ -1335,8 +1211,7 @@ extern int ZEXPORT unzGetFilePos(
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos)
|
extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -1357,10 +1232,7 @@ extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGoToFilePos(
|
extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos* file_pos) {
|
||||||
unzFile file,
|
|
||||||
unz_file_pos* file_pos)
|
|
||||||
{
|
|
||||||
unz64_file_pos file_pos64;
|
unz64_file_pos file_pos64;
|
||||||
if (file_pos == NULL)
|
if (file_pos == NULL)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
|
@ -1382,10 +1254,9 @@ extern int ZEXPORT unzGoToFilePos(
|
||||||
store in *piSizeVar the size of extra info in local header
|
store in *piSizeVar the size of extra info in local header
|
||||||
(filename and size of extra field data)
|
(filename and size of extra field data)
|
||||||
*/
|
*/
|
||||||
local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar,
|
local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar,
|
||||||
ZPOS64_T * poffset_local_extrafield,
|
ZPOS64_T * poffset_local_extrafield,
|
||||||
uInt * psize_local_extrafield)
|
uInt * psize_local_extrafield) {
|
||||||
{
|
|
||||||
uLong uMagic,uData,uFlags;
|
uLong uMagic,uData,uFlags;
|
||||||
uLong size_filename;
|
uLong size_filename;
|
||||||
uLong size_extra_field;
|
uLong size_extra_field;
|
||||||
|
@ -1469,9 +1340,8 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa
|
||||||
Open for reading data the current file in the zipfile.
|
Open for reading data the current file in the zipfile.
|
||||||
If there is no error and the file is opened, the return value is UNZ_OK.
|
If there is no error and the file is opened, the return value is UNZ_OK.
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
|
||||||
int* level, int raw, const char* password)
|
int* level, int raw, const char* password) {
|
||||||
{
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
uInt iSizeVar;
|
uInt iSizeVar;
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
@ -1509,7 +1379,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||||
|
|
||||||
if (pfile_in_zip_read_info->read_buffer==NULL)
|
if (pfile_in_zip_read_info->read_buffer==NULL)
|
||||||
{
|
{
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
free(pfile_in_zip_read_info);
|
||||||
return UNZ_INTERNALERROR;
|
return UNZ_INTERNALERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1566,8 +1436,8 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||||
pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
|
pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRYFREE(pfile_in_zip_read_info->read_buffer);
|
free(pfile_in_zip_read_info->read_buffer);
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
free(pfile_in_zip_read_info);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -1587,8 +1457,8 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||||
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
|
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRYFREE(pfile_in_zip_read_info->read_buffer);
|
free(pfile_in_zip_read_info->read_buffer);
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
free(pfile_in_zip_read_info);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
/* windowBits is passed < 0 to tell that there is no zlib header.
|
/* windowBits is passed < 0 to tell that there is no zlib header.
|
||||||
|
@ -1640,25 +1510,21 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile (unzFile file)
|
extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
|
||||||
{
|
|
||||||
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
|
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password)
|
extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char* password) {
|
||||||
{
|
|
||||||
return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
|
return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw)
|
extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int* method, int* level, int raw) {
|
||||||
{
|
|
||||||
return unzOpenCurrentFile3(file, method, level, raw, NULL);
|
return unzOpenCurrentFile3(file, method, level, raw, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Addition for GDAL : START */
|
/** Addition for GDAL : START */
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
|
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
s=(unz64_s*)file;
|
s=(unz64_s*)file;
|
||||||
|
@ -1678,13 +1544,12 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
|
||||||
buf contain buffer where data must be copied
|
buf contain buffer where data must be copied
|
||||||
len the size of buf.
|
len the size of buf.
|
||||||
|
|
||||||
return the number of byte copied if somes bytes are copied
|
return the number of byte copied if some bytes are copied
|
||||||
return 0 if the end of file was reached
|
return 0 if the end of file was reached
|
||||||
return <0 with error code if there is an error
|
return <0 with error code if there is an error
|
||||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
|
||||||
{
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
uInt iRead = 0;
|
uInt iRead = 0;
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
@ -1891,8 +1756,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
||||||
/*
|
/*
|
||||||
Give the current position in uncompressed data
|
Give the current position in uncompressed data
|
||||||
*/
|
*/
|
||||||
extern z_off_t ZEXPORT unztell (unzFile file)
|
extern z_off_t ZEXPORT unztell(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
@ -1906,8 +1770,7 @@ extern z_off_t ZEXPORT unztell (unzFile file)
|
||||||
return (z_off_t)pfile_in_zip_read_info->stream.total_out;
|
return (z_off_t)pfile_in_zip_read_info->stream.total_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
|
extern ZPOS64_T ZEXPORT unztell64(unzFile file) {
|
||||||
{
|
|
||||||
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
|
@ -1926,8 +1789,7 @@ extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
|
||||||
/*
|
/*
|
||||||
return 1 if the end of file was reached, 0 elsewhere
|
return 1 if the end of file was reached, 0 elsewhere
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzeof (unzFile file)
|
extern int ZEXPORT unzeof(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
@ -1958,8 +1820,7 @@ more info in the local-header version than in the central-header)
|
||||||
the return value is the number of bytes copied in buf, or (if <0)
|
the return value is the number of bytes copied in buf, or (if <0)
|
||||||
the error code
|
the error code
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
|
extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, unsigned len) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
uInt read_now;
|
uInt read_now;
|
||||||
|
@ -2006,8 +1867,7 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
|
||||||
Close the file in zip opened with unzOpenCurrentFile
|
Close the file in zip opened with unzOpenCurrentFile
|
||||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
extern int ZEXPORT unzCloseCurrentFile(unzFile file) {
|
||||||
{
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
@ -2029,7 +1889,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TRYFREE(pfile_in_zip_read_info->read_buffer);
|
free(pfile_in_zip_read_info->read_buffer);
|
||||||
pfile_in_zip_read_info->read_buffer = NULL;
|
pfile_in_zip_read_info->read_buffer = NULL;
|
||||||
if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
|
if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
|
||||||
inflateEnd(&pfile_in_zip_read_info->stream);
|
inflateEnd(&pfile_in_zip_read_info->stream);
|
||||||
|
@ -2040,7 +1900,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
||||||
|
|
||||||
|
|
||||||
pfile_in_zip_read_info->stream_initialised = 0;
|
pfile_in_zip_read_info->stream_initialised = 0;
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
free(pfile_in_zip_read_info);
|
||||||
|
|
||||||
s->pfile_in_zip_read=NULL;
|
s->pfile_in_zip_read=NULL;
|
||||||
|
|
||||||
|
@ -2053,8 +1913,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
||||||
uSizeBuf is the size of the szComment buffer.
|
uSizeBuf is the size of the szComment buffer.
|
||||||
return the number of byte copied or an error code <0
|
return the number of byte copied or an error code <0
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf)
|
extern int ZEXPORT unzGetGlobalComment(unzFile file, char * szComment, uLong uSizeBuf) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
uLong uReadThis ;
|
uLong uReadThis ;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
@ -2081,8 +1940,7 @@ extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uS
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Additions by RX '2004 */
|
/* Additions by RX '2004 */
|
||||||
extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
|
extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
@ -2096,8 +1954,7 @@ extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
|
||||||
return s->pos_in_central_dir;
|
return s->pos_in_central_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uLong ZEXPORT unzGetOffset (unzFile file)
|
extern uLong ZEXPORT unzGetOffset(unzFile file) {
|
||||||
{
|
|
||||||
ZPOS64_T offset64;
|
ZPOS64_T offset64;
|
||||||
|
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
@ -2106,8 +1963,7 @@ extern uLong ZEXPORT unzGetOffset (unzFile file)
|
||||||
return (uLong)offset64;
|
return (uLong)offset64;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
|
extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -2124,7 +1980,6 @@ extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos)
|
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) {
|
||||||
{
|
|
||||||
return unzSetOffset64(file,pos);
|
return unzSetOffset64(file,pos);
|
||||||
}
|
}
|
|
@ -150,21 +150,21 @@ typedef struct unz_file_info_s
|
||||||
tm_unz tmu_date;
|
tm_unz tmu_date;
|
||||||
} unz_file_info;
|
} unz_file_info;
|
||||||
|
|
||||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
extern int ZEXPORT unzStringFileNameCompare(const char* fileName1,
|
||||||
const char* fileName2,
|
const char* fileName2,
|
||||||
int iCaseSensitivity));
|
int iCaseSensitivity);
|
||||||
/*
|
/*
|
||||||
Compare two filename (fileName1,fileName2).
|
Compare two filenames (fileName1,fileName2).
|
||||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
|
||||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
|
||||||
or strcasecmp)
|
or strcasecmp)
|
||||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
If iCaseSensitivity = 0, case sensitivity is default of your operating system
|
||||||
(like 1 on Unix, 2 on Windows)
|
(like 1 on Unix, 2 on Windows)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
extern unzFile ZEXPORT unzOpen(const char *path);
|
||||||
extern unzFile ZEXPORT unzOpen64 OF((const void *path));
|
extern unzFile ZEXPORT unzOpen64(const void *path);
|
||||||
/*
|
/*
|
||||||
Open a Zip file. path contain the full pathname (by example,
|
Open a Zip file. path contain the full pathname (by example,
|
||||||
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||||
|
@ -181,41 +181,41 @@ extern unzFile ZEXPORT unzOpen64 OF((const void *path));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
extern unzFile ZEXPORT unzOpen2(const char *path,
|
||||||
zlib_filefunc_def* pzlib_filefunc_def));
|
zlib_filefunc_def* pzlib_filefunc_def);
|
||||||
/*
|
/*
|
||||||
Open a Zip file, like unzOpen, but provide a set of file low level API
|
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||||
for read/write the zip file (see ioapi.h)
|
for read/write the zip file (see ioapi.h)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
|
extern unzFile ZEXPORT unzOpen2_64(const void *path,
|
||||||
zlib_filefunc64_def* pzlib_filefunc_def));
|
zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
/*
|
/*
|
||||||
Open a Zip file, like unz64Open, but provide a set of file low level API
|
Open a Zip file, like unz64Open, but provide a set of file low level API
|
||||||
for read/write the zip file (see ioapi.h)
|
for read/write the zip file (see ioapi.h)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzClose OF((unzFile file));
|
extern int ZEXPORT unzClose(unzFile file);
|
||||||
/*
|
/*
|
||||||
Close a ZipFile opened with unzOpen.
|
Close a ZipFile opened with unzOpen.
|
||||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||||
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
||||||
return UNZ_OK if there is no problem. */
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
extern int ZEXPORT unzGetGlobalInfo(unzFile file,
|
||||||
unz_global_info *pglobal_info));
|
unz_global_info *pglobal_info);
|
||||||
|
|
||||||
extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
|
extern int ZEXPORT unzGetGlobalInfo64(unzFile file,
|
||||||
unz_global_info64 *pglobal_info));
|
unz_global_info64 *pglobal_info);
|
||||||
/*
|
/*
|
||||||
Write info about the ZipFile in the *pglobal_info structure.
|
Write info about the ZipFile in the *pglobal_info structure.
|
||||||
No preparation of the structure is needed
|
No preparation of the structure is needed
|
||||||
return UNZ_OK if there is no problem. */
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
extern int ZEXPORT unzGetGlobalComment(unzFile file,
|
||||||
char *szComment,
|
char *szComment,
|
||||||
uLong uSizeBuf));
|
uLong uSizeBuf);
|
||||||
/*
|
/*
|
||||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||||
uSizeBuf is the size of the szComment buffer.
|
uSizeBuf is the size of the szComment buffer.
|
||||||
|
@ -226,22 +226,22 @@ extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* Unzip package allow you browse the directory of the zipfile */
|
/* Unzip package allow you browse the directory of the zipfile */
|
||||||
|
|
||||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
extern int ZEXPORT unzGoToFirstFile(unzFile file);
|
||||||
/*
|
/*
|
||||||
Set the current file of the zipfile to the first file.
|
Set the current file of the zipfile to the first file.
|
||||||
return UNZ_OK if there is no problem
|
return UNZ_OK if there is no problem
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
extern int ZEXPORT unzGoToNextFile(unzFile file);
|
||||||
/*
|
/*
|
||||||
Set the current file of the zipfile to the next file.
|
Set the current file of the zipfile to the next file.
|
||||||
return UNZ_OK if there is no problem
|
return UNZ_OK if there is no problem
|
||||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
extern int ZEXPORT unzLocateFile(unzFile file,
|
||||||
const char *szFileName,
|
const char *szFileName,
|
||||||
int iCaseSensitivity));
|
int iCaseSensitivity);
|
||||||
/*
|
/*
|
||||||
Try locate the file szFileName in the zipfile.
|
Try locate the file szFileName in the zipfile.
|
||||||
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||||
|
@ -285,28 +285,28 @@ extern int ZEXPORT unzGoToFilePos64(
|
||||||
|
|
||||||
/* ****************************************** */
|
/* ****************************************** */
|
||||||
|
|
||||||
extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
|
extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
|
||||||
unz_file_info64 *pfile_info,
|
unz_file_info64 *pfile_info,
|
||||||
char *szFileName,
|
char *szFileName,
|
||||||
uLong fileNameBufferSize,
|
uLong fileNameBufferSize,
|
||||||
void *extraField,
|
void *extraField,
|
||||||
uLong extraFieldBufferSize,
|
uLong extraFieldBufferSize,
|
||||||
char *szComment,
|
char *szComment,
|
||||||
uLong commentBufferSize));
|
uLong commentBufferSize);
|
||||||
|
|
||||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
|
||||||
unz_file_info *pfile_info,
|
unz_file_info *pfile_info,
|
||||||
char *szFileName,
|
char *szFileName,
|
||||||
uLong fileNameBufferSize,
|
uLong fileNameBufferSize,
|
||||||
void *extraField,
|
void *extraField,
|
||||||
uLong extraFieldBufferSize,
|
uLong extraFieldBufferSize,
|
||||||
char *szComment,
|
char *szComment,
|
||||||
uLong commentBufferSize));
|
uLong commentBufferSize);
|
||||||
/*
|
/*
|
||||||
Get Info about the current file
|
Get Info about the current file
|
||||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
if pfile_info!=NULL, the *pfile_info structure will contain some info about
|
||||||
the current file
|
the current file
|
||||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
if szFileName!=NULL, the filename string will be copied in szFileName
|
||||||
(fileNameBufferSize is the size of the buffer)
|
(fileNameBufferSize is the size of the buffer)
|
||||||
if extraField!=NULL, the extra field information will be copied in extraField
|
if extraField!=NULL, the extra field information will be copied in extraField
|
||||||
(extraFieldBufferSize is the size of the buffer).
|
(extraFieldBufferSize is the size of the buffer).
|
||||||
|
@ -318,7 +318,7 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||||
|
|
||||||
/** Addition for GDAL : START */
|
/** Addition for GDAL : START */
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
|
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file);
|
||||||
|
|
||||||
/** Addition for GDAL : END */
|
/** Addition for GDAL : END */
|
||||||
|
|
||||||
|
@ -328,24 +328,24 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
|
||||||
from it, and close it (you can close it before reading all the file)
|
from it, and close it (you can close it before reading all the file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
extern int ZEXPORT unzOpenCurrentFile(unzFile file);
|
||||||
/*
|
/*
|
||||||
Open for reading data the current file in the zipfile.
|
Open for reading data the current file in the zipfile.
|
||||||
If there is no error, the return value is UNZ_OK.
|
If there is no error, the return value is UNZ_OK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file,
|
||||||
const char* password));
|
const char* password);
|
||||||
/*
|
/*
|
||||||
Open for reading data the current file in the zipfile.
|
Open for reading data the current file in the zipfile.
|
||||||
password is a crypting password
|
password is a crypting password
|
||||||
If there is no error, the return value is UNZ_OK.
|
If there is no error, the return value is UNZ_OK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
extern int ZEXPORT unzOpenCurrentFile2(unzFile file,
|
||||||
int* method,
|
int* method,
|
||||||
int* level,
|
int* level,
|
||||||
int raw));
|
int raw);
|
||||||
/*
|
/*
|
||||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||||
if raw==1
|
if raw==1
|
||||||
|
@ -355,11 +355,11 @@ extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||||
but you CANNOT set method parameter as NULL
|
but you CANNOT set method parameter as NULL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
extern int ZEXPORT unzOpenCurrentFile3(unzFile file,
|
||||||
int* method,
|
int* method,
|
||||||
int* level,
|
int* level,
|
||||||
int raw,
|
int raw,
|
||||||
const char* password));
|
const char* password);
|
||||||
/*
|
/*
|
||||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||||
if raw==1
|
if raw==1
|
||||||
|
@ -370,41 +370,41 @@ extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
extern int ZEXPORT unzCloseCurrentFile(unzFile file);
|
||||||
/*
|
/*
|
||||||
Close the file in zip opened with unzOpenCurrentFile
|
Close the file in zip opened with unzOpenCurrentFile
|
||||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
extern int ZEXPORT unzReadCurrentFile(unzFile file,
|
||||||
voidp buf,
|
voidp buf,
|
||||||
unsigned len));
|
unsigned len);
|
||||||
/*
|
/*
|
||||||
Read bytes from the current file (opened by unzOpenCurrentFile)
|
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||||
buf contain buffer where data must be copied
|
buf contain buffer where data must be copied
|
||||||
len the size of buf.
|
len the size of buf.
|
||||||
|
|
||||||
return the number of byte copied if somes bytes are copied
|
return the number of byte copied if some bytes are copied
|
||||||
return 0 if the end of file was reached
|
return 0 if the end of file was reached
|
||||||
return <0 with error code if there is an error
|
return <0 with error code if there is an error
|
||||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
extern z_off_t ZEXPORT unztell(unzFile file);
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
|
extern ZPOS64_T ZEXPORT unztell64(unzFile file);
|
||||||
/*
|
/*
|
||||||
Give the current position in uncompressed data
|
Give the current position in uncompressed data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzeof OF((unzFile file));
|
extern int ZEXPORT unzeof(unzFile file);
|
||||||
/*
|
/*
|
||||||
return 1 if the end of file was reached, 0 elsewhere
|
return 1 if the end of file was reached, 0 elsewhere
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
extern int ZEXPORT unzGetLocalExtrafield(unzFile file,
|
||||||
voidp buf,
|
voidp buf,
|
||||||
unsigned len));
|
unsigned len);
|
||||||
/*
|
/*
|
||||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||||
This is the local-header version of the extra field (sometimes, there is
|
This is the local-header version of the extra field (sometimes, there is
|
|
@ -14,7 +14,7 @@
|
||||||
Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
|
Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
|
||||||
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
|
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
|
||||||
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
|
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
|
||||||
It is used when recreting zip archive with RAW when deleting items from a zip.
|
It is used when recreating zip archive with RAW when deleting items from a zip.
|
||||||
ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
|
ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
|
||||||
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
|
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
|
||||||
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
||||||
|
@ -25,14 +25,13 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
#include "zip.h"
|
#include "zip.h"
|
||||||
|
|
||||||
#ifdef STDC
|
#ifdef STDC
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include <string.h>
|
|
||||||
# include <stdlib.h>
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_ERRNO_H
|
#ifdef NO_ERRNO_H
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
@ -47,7 +46,7 @@
|
||||||
/* compile with -Dlocal if your debugger can't find static symbols */
|
/* compile with -Dlocal if your debugger can't find static symbols */
|
||||||
|
|
||||||
#ifndef VERSIONMADEBY
|
#ifndef VERSIONMADEBY
|
||||||
# define VERSIONMADEBY (0x0) /* platform depedent */
|
# define VERSIONMADEBY (0x0) /* platform dependent */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Z_BUFSIZE
|
#ifndef Z_BUFSIZE
|
||||||
|
@ -61,9 +60,6 @@
|
||||||
#ifndef ALLOC
|
#ifndef ALLOC
|
||||||
# define ALLOC(size) (malloc(size))
|
# define ALLOC(size) (malloc(size))
|
||||||
#endif
|
#endif
|
||||||
#ifndef TRYFREE
|
|
||||||
# define TRYFREE(p) {if (p) free(p);}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define SIZECENTRALDIRITEM (0x2e)
|
#define SIZECENTRALDIRITEM (0x2e)
|
||||||
|
@ -138,20 +134,20 @@ typedef struct
|
||||||
uInt pos_in_buffered_data; /* last written byte in buffered_data */
|
uInt pos_in_buffered_data; /* last written byte in buffered_data */
|
||||||
|
|
||||||
ZPOS64_T pos_local_header; /* offset of the local header of the file
|
ZPOS64_T pos_local_header; /* offset of the local header of the file
|
||||||
currenty writing */
|
currently writing */
|
||||||
char* central_header; /* central header data for the current file */
|
char* central_header; /* central header data for the current file */
|
||||||
uLong size_centralExtra;
|
uLong size_centralExtra;
|
||||||
uLong size_centralheader; /* size of the central header for cur file */
|
uLong size_centralheader; /* size of the central header for cur file */
|
||||||
uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
|
uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
|
||||||
uLong flag; /* flag of the file currently writing */
|
uLong flag; /* flag of the file currently writing */
|
||||||
|
|
||||||
int method; /* compression method of file currenty wr.*/
|
int method; /* compression method of file currently wr.*/
|
||||||
int raw; /* 1 for directly writing raw data */
|
int raw; /* 1 for directly writing raw data */
|
||||||
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
|
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
|
||||||
uLong dosDate;
|
uLong dosDate;
|
||||||
uLong crc32;
|
uLong crc32;
|
||||||
int encrypt;
|
int encrypt;
|
||||||
int zip64; /* Add ZIP64 extened information in the extra field */
|
int zip64; /* Add ZIP64 extended information in the extra field */
|
||||||
ZPOS64_T pos_zip64extrainfo;
|
ZPOS64_T pos_zip64extrainfo;
|
||||||
ZPOS64_T totalCompressedData;
|
ZPOS64_T totalCompressedData;
|
||||||
ZPOS64_T totalUncompressedData;
|
ZPOS64_T totalUncompressedData;
|
||||||
|
@ -165,10 +161,10 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def z_filefunc;
|
zlib_filefunc64_32_def z_filefunc;
|
||||||
voidpf filestream; /* io structore of the zipfile */
|
voidpf filestream; /* io structure of the zipfile */
|
||||||
linkedlist_data central_dir;/* datablock with central dir in construction*/
|
linkedlist_data central_dir;/* datablock with central dir in construction*/
|
||||||
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
|
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
|
||||||
curfile64_info ci; /* info on the file curretly writing */
|
curfile64_info ci; /* info on the file currently writing */
|
||||||
|
|
||||||
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
|
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
|
||||||
ZPOS64_T add_position_when_writing_offset;
|
ZPOS64_T add_position_when_writing_offset;
|
||||||
|
@ -186,8 +182,7 @@ typedef struct
|
||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
local linkedlist_datablock_internal* allocate_new_datablock()
|
local linkedlist_datablock_internal* allocate_new_datablock(void) {
|
||||||
{
|
|
||||||
linkedlist_datablock_internal* ldi;
|
linkedlist_datablock_internal* ldi;
|
||||||
ldi = (linkedlist_datablock_internal*)
|
ldi = (linkedlist_datablock_internal*)
|
||||||
ALLOC(sizeof(linkedlist_datablock_internal));
|
ALLOC(sizeof(linkedlist_datablock_internal));
|
||||||
|
@ -200,30 +195,26 @@ local linkedlist_datablock_internal* allocate_new_datablock()
|
||||||
return ldi;
|
return ldi;
|
||||||
}
|
}
|
||||||
|
|
||||||
local void free_datablock(linkedlist_datablock_internal* ldi)
|
local void free_datablock(linkedlist_datablock_internal* ldi) {
|
||||||
{
|
|
||||||
while (ldi!=NULL)
|
while (ldi!=NULL)
|
||||||
{
|
{
|
||||||
linkedlist_datablock_internal* ldinext = ldi->next_datablock;
|
linkedlist_datablock_internal* ldinext = ldi->next_datablock;
|
||||||
TRYFREE(ldi);
|
free(ldi);
|
||||||
ldi = ldinext;
|
ldi = ldinext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local void init_linkedlist(linkedlist_data* ll)
|
local void init_linkedlist(linkedlist_data* ll) {
|
||||||
{
|
|
||||||
ll->first_block = ll->last_block = NULL;
|
ll->first_block = ll->last_block = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
local void free_linkedlist(linkedlist_data* ll)
|
local void free_linkedlist(linkedlist_data* ll) {
|
||||||
{
|
|
||||||
free_datablock(ll->first_block);
|
free_datablock(ll->first_block);
|
||||||
ll->first_block = ll->last_block = NULL;
|
ll->first_block = ll->last_block = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) {
|
||||||
{
|
|
||||||
linkedlist_datablock_internal* ldi;
|
linkedlist_datablock_internal* ldi;
|
||||||
const unsigned char* from_copy;
|
const unsigned char* from_copy;
|
||||||
|
|
||||||
|
@ -238,7 +229,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
||||||
}
|
}
|
||||||
|
|
||||||
ldi = ll->last_block;
|
ldi = ll->last_block;
|
||||||
from_copy = (unsigned char*)buf;
|
from_copy = (const unsigned char*)buf;
|
||||||
|
|
||||||
while (len>0)
|
while (len>0)
|
||||||
{
|
{
|
||||||
|
@ -283,9 +274,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
||||||
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
|
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte));
|
local int zip64local_putValue(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) {
|
||||||
local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
|
|
||||||
{
|
|
||||||
unsigned char buf[8];
|
unsigned char buf[8];
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < nbByte; n++)
|
for (n = 0; n < nbByte; n++)
|
||||||
|
@ -307,9 +296,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
return ZIP_OK;
|
return ZIP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));
|
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) {
|
||||||
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
|
|
||||||
{
|
|
||||||
unsigned char* buf=(unsigned char*)dest;
|
unsigned char* buf=(unsigned char*)dest;
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < nbByte; n++) {
|
for (n = 0; n < nbByte; n++) {
|
||||||
|
@ -329,8 +316,7 @@ local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
|
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) {
|
||||||
{
|
|
||||||
uLong year = (uLong)ptm->tm_year;
|
uLong year = (uLong)ptm->tm_year;
|
||||||
if (year>=1980)
|
if (year>=1980)
|
||||||
year-=1980;
|
year-=1980;
|
||||||
|
@ -344,10 +330,7 @@ local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi));
|
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
|
||||||
|
|
||||||
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
|
|
||||||
{
|
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
|
||||||
if (err==1)
|
if (err==1)
|
||||||
|
@ -368,10 +351,7 @@ local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,vo
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
Reads a long in LSB order from the given gz_stream. Sets
|
Reads a long in LSB order from the given gz_stream. Sets
|
||||||
*/
|
*/
|
||||||
local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
|
local int zip64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
|
||||||
|
|
||||||
local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
|
|
||||||
{
|
|
||||||
uLong x ;
|
uLong x ;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int err;
|
int err;
|
||||||
|
@ -390,10 +370,7 @@ local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
|
local int zip64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
|
||||||
|
|
||||||
local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
|
|
||||||
{
|
|
||||||
uLong x ;
|
uLong x ;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int err;
|
int err;
|
||||||
|
@ -420,11 +397,8 @@ local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
|
|
||||||
|
|
||||||
|
local int zip64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) {
|
||||||
local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
|
|
||||||
{
|
|
||||||
ZPOS64_T x;
|
ZPOS64_T x;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int err;
|
int err;
|
||||||
|
@ -475,10 +449,7 @@ local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def
|
||||||
Locate the Central directory of a zipfile (at the end, just before
|
Locate the Central directory of a zipfile (at the end, just before
|
||||||
the global comment)
|
the global comment)
|
||||||
*/
|
*/
|
||||||
local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
||||||
|
|
||||||
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
|
||||||
{
|
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ZPOS64_T uSizeFile;
|
ZPOS64_T uSizeFile;
|
||||||
ZPOS64_T uBackRead;
|
ZPOS64_T uBackRead;
|
||||||
|
@ -529,7 +500,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
if (uPosFound!=0)
|
if (uPosFound!=0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRYFREE(buf);
|
free(buf);
|
||||||
return uPosFound;
|
return uPosFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,10 +508,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
|
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
|
||||||
the global comment)
|
the global comment)
|
||||||
*/
|
*/
|
||||||
local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
||||||
|
|
||||||
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
|
||||||
{
|
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ZPOS64_T uSizeFile;
|
ZPOS64_T uSizeFile;
|
||||||
ZPOS64_T uBackRead;
|
ZPOS64_T uBackRead;
|
||||||
|
@ -595,7 +563,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRYFREE(buf);
|
free(buf);
|
||||||
if (uPosFound == 0)
|
if (uPosFound == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -607,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* number of the disk with the start of the zip64 end of central directory */
|
/* number of the disk with the start of the zip64 end of central directory */
|
||||||
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
||||||
return 0;
|
return 0;
|
||||||
if (uL != 0)
|
if (uL != 0)
|
||||||
|
@ -637,8 +605,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
return relativeOffset;
|
return relativeOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
|
||||||
{
|
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||||
|
|
||||||
|
@ -647,10 +614,10 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||||
ZPOS64_T central_pos;
|
ZPOS64_T central_pos;
|
||||||
uLong uL;
|
uLong uL;
|
||||||
|
|
||||||
uLong number_disk; /* number of the current dist, used for
|
uLong number_disk; /* number of the current disk, used for
|
||||||
spaning ZIP, unsupported, always 0*/
|
spanning ZIP, unsupported, always 0*/
|
||||||
uLong number_disk_with_CD; /* number the the disk with central dir, used
|
uLong number_disk_with_CD; /* number of the disk with central dir, used
|
||||||
for spaning ZIP, unsupported, always 0*/
|
for spanning ZIP, unsupported, always 0*/
|
||||||
ZPOS64_T number_entry;
|
ZPOS64_T number_entry;
|
||||||
ZPOS64_T number_entry_CD; /* total number of entries in
|
ZPOS64_T number_entry_CD; /* total number of entries in
|
||||||
the central dir
|
the central dir
|
||||||
|
@ -830,7 +797,7 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||||
|
|
||||||
size_central_dir_to_read-=read_this;
|
size_central_dir_to_read-=read_this;
|
||||||
}
|
}
|
||||||
TRYFREE(buf_read);
|
free(buf_read);
|
||||||
}
|
}
|
||||||
pziinit->begin_pos = byte_before_the_zipfile;
|
pziinit->begin_pos = byte_before_the_zipfile;
|
||||||
pziinit->number_entry = number_entry_CD;
|
pziinit->number_entry = number_entry_CD;
|
||||||
|
@ -846,8 +813,7 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
|
extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
|
||||||
{
|
|
||||||
zip64_internal ziinit;
|
zip64_internal ziinit;
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
|
@ -905,9 +871,9 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
|
||||||
if (err != ZIP_OK)
|
if (err != ZIP_OK)
|
||||||
{
|
{
|
||||||
# ifndef NO_ADDFILEINEXISTINGZIP
|
# ifndef NO_ADDFILEINEXISTINGZIP
|
||||||
TRYFREE(ziinit.globalcomment);
|
free(ziinit.globalcomment);
|
||||||
# endif /* !NO_ADDFILEINEXISTINGZIP*/
|
# endif /* !NO_ADDFILEINEXISTINGZIP*/
|
||||||
TRYFREE(zi);
|
free(zi);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -917,8 +883,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def)
|
extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) {
|
||||||
{
|
|
||||||
if (pzlib_filefunc32_def != NULL)
|
if (pzlib_filefunc32_def != NULL)
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||||
|
@ -929,8 +894,7 @@ extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* gl
|
||||||
return zipOpen3(pathname, append, globalcomment, NULL);
|
return zipOpen3(pathname, append, globalcomment, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)
|
extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
if (pzlib_filefunc_def != NULL)
|
if (pzlib_filefunc_def != NULL)
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||||
|
@ -945,18 +909,15 @@ extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen (const char* pathname, int append)
|
extern zipFile ZEXPORT zipOpen(const char* pathname, int append) {
|
||||||
{
|
|
||||||
return zipOpen3((const void*)pathname,append,NULL,NULL);
|
return zipOpen3((const void*)pathname,append,NULL,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
|
extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) {
|
||||||
{
|
|
||||||
return zipOpen3(pathname,append,NULL,NULL);
|
return zipOpen3(pathname,append,NULL,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
|
local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) {
|
||||||
{
|
|
||||||
/* write the local header */
|
/* write the local header */
|
||||||
int err;
|
int err;
|
||||||
uInt size_filename = (uInt)strlen(filename);
|
uInt size_filename = (uInt)strlen(filename);
|
||||||
|
@ -1052,14 +1013,13 @@ local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt s
|
||||||
It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
|
It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
|
||||||
unnecessary allocations.
|
unnecessary allocations.
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw,
|
const char* comment, int method, int level, int raw,
|
||||||
int windowBits,int memLevel, int strategy,
|
int windowBits,int memLevel, int strategy,
|
||||||
const char* password, uLong crcForCrypting,
|
const char* password, uLong crcForCrypting,
|
||||||
uLong versionMadeBy, uLong flagBase, int zip64)
|
uLong versionMadeBy, uLong flagBase, int zip64) {
|
||||||
{
|
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
uInt size_filename;
|
uInt size_filename;
|
||||||
uInt size_comment;
|
uInt size_comment;
|
||||||
|
@ -1083,6 +1043,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
||||||
return ZIP_PARAMERROR;
|
return ZIP_PARAMERROR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// The filename and comment length must fit in 16 bits.
|
||||||
|
if ((filename!=NULL) && (strlen(filename)>0xffff))
|
||||||
|
return ZIP_PARAMERROR;
|
||||||
|
if ((comment!=NULL) && (strlen(comment)>0xffff))
|
||||||
|
return ZIP_PARAMERROR;
|
||||||
|
// The extra field length must fit in 16 bits. If the member also requires
|
||||||
|
// a Zip64 extra block, that will also need to fit within that 16-bit
|
||||||
|
// length, but that will be checked for later.
|
||||||
|
if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
|
||||||
|
return ZIP_PARAMERROR;
|
||||||
|
|
||||||
zi = (zip64_internal*)file;
|
zi = (zip64_internal*)file;
|
||||||
|
|
||||||
if (zi->in_opened_file_inzip == 1)
|
if (zi->in_opened_file_inzip == 1)
|
||||||
|
@ -1262,35 +1233,33 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw,
|
const char* comment, int method, int level, int raw,
|
||||||
int windowBits,int memLevel, int strategy,
|
int windowBits,int memLevel, int strategy,
|
||||||
const char* password, uLong crcForCrypting,
|
const char* password, uLong crcForCrypting,
|
||||||
uLong versionMadeBy, uLong flagBase)
|
uLong versionMadeBy, uLong flagBase) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
windowBits, memLevel, strategy,
|
||||||
windowBits, memLevel, strategy,
|
password, crcForCrypting, versionMadeBy, flagBase, 0);
|
||||||
password, crcForCrypting, versionMadeBy, flagBase, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw,
|
const char* comment, int method, int level, int raw,
|
||||||
int windowBits,int memLevel, int strategy,
|
int windowBits,int memLevel, int strategy,
|
||||||
const char* password, uLong crcForCrypting)
|
const char* password, uLong crcForCrypting) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
windowBits, memLevel, strategy,
|
||||||
windowBits, memLevel, strategy,
|
password, crcForCrypting, VERSIONMADEBY, 0, 0);
|
||||||
password, crcForCrypting, VERSIONMADEBY, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
|
@ -1298,70 +1267,64 @@ extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, c
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw,
|
const char* comment, int method, int level, int raw,
|
||||||
int windowBits,int memLevel, int strategy,
|
int windowBits,int memLevel, int strategy,
|
||||||
const char* password, uLong crcForCrypting, int zip64)
|
const char* password, uLong crcForCrypting, int zip64) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
windowBits, memLevel, strategy,
|
||||||
windowBits, memLevel, strategy,
|
password, crcForCrypting, VERSIONMADEBY, 0, zip64);
|
||||||
password, crcForCrypting, VERSIONMADEBY, 0, zip64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw)
|
const char* comment, int method, int level, int raw) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
NULL, 0, VERSIONMADEBY, 0, 0);
|
||||||
NULL, 0, VERSIONMADEBY, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw, int zip64)
|
const char* comment, int method, int level, int raw, int zip64) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
NULL, 0, VERSIONMADEBY, 0, zip64);
|
||||||
NULL, 0, VERSIONMADEBY, 0, zip64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void*extrafield_global, uInt size_extrafield_global,
|
const void*extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int zip64)
|
const char* comment, int method, int level, int zip64) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, 0,
|
||||||
comment, method, level, 0,
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
NULL, 0, VERSIONMADEBY, 0, zip64);
|
||||||
NULL, 0, VERSIONMADEBY, 0, zip64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void*extrafield_global, uInt size_extrafield_global,
|
const void*extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level)
|
const char* comment, int method, int level) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, 0,
|
||||||
comment, method, level, 0,
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
NULL, 0, VERSIONMADEBY, 0, 0);
|
||||||
NULL, 0, VERSIONMADEBY, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local int zip64FlushWriteBuffer(zip64_internal* zi)
|
local int zip64FlushWriteBuffer(zip64_internal* zi) {
|
||||||
{
|
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
|
|
||||||
if (zi->ci.encrypt != 0)
|
if (zi->ci.encrypt != 0)
|
||||||
|
@ -1399,8 +1362,7 @@ local int zip64FlushWriteBuffer(zip64_internal* zi)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len)
|
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned int len) {
|
||||||
{
|
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
|
|
||||||
|
@ -1450,7 +1412,7 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
zi->ci.stream.next_in = (Bytef*)buf;
|
zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
|
||||||
zi->ci.stream.avail_in = len;
|
zi->ci.stream.avail_in = len;
|
||||||
|
|
||||||
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
|
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
|
||||||
|
@ -1501,13 +1463,11 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32)
|
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) {
|
||||||
{
|
|
||||||
return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
|
return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
|
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) {
|
||||||
{
|
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
ZPOS64_T compressed_size;
|
ZPOS64_T compressed_size;
|
||||||
uLong invalidValue = 0xffffffff;
|
uLong invalidValue = 0xffffffff;
|
||||||
|
@ -1648,7 +1608,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
|
||||||
|
|
||||||
if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
|
if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
|
||||||
{
|
{
|
||||||
// we can not write more data to the buffer that we have room for.
|
// we cannot write more data to the buffer that we have room for.
|
||||||
return ZIP_BADZIPFILE;
|
return ZIP_BADZIPFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1742,13 +1702,11 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZip (zipFile file)
|
extern int ZEXPORT zipCloseFileInZip(zipFile file) {
|
||||||
{
|
|
||||||
return zipCloseFileInZipRaw (file,0,0);
|
return zipCloseFileInZipRaw (file,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
|
local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) {
|
||||||
{
|
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
|
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
|
||||||
|
|
||||||
|
@ -1769,8 +1727,7 @@ local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T z
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
|
||||||
{
|
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
|
|
||||||
uLong Zip64DataSize = 44;
|
uLong Zip64DataSize = 44;
|
||||||
|
@ -1808,8 +1765,8 @@ local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
|
||||||
{
|
local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
|
|
||||||
/*signature*/
|
/*signature*/
|
||||||
|
@ -1856,8 +1813,7 @@ local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centr
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) {
|
||||||
{
|
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
uInt size_global_comment = 0;
|
uInt size_global_comment = 0;
|
||||||
|
|
||||||
|
@ -1874,8 +1830,7 @@ local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
|
||||||
{
|
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
uLong size_centraldir = 0;
|
uLong size_centraldir = 0;
|
||||||
|
@ -1917,7 +1872,7 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
||||||
free_linkedlist(&(zi->central_dir));
|
free_linkedlist(&(zi->central_dir));
|
||||||
|
|
||||||
pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
||||||
if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
|
if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF)
|
||||||
{
|
{
|
||||||
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
|
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
|
||||||
Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
|
Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
|
||||||
|
@ -1936,15 +1891,14 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
||||||
err = ZIP_ERRNO;
|
err = ZIP_ERRNO;
|
||||||
|
|
||||||
#ifndef NO_ADDFILEINEXISTINGZIP
|
#ifndef NO_ADDFILEINEXISTINGZIP
|
||||||
TRYFREE(zi->globalcomment);
|
free(zi->globalcomment);
|
||||||
#endif
|
#endif
|
||||||
TRYFREE(zi);
|
free(zi);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader)
|
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
|
||||||
{
|
|
||||||
char* p = pData;
|
char* p = pData;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
char* pNewHeader;
|
char* pNewHeader;
|
||||||
|
@ -1996,7 +1950,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
|
||||||
else
|
else
|
||||||
retVal = ZIP_ERRNO;
|
retVal = ZIP_ERRNO;
|
||||||
|
|
||||||
TRYFREE(pNewHeader);
|
free(pNewHeader);
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
364
src/dependencies/zlib-1.3.1/contrib/minizip/zip.h
Normal file
364
src/dependencies/zlib-1.3.1/contrib/minizip/zip.h
Normal file
|
@ -0,0 +1,364 @@
|
||||||
|
/* zip.h -- IO on .zip files using zlib
|
||||||
|
Version 1.1, February 14h, 2010
|
||||||
|
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
||||||
|
|
||||||
|
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
||||||
|
|
||||||
|
Modifications for Zip64 support
|
||||||
|
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||||
|
|
||||||
|
For more info read MiniZip_info.txt
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Condition of use and distribution are the same than zlib :
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Changes
|
||||||
|
|
||||||
|
See header of zip.h
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _zip12_H
|
||||||
|
#define _zip12_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#define HAVE_BZIP2
|
||||||
|
|
||||||
|
#ifndef _ZLIB_H
|
||||||
|
#include "zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ZLIBIOAPI_H
|
||||||
|
#include "ioapi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_BZIP2
|
||||||
|
#include "bzlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Z_BZIP2ED 12
|
||||||
|
|
||||||
|
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
|
||||||
|
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||||
|
from (void*) without cast */
|
||||||
|
typedef struct TagzipFile__ { int unused; } zipFile__;
|
||||||
|
typedef zipFile__ *zipFile;
|
||||||
|
#else
|
||||||
|
typedef voidp zipFile;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ZIP_OK (0)
|
||||||
|
#define ZIP_EOF (0)
|
||||||
|
#define ZIP_ERRNO (Z_ERRNO)
|
||||||
|
#define ZIP_PARAMERROR (-102)
|
||||||
|
#define ZIP_BADZIPFILE (-103)
|
||||||
|
#define ZIP_INTERNALERROR (-104)
|
||||||
|
|
||||||
|
#ifndef DEF_MEM_LEVEL
|
||||||
|
# if MAX_MEM_LEVEL >= 8
|
||||||
|
# define DEF_MEM_LEVEL 8
|
||||||
|
# else
|
||||||
|
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
/* default memLevel */
|
||||||
|
|
||||||
|
/* tm_zip contain date/time info */
|
||||||
|
typedef struct tm_zip_s
|
||||||
|
{
|
||||||
|
int tm_sec; /* seconds after the minute - [0,59] */
|
||||||
|
int tm_min; /* minutes after the hour - [0,59] */
|
||||||
|
int tm_hour; /* hours since midnight - [0,23] */
|
||||||
|
int tm_mday; /* day of the month - [1,31] */
|
||||||
|
int tm_mon; /* months since January - [0,11] */
|
||||||
|
int tm_year; /* years - [1980..2044] */
|
||||||
|
} tm_zip;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
tm_zip tmz_date; /* date in understandable format */
|
||||||
|
uLong dosDate; /* if dos_date == 0, tmu_date is used */
|
||||||
|
/* uLong flag; */ /* general purpose bit flag 2 bytes */
|
||||||
|
|
||||||
|
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||||
|
uLong external_fa; /* external file attributes 4 bytes */
|
||||||
|
} zip_fileinfo;
|
||||||
|
|
||||||
|
typedef const char* zipcharpc;
|
||||||
|
|
||||||
|
|
||||||
|
#define APPEND_STATUS_CREATE (0)
|
||||||
|
#define APPEND_STATUS_CREATEAFTER (1)
|
||||||
|
#define APPEND_STATUS_ADDINZIP (2)
|
||||||
|
|
||||||
|
extern zipFile ZEXPORT zipOpen(const char *pathname, int append);
|
||||||
|
extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
|
||||||
|
/*
|
||||||
|
Create a zipfile.
|
||||||
|
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
||||||
|
an Unix computer "zlib/zlib113.zip".
|
||||||
|
if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
|
||||||
|
will be created at the end of the file.
|
||||||
|
(useful if the file contain a self extractor code)
|
||||||
|
if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
|
||||||
|
add files in existing zip (be sure you don't add file that doesn't exist)
|
||||||
|
If the zipfile cannot be opened, the return value is NULL.
|
||||||
|
Else, the return value is a zipFile Handle, usable with other function
|
||||||
|
of this zip package.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Note : there is no delete function into a zipfile.
|
||||||
|
If you want delete file into a zipfile, you must open a zipfile, and create another
|
||||||
|
Of course, you can use RAW reading and writing to copy the file you did not want delete
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern zipFile ZEXPORT zipOpen2(const char *pathname,
|
||||||
|
int append,
|
||||||
|
zipcharpc* globalcomment,
|
||||||
|
zlib_filefunc_def* pzlib_filefunc_def);
|
||||||
|
|
||||||
|
extern zipFile ZEXPORT zipOpen2_64(const void *pathname,
|
||||||
|
int append,
|
||||||
|
zipcharpc* globalcomment,
|
||||||
|
zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
|
|
||||||
|
extern zipFile ZEXPORT zipOpen3(const void *pathname,
|
||||||
|
int append,
|
||||||
|
zipcharpc* globalcomment,
|
||||||
|
zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
|
||||||
|
|
||||||
|
extern 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);
|
||||||
|
|
||||||
|
extern 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Open a file in the ZIP for writing.
|
||||||
|
filename : the filename in zip (if NULL, '-' without quote will be used
|
||||||
|
*zipfi contain supplemental information
|
||||||
|
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
|
||||||
|
contains the extrafield data for the local header
|
||||||
|
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
|
||||||
|
contains the extrafield data for the global header
|
||||||
|
if comment != NULL, comment contain the comment string
|
||||||
|
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
||||||
|
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
||||||
|
zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
|
||||||
|
this MUST be '1' if the uncompressed size is >= 0xffffffff.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern 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);
|
||||||
|
|
||||||
|
|
||||||
|
extern 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);
|
||||||
|
/*
|
||||||
|
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern 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);
|
||||||
|
|
||||||
|
extern 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Same than zipOpenNewFileInZip2, except
|
||||||
|
windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
|
||||||
|
password : crypting password (NULL for no crypting)
|
||||||
|
crcForCrypting : crc of file to compress (needed for crypting)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern 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);
|
||||||
|
|
||||||
|
|
||||||
|
extern 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);
|
||||||
|
/*
|
||||||
|
Same than zipOpenNewFileInZip4, except
|
||||||
|
versionMadeBy : value for Version made by field
|
||||||
|
flag : value for flag field (compression level info will be added)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT zipWriteInFileInZip(zipFile file,
|
||||||
|
const void* buf,
|
||||||
|
unsigned len);
|
||||||
|
/*
|
||||||
|
Write data in the zipfile
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT zipCloseFileInZip(zipFile file);
|
||||||
|
/*
|
||||||
|
Close the current file in the zipfile
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file,
|
||||||
|
uLong uncompressed_size,
|
||||||
|
uLong crc32);
|
||||||
|
|
||||||
|
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file,
|
||||||
|
ZPOS64_T uncompressed_size,
|
||||||
|
uLong crc32);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Close the current file in the zipfile, for file opened with
|
||||||
|
parameter raw=1 in zipOpenNewFileInZip2
|
||||||
|
uncompressed_size and crc32 are value for the uncompressed size
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT zipClose(zipFile file,
|
||||||
|
const char* global_comment);
|
||||||
|
/*
|
||||||
|
Close the zipfile
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader);
|
||||||
|
/*
|
||||||
|
zipRemoveExtraInfoBlock - Added by Mathias Svensson
|
||||||
|
|
||||||
|
Remove extra information block from a extra information data for the local file header or central directory header
|
||||||
|
|
||||||
|
It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode.
|
||||||
|
|
||||||
|
0x0001 is the signature header for the ZIP64 extra information blocks
|
||||||
|
|
||||||
|
usage.
|
||||||
|
Remove ZIP64 Extra information from a central director extra field data
|
||||||
|
zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001);
|
||||||
|
|
||||||
|
Remove ZIP64 Extra information from a Local File Header extra field data
|
||||||
|
zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _zip64_H */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue