|
kusano |
fc6ab3 |
/* unzip.h -- IO for uncompress .zip files using zlib
|
|
kusano |
fc6ab3 |
Version 1.1, February 14h, 2010
|
|
kusano |
fc6ab3 |
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
Modifications of Unzip for Zip64
|
|
kusano |
fc6ab3 |
Copyright (C) 2007-2008 Even Rouault
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
Modifications for Zip64 support on both zip and unzip
|
|
kusano |
fc6ab3 |
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
For more info read MiniZip_info.txt
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
---------------------------------------------------------------------------------
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
Condition of use and distribution are the same than zlib :
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
This software is provided 'as-is', without any express or implied
|
|
kusano |
fc6ab3 |
warranty. In no event will the authors be held liable for any damages
|
|
kusano |
fc6ab3 |
arising from the use of this software.
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
Permission is granted to anyone to use this software for any purpose,
|
|
kusano |
fc6ab3 |
including commercial applications, and to alter it and redistribute it
|
|
kusano |
fc6ab3 |
freely, subject to the following restrictions:
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
1. The origin of this software must not be misrepresented; you must not
|
|
kusano |
fc6ab3 |
claim that you wrote the original software. If you use this software
|
|
kusano |
fc6ab3 |
in a product, an acknowledgment in the product documentation would be
|
|
kusano |
fc6ab3 |
appreciated but is not required.
|
|
kusano |
fc6ab3 |
2. Altered source versions must be plainly marked as such, and must not be
|
|
kusano |
fc6ab3 |
misrepresented as being the original software.
|
|
kusano |
fc6ab3 |
3. This notice may not be removed or altered from any source distribution.
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
---------------------------------------------------------------------------------
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
Changes
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
See header of unzip64.c
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#ifndef _unz64_H
|
|
kusano |
fc6ab3 |
#define _unz64_H
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#ifdef __cplusplus
|
|
kusano |
fc6ab3 |
extern "C" {
|
|
kusano |
fc6ab3 |
#endif
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#ifndef _ZLIB_H
|
|
kusano |
fc6ab3 |
#include "zlib.h"
|
|
kusano |
fc6ab3 |
#endif
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#ifndef _ZLIBIOAPI_H
|
|
kusano |
fc6ab3 |
#include "ioapi.h"
|
|
kusano |
fc6ab3 |
#endif
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#ifdef HAVE_BZIP2
|
|
kusano |
fc6ab3 |
#include "bzlib.h"
|
|
kusano |
fc6ab3 |
#endif
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#define Z_BZIP2ED 12
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
|
kusano |
fc6ab3 |
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
|
kusano |
fc6ab3 |
from (void*) without cast */
|
|
kusano |
fc6ab3 |
typedef struct TagunzFile__ { int unused; } unzFile__;
|
|
kusano |
fc6ab3 |
typedef unzFile__ *unzFile;
|
|
kusano |
fc6ab3 |
#else
|
|
kusano |
fc6ab3 |
typedef voidp unzFile;
|
|
kusano |
fc6ab3 |
#endif
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#define UNZ_OK (0)
|
|
kusano |
fc6ab3 |
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
|
kusano |
fc6ab3 |
#define UNZ_ERRNO (Z_ERRNO)
|
|
kusano |
fc6ab3 |
#define UNZ_EOF (0)
|
|
kusano |
fc6ab3 |
#define UNZ_PARAMERROR (-102)
|
|
kusano |
fc6ab3 |
#define UNZ_BADZIPFILE (-103)
|
|
kusano |
fc6ab3 |
#define UNZ_INTERNALERROR (-104)
|
|
kusano |
fc6ab3 |
#define UNZ_CRCERROR (-105)
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/* tm_unz contain date/time info */
|
|
kusano |
fc6ab3 |
typedef struct tm_unz_s
|
|
kusano |
fc6ab3 |
{
|
|
kusano |
fc6ab3 |
uInt tm_sec; /* seconds after the minute - [0,59] */
|
|
kusano |
fc6ab3 |
uInt tm_min; /* minutes after the hour - [0,59] */
|
|
kusano |
fc6ab3 |
uInt tm_hour; /* hours since midnight - [0,23] */
|
|
kusano |
fc6ab3 |
uInt tm_mday; /* day of the month - [1,31] */
|
|
kusano |
fc6ab3 |
uInt tm_mon; /* months since January - [0,11] */
|
|
kusano |
fc6ab3 |
uInt tm_year; /* years - [1980..2044] */
|
|
kusano |
fc6ab3 |
} tm_unz;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/* unz_global_info structure contain global data about the ZIPfile
|
|
kusano |
fc6ab3 |
These data comes from the end of central dir */
|
|
kusano |
fc6ab3 |
typedef struct unz_global_info64_s
|
|
kusano |
fc6ab3 |
{
|
|
kusano |
fc6ab3 |
ZPOS64_T number_entry; /* total number of entries in
|
|
kusano |
fc6ab3 |
the central dir on this disk */
|
|
kusano |
fc6ab3 |
uLong size_comment; /* size of the global comment of the zipfile */
|
|
kusano |
fc6ab3 |
} unz_global_info64;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
typedef struct unz_global_info_s
|
|
kusano |
fc6ab3 |
{
|
|
kusano |
fc6ab3 |
uLong number_entry; /* total number of entries in
|
|
kusano |
fc6ab3 |
the central dir on this disk */
|
|
kusano |
fc6ab3 |
uLong size_comment; /* size of the global comment of the zipfile */
|
|
kusano |
fc6ab3 |
} unz_global_info;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/* unz_file_info contain information about a file in the zipfile */
|
|
kusano |
fc6ab3 |
typedef struct unz_file_info64_s
|
|
kusano |
fc6ab3 |
{
|
|
kusano |
fc6ab3 |
uLong version; /* version made by 2 bytes */
|
|
kusano |
fc6ab3 |
uLong version_needed; /* version needed to extract 2 bytes */
|
|
kusano |
fc6ab3 |
uLong flag; /* general purpose bit flag 2 bytes */
|
|
kusano |
fc6ab3 |
uLong compression_method; /* compression method 2 bytes */
|
|
kusano |
fc6ab3 |
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
|
kusano |
fc6ab3 |
uLong crc; /* crc-32 4 bytes */
|
|
kusano |
fc6ab3 |
ZPOS64_T compressed_size; /* compressed size 8 bytes */
|
|
kusano |
fc6ab3 |
ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */
|
|
kusano |
fc6ab3 |
uLong size_filename; /* filename length 2 bytes */
|
|
kusano |
fc6ab3 |
uLong size_file_extra; /* extra field length 2 bytes */
|
|
kusano |
fc6ab3 |
uLong size_file_comment; /* file comment length 2 bytes */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
uLong disk_num_start; /* disk number start 2 bytes */
|
|
kusano |
fc6ab3 |
uLong internal_fa; /* internal file attributes 2 bytes */
|
|
kusano |
fc6ab3 |
uLong external_fa; /* external file attributes 4 bytes */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
tm_unz tmu_date;
|
|
kusano |
fc6ab3 |
} unz_file_info64;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
typedef struct unz_file_info_s
|
|
kusano |
fc6ab3 |
{
|
|
kusano |
fc6ab3 |
uLong version; /* version made by 2 bytes */
|
|
kusano |
fc6ab3 |
uLong version_needed; /* version needed to extract 2 bytes */
|
|
kusano |
fc6ab3 |
uLong flag; /* general purpose bit flag 2 bytes */
|
|
kusano |
fc6ab3 |
uLong compression_method; /* compression method 2 bytes */
|
|
kusano |
fc6ab3 |
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
|
kusano |
fc6ab3 |
uLong crc; /* crc-32 4 bytes */
|
|
kusano |
fc6ab3 |
uLong compressed_size; /* compressed size 4 bytes */
|
|
kusano |
fc6ab3 |
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
|
kusano |
fc6ab3 |
uLong size_filename; /* filename length 2 bytes */
|
|
kusano |
fc6ab3 |
uLong size_file_extra; /* extra field length 2 bytes */
|
|
kusano |
fc6ab3 |
uLong size_file_comment; /* file comment length 2 bytes */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
uLong disk_num_start; /* disk number start 2 bytes */
|
|
kusano |
fc6ab3 |
uLong internal_fa; /* internal file attributes 2 bytes */
|
|
kusano |
fc6ab3 |
uLong external_fa; /* external file attributes 4 bytes */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
tm_unz tmu_date;
|
|
kusano |
fc6ab3 |
} unz_file_info;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
|
kusano |
fc6ab3 |
const char* fileName2,
|
|
kusano |
fc6ab3 |
int iCaseSensitivity));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Compare two filename (fileName1,fileName2).
|
|
kusano |
fc6ab3 |
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
|
kusano |
fc6ab3 |
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
|
kusano |
fc6ab3 |
or strcasecmp)
|
|
kusano |
fc6ab3 |
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
|
kusano |
fc6ab3 |
(like 1 on Unix, 2 on Windows)
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
|
kusano |
fc6ab3 |
extern unzFile ZEXPORT unzOpen64 OF((const void *path));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Open a Zip file. path contain the full pathname (by example,
|
|
kusano |
fc6ab3 |
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
|
kusano |
fc6ab3 |
"zlib/zlib113.zip".
|
|
kusano |
fc6ab3 |
If the zipfile cannot be opened (file don't exist or in not valid), the
|
|
kusano |
fc6ab3 |
return value is NULL.
|
|
kusano |
fc6ab3 |
Else, the return value is a unzFile Handle, usable with other function
|
|
kusano |
fc6ab3 |
of this unzip package.
|
|
kusano |
fc6ab3 |
the "64" function take a const void* pointer, because the path is just the
|
|
kusano |
fc6ab3 |
value passed to the open64_file_func callback.
|
|
kusano |
fc6ab3 |
Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path
|
|
kusano |
fc6ab3 |
is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char*
|
|
kusano |
fc6ab3 |
does not describe the reality
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
|
kusano |
fc6ab3 |
zlib_filefunc_def* pzlib_filefunc_def));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Open a Zip file, like unzOpen, but provide a set of file low level API
|
|
kusano |
fc6ab3 |
for read/write the zip file (see ioapi.h)
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
|
|
kusano |
fc6ab3 |
zlib_filefunc64_def* pzlib_filefunc_def));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Open a Zip file, like unz64Open, but provide a set of file low level API
|
|
kusano |
fc6ab3 |
for read/write the zip file (see ioapi.h)
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzClose OF((unzFile file));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Close a ZipFile opened with unzOpen.
|
|
kusano |
fc6ab3 |
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
|
kusano |
fc6ab3 |
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
|
kusano |
fc6ab3 |
return UNZ_OK if there is no problem. */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
|
kusano |
fc6ab3 |
unz_global_info *pglobal_info));
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
|
|
kusano |
fc6ab3 |
unz_global_info64 *pglobal_info));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Write info about the ZipFile in the *pglobal_info structure.
|
|
kusano |
fc6ab3 |
No preparation of the structure is needed
|
|
kusano |
fc6ab3 |
return UNZ_OK if there is no problem. */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
|
kusano |
fc6ab3 |
char *szComment,
|
|
kusano |
fc6ab3 |
uLong uSizeBuf));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Get the global comment string of the ZipFile, in the szComment buffer.
|
|
kusano |
fc6ab3 |
uSizeBuf is the size of the szComment buffer.
|
|
kusano |
fc6ab3 |
return the number of byte copied or an error code <0
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/***************************************************************************/
|
|
kusano |
fc6ab3 |
/* Unzip package allow you browse the directory of the zipfile */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Set the current file of the zipfile to the first file.
|
|
kusano |
fc6ab3 |
return UNZ_OK if there is no problem
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Set the current file of the zipfile to the next file.
|
|
kusano |
fc6ab3 |
return UNZ_OK if there is no problem
|
|
kusano |
fc6ab3 |
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
|
kusano |
fc6ab3 |
const char *szFileName,
|
|
kusano |
fc6ab3 |
int iCaseSensitivity));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Try locate the file szFileName in the zipfile.
|
|
kusano |
fc6ab3 |
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
return value :
|
|
kusano |
fc6ab3 |
UNZ_OK if the file is found. It becomes the current file.
|
|
kusano |
fc6ab3 |
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/* ****************************************** */
|
|
kusano |
fc6ab3 |
/* Ryan supplied functions */
|
|
kusano |
fc6ab3 |
/* unz_file_info contain information about a file in the zipfile */
|
|
kusano |
fc6ab3 |
typedef struct unz_file_pos_s
|
|
kusano |
fc6ab3 |
{
|
|
kusano |
fc6ab3 |
uLong pos_in_zip_directory; /* offset in zip file directory */
|
|
kusano |
fc6ab3 |
uLong num_of_file; /* # of file */
|
|
kusano |
fc6ab3 |
} unz_file_pos;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGetFilePos(
|
|
kusano |
fc6ab3 |
unzFile file,
|
|
kusano |
fc6ab3 |
unz_file_pos* file_pos);
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGoToFilePos(
|
|
kusano |
fc6ab3 |
unzFile file,
|
|
kusano |
fc6ab3 |
unz_file_pos* file_pos);
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
typedef struct unz64_file_pos_s
|
|
kusano |
fc6ab3 |
{
|
|
kusano |
fc6ab3 |
ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */
|
|
kusano |
fc6ab3 |
ZPOS64_T num_of_file; /* # of file */
|
|
kusano |
fc6ab3 |
} unz64_file_pos;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGetFilePos64(
|
|
kusano |
fc6ab3 |
unzFile file,
|
|
kusano |
fc6ab3 |
unz64_file_pos* file_pos);
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGoToFilePos64(
|
|
kusano |
fc6ab3 |
unzFile file,
|
|
kusano |
fc6ab3 |
const unz64_file_pos* file_pos);
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/* ****************************************** */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
|
|
kusano |
fc6ab3 |
unz_file_info64 *pfile_info,
|
|
kusano |
fc6ab3 |
char *szFileName,
|
|
kusano |
fc6ab3 |
uLong fileNameBufferSize,
|
|
kusano |
fc6ab3 |
void *extraField,
|
|
kusano |
fc6ab3 |
uLong extraFieldBufferSize,
|
|
kusano |
fc6ab3 |
char *szComment,
|
|
kusano |
fc6ab3 |
uLong commentBufferSize));
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
|
kusano |
fc6ab3 |
unz_file_info *pfile_info,
|
|
kusano |
fc6ab3 |
char *szFileName,
|
|
kusano |
fc6ab3 |
uLong fileNameBufferSize,
|
|
kusano |
fc6ab3 |
void *extraField,
|
|
kusano |
fc6ab3 |
uLong extraFieldBufferSize,
|
|
kusano |
fc6ab3 |
char *szComment,
|
|
kusano |
fc6ab3 |
uLong commentBufferSize));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Get Info about the current file
|
|
kusano |
fc6ab3 |
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
|
kusano |
fc6ab3 |
the current file
|
|
kusano |
fc6ab3 |
if szFileName!=NULL, the filemane string will be copied in szFileName
|
|
kusano |
fc6ab3 |
(fileNameBufferSize is the size of the buffer)
|
|
kusano |
fc6ab3 |
if extraField!=NULL, the extra field information will be copied in extraField
|
|
kusano |
fc6ab3 |
(extraFieldBufferSize is the size of the buffer).
|
|
kusano |
fc6ab3 |
This is the Central-header version of the extra field
|
|
kusano |
fc6ab3 |
if szComment!=NULL, the comment string of the file will be copied in szComment
|
|
kusano |
fc6ab3 |
(commentBufferSize is the size of the buffer)
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/** Addition for GDAL : START */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/** Addition for GDAL : END */
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/***************************************************************************/
|
|
kusano |
fc6ab3 |
/* for reading the content of the current zipfile, you can open it, read data
|
|
kusano |
fc6ab3 |
from it, and close it (you can close it before reading all the file)
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Open for reading data the current file in the zipfile.
|
|
kusano |
fc6ab3 |
If there is no error, the return value is UNZ_OK.
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
|
kusano |
fc6ab3 |
const char* password));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Open for reading data the current file in the zipfile.
|
|
kusano |
fc6ab3 |
password is a crypting password
|
|
kusano |
fc6ab3 |
If there is no error, the return value is UNZ_OK.
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
|
kusano |
fc6ab3 |
int* method,
|
|
kusano |
fc6ab3 |
int* level,
|
|
kusano |
fc6ab3 |
int raw));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
|
kusano |
fc6ab3 |
if raw==1
|
|
kusano |
fc6ab3 |
*method will receive method of compression, *level will receive level of
|
|
kusano |
fc6ab3 |
compression
|
|
kusano |
fc6ab3 |
note : you can set level parameter as NULL (if you did not want known level,
|
|
kusano |
fc6ab3 |
but you CANNOT set method parameter as NULL
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
|
kusano |
fc6ab3 |
int* method,
|
|
kusano |
fc6ab3 |
int* level,
|
|
kusano |
fc6ab3 |
int raw,
|
|
kusano |
fc6ab3 |
const char* password));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
|
kusano |
fc6ab3 |
if raw==1
|
|
kusano |
fc6ab3 |
*method will receive method of compression, *level will receive level of
|
|
kusano |
fc6ab3 |
compression
|
|
kusano |
fc6ab3 |
note : you can set level parameter as NULL (if you did not want known level,
|
|
kusano |
fc6ab3 |
but you CANNOT set method parameter as NULL
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Close the file in zip opened with unzOpenCurrentFile
|
|
kusano |
fc6ab3 |
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
|
kusano |
fc6ab3 |
voidp buf,
|
|
kusano |
fc6ab3 |
unsigned len));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Read bytes from the current file (opened by unzOpenCurrentFile)
|
|
kusano |
fc6ab3 |
buf contain buffer where data must be copied
|
|
kusano |
fc6ab3 |
len the size of buf.
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
return the number of byte copied if somes bytes are copied
|
|
kusano |
fc6ab3 |
return 0 if the end of file was reached
|
|
kusano |
fc6ab3 |
return <0 with error code if there is an error
|
|
kusano |
fc6ab3 |
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Give the current position in uncompressed data
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzeof OF((unzFile file));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
return 1 if the end of file was reached, 0 elsewhere
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
|
kusano |
fc6ab3 |
voidp buf,
|
|
kusano |
fc6ab3 |
unsigned len));
|
|
kusano |
fc6ab3 |
/*
|
|
kusano |
fc6ab3 |
Read extra field from the current file (opened by unzOpenCurrentFile)
|
|
kusano |
fc6ab3 |
This is the local-header version of the extra field (sometimes, there is
|
|
kusano |
fc6ab3 |
more info in the local-header version than in the central-header)
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
if buf==NULL, it return the size of the local extra field
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
|
kusano |
fc6ab3 |
buf.
|
|
kusano |
fc6ab3 |
the return value is the number of bytes copied in buf, or (if <0)
|
|
kusano |
fc6ab3 |
the error code
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/***************************************************************************/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/* Get the current file offset */
|
|
kusano |
fc6ab3 |
extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file);
|
|
kusano |
fc6ab3 |
extern uLong ZEXPORT unzGetOffset (unzFile file);
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/* Set the current file offset */
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos);
|
|
kusano |
fc6ab3 |
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#ifdef __cplusplus
|
|
kusano |
fc6ab3 |
}
|
|
kusano |
fc6ab3 |
#endif
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#endif /* _unz64_H */
|