1*86ee64e7SAndroid Build Coastguard Worker /* unzip.h -- IO for uncompress .zip files using zlib 2*86ee64e7SAndroid Build Coastguard Worker Version 1.1, February 14h, 2010 3*86ee64e7SAndroid Build Coastguard Worker part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4*86ee64e7SAndroid Build Coastguard Worker 5*86ee64e7SAndroid Build Coastguard Worker Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6*86ee64e7SAndroid Build Coastguard Worker 7*86ee64e7SAndroid Build Coastguard Worker Modifications of Unzip for Zip64 8*86ee64e7SAndroid Build Coastguard Worker Copyright (C) 2007-2008 Even Rouault 9*86ee64e7SAndroid Build Coastguard Worker 10*86ee64e7SAndroid Build Coastguard Worker Modifications for Zip64 support on both zip and unzip 11*86ee64e7SAndroid Build Coastguard Worker Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 12*86ee64e7SAndroid Build Coastguard Worker 13*86ee64e7SAndroid Build Coastguard Worker For more info read MiniZip_info.txt 14*86ee64e7SAndroid Build Coastguard Worker 15*86ee64e7SAndroid Build Coastguard Worker --------------------------------------------------------------------------------- 16*86ee64e7SAndroid Build Coastguard Worker 17*86ee64e7SAndroid Build Coastguard Worker Condition of use and distribution are the same than zlib : 18*86ee64e7SAndroid Build Coastguard Worker 19*86ee64e7SAndroid Build Coastguard Worker This software is provided 'as-is', without any express or implied 20*86ee64e7SAndroid Build Coastguard Worker warranty. In no event will the authors be held liable for any damages 21*86ee64e7SAndroid Build Coastguard Worker arising from the use of this software. 22*86ee64e7SAndroid Build Coastguard Worker 23*86ee64e7SAndroid Build Coastguard Worker Permission is granted to anyone to use this software for any purpose, 24*86ee64e7SAndroid Build Coastguard Worker including commercial applications, and to alter it and redistribute it 25*86ee64e7SAndroid Build Coastguard Worker freely, subject to the following restrictions: 26*86ee64e7SAndroid Build Coastguard Worker 27*86ee64e7SAndroid Build Coastguard Worker 1. The origin of this software must not be misrepresented; you must not 28*86ee64e7SAndroid Build Coastguard Worker claim that you wrote the original software. If you use this software 29*86ee64e7SAndroid Build Coastguard Worker in a product, an acknowledgment in the product documentation would be 30*86ee64e7SAndroid Build Coastguard Worker appreciated but is not required. 31*86ee64e7SAndroid Build Coastguard Worker 2. Altered source versions must be plainly marked as such, and must not be 32*86ee64e7SAndroid Build Coastguard Worker misrepresented as being the original software. 33*86ee64e7SAndroid Build Coastguard Worker 3. This notice may not be removed or altered from any source distribution. 34*86ee64e7SAndroid Build Coastguard Worker 35*86ee64e7SAndroid Build Coastguard Worker --------------------------------------------------------------------------------- 36*86ee64e7SAndroid Build Coastguard Worker 37*86ee64e7SAndroid Build Coastguard Worker Changes 38*86ee64e7SAndroid Build Coastguard Worker 39*86ee64e7SAndroid Build Coastguard Worker See header of unzip64.c 40*86ee64e7SAndroid Build Coastguard Worker 41*86ee64e7SAndroid Build Coastguard Worker */ 42*86ee64e7SAndroid Build Coastguard Worker 43*86ee64e7SAndroid Build Coastguard Worker #ifndef _unz64_H 44*86ee64e7SAndroid Build Coastguard Worker #define _unz64_H 45*86ee64e7SAndroid Build Coastguard Worker 46*86ee64e7SAndroid Build Coastguard Worker #ifdef __cplusplus 47*86ee64e7SAndroid Build Coastguard Worker extern "C" { 48*86ee64e7SAndroid Build Coastguard Worker #endif 49*86ee64e7SAndroid Build Coastguard Worker 50*86ee64e7SAndroid Build Coastguard Worker #ifndef _ZLIB_H 51*86ee64e7SAndroid Build Coastguard Worker #include "zlib.h" 52*86ee64e7SAndroid Build Coastguard Worker #endif 53*86ee64e7SAndroid Build Coastguard Worker 54*86ee64e7SAndroid Build Coastguard Worker #ifndef _ZLIBIOAPI_H 55*86ee64e7SAndroid Build Coastguard Worker #include "ioapi.h" 56*86ee64e7SAndroid Build Coastguard Worker #endif 57*86ee64e7SAndroid Build Coastguard Worker 58*86ee64e7SAndroid Build Coastguard Worker #ifdef HAVE_BZIP2 59*86ee64e7SAndroid Build Coastguard Worker #include "bzlib.h" 60*86ee64e7SAndroid Build Coastguard Worker #endif 61*86ee64e7SAndroid Build Coastguard Worker 62*86ee64e7SAndroid Build Coastguard Worker #define Z_BZIP2ED 12 63*86ee64e7SAndroid Build Coastguard Worker 64*86ee64e7SAndroid Build Coastguard Worker #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) 65*86ee64e7SAndroid Build Coastguard Worker /* like the STRICT of WIN32, we define a pointer that cannot be converted 66*86ee64e7SAndroid Build Coastguard Worker from (void*) without cast */ 67*86ee64e7SAndroid Build Coastguard Worker typedef struct TagunzFile__ { int unused; } unzFile__; 68*86ee64e7SAndroid Build Coastguard Worker typedef unzFile__ *unzFile; 69*86ee64e7SAndroid Build Coastguard Worker #else 70*86ee64e7SAndroid Build Coastguard Worker typedef voidp unzFile; 71*86ee64e7SAndroid Build Coastguard Worker #endif 72*86ee64e7SAndroid Build Coastguard Worker 73*86ee64e7SAndroid Build Coastguard Worker 74*86ee64e7SAndroid Build Coastguard Worker #define UNZ_OK (0) 75*86ee64e7SAndroid Build Coastguard Worker #define UNZ_END_OF_LIST_OF_FILE (-100) 76*86ee64e7SAndroid Build Coastguard Worker #define UNZ_ERRNO (Z_ERRNO) 77*86ee64e7SAndroid Build Coastguard Worker #define UNZ_EOF (0) 78*86ee64e7SAndroid Build Coastguard Worker #define UNZ_PARAMERROR (-102) 79*86ee64e7SAndroid Build Coastguard Worker #define UNZ_BADZIPFILE (-103) 80*86ee64e7SAndroid Build Coastguard Worker #define UNZ_INTERNALERROR (-104) 81*86ee64e7SAndroid Build Coastguard Worker #define UNZ_CRCERROR (-105) 82*86ee64e7SAndroid Build Coastguard Worker 83*86ee64e7SAndroid Build Coastguard Worker /* tm_unz contain date/time info */ 84*86ee64e7SAndroid Build Coastguard Worker typedef struct tm_unz_s 85*86ee64e7SAndroid Build Coastguard Worker { 86*86ee64e7SAndroid Build Coastguard Worker int tm_sec; /* seconds after the minute - [0,59] */ 87*86ee64e7SAndroid Build Coastguard Worker int tm_min; /* minutes after the hour - [0,59] */ 88*86ee64e7SAndroid Build Coastguard Worker int tm_hour; /* hours since midnight - [0,23] */ 89*86ee64e7SAndroid Build Coastguard Worker int tm_mday; /* day of the month - [1,31] */ 90*86ee64e7SAndroid Build Coastguard Worker int tm_mon; /* months since January - [0,11] */ 91*86ee64e7SAndroid Build Coastguard Worker int tm_year; /* years - [1980..2044] */ 92*86ee64e7SAndroid Build Coastguard Worker } tm_unz; 93*86ee64e7SAndroid Build Coastguard Worker 94*86ee64e7SAndroid Build Coastguard Worker /* unz_global_info structure contain global data about the ZIPfile 95*86ee64e7SAndroid Build Coastguard Worker These data comes from the end of central dir */ 96*86ee64e7SAndroid Build Coastguard Worker typedef struct unz_global_info64_s 97*86ee64e7SAndroid Build Coastguard Worker { 98*86ee64e7SAndroid Build Coastguard Worker ZPOS64_T number_entry; /* total number of entries in 99*86ee64e7SAndroid Build Coastguard Worker the central dir on this disk */ 100*86ee64e7SAndroid Build Coastguard Worker uLong size_comment; /* size of the global comment of the zipfile */ 101*86ee64e7SAndroid Build Coastguard Worker } unz_global_info64; 102*86ee64e7SAndroid Build Coastguard Worker 103*86ee64e7SAndroid Build Coastguard Worker typedef struct unz_global_info_s 104*86ee64e7SAndroid Build Coastguard Worker { 105*86ee64e7SAndroid Build Coastguard Worker uLong number_entry; /* total number of entries in 106*86ee64e7SAndroid Build Coastguard Worker the central dir on this disk */ 107*86ee64e7SAndroid Build Coastguard Worker uLong size_comment; /* size of the global comment of the zipfile */ 108*86ee64e7SAndroid Build Coastguard Worker } unz_global_info; 109*86ee64e7SAndroid Build Coastguard Worker 110*86ee64e7SAndroid Build Coastguard Worker /* unz_file_info contain information about a file in the zipfile */ 111*86ee64e7SAndroid Build Coastguard Worker typedef struct unz_file_info64_s 112*86ee64e7SAndroid Build Coastguard Worker { 113*86ee64e7SAndroid Build Coastguard Worker uLong version; /* version made by 2 bytes */ 114*86ee64e7SAndroid Build Coastguard Worker uLong version_needed; /* version needed to extract 2 bytes */ 115*86ee64e7SAndroid Build Coastguard Worker uLong flag; /* general purpose bit flag 2 bytes */ 116*86ee64e7SAndroid Build Coastguard Worker uLong compression_method; /* compression method 2 bytes */ 117*86ee64e7SAndroid Build Coastguard Worker uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 118*86ee64e7SAndroid Build Coastguard Worker uLong crc; /* crc-32 4 bytes */ 119*86ee64e7SAndroid Build Coastguard Worker ZPOS64_T compressed_size; /* compressed size 8 bytes */ 120*86ee64e7SAndroid Build Coastguard Worker ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ 121*86ee64e7SAndroid Build Coastguard Worker uLong size_filename; /* filename length 2 bytes */ 122*86ee64e7SAndroid Build Coastguard Worker uLong size_file_extra; /* extra field length 2 bytes */ 123*86ee64e7SAndroid Build Coastguard Worker uLong size_file_comment; /* file comment length 2 bytes */ 124*86ee64e7SAndroid Build Coastguard Worker 125*86ee64e7SAndroid Build Coastguard Worker uLong disk_num_start; /* disk number start 2 bytes */ 126*86ee64e7SAndroid Build Coastguard Worker uLong internal_fa; /* internal file attributes 2 bytes */ 127*86ee64e7SAndroid Build Coastguard Worker uLong external_fa; /* external file attributes 4 bytes */ 128*86ee64e7SAndroid Build Coastguard Worker 129*86ee64e7SAndroid Build Coastguard Worker tm_unz tmu_date; 130*86ee64e7SAndroid Build Coastguard Worker } unz_file_info64; 131*86ee64e7SAndroid Build Coastguard Worker 132*86ee64e7SAndroid Build Coastguard Worker typedef struct unz_file_info_s 133*86ee64e7SAndroid Build Coastguard Worker { 134*86ee64e7SAndroid Build Coastguard Worker uLong version; /* version made by 2 bytes */ 135*86ee64e7SAndroid Build Coastguard Worker uLong version_needed; /* version needed to extract 2 bytes */ 136*86ee64e7SAndroid Build Coastguard Worker uLong flag; /* general purpose bit flag 2 bytes */ 137*86ee64e7SAndroid Build Coastguard Worker uLong compression_method; /* compression method 2 bytes */ 138*86ee64e7SAndroid Build Coastguard Worker uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 139*86ee64e7SAndroid Build Coastguard Worker uLong crc; /* crc-32 4 bytes */ 140*86ee64e7SAndroid Build Coastguard Worker uLong compressed_size; /* compressed size 4 bytes */ 141*86ee64e7SAndroid Build Coastguard Worker uLong uncompressed_size; /* uncompressed size 4 bytes */ 142*86ee64e7SAndroid Build Coastguard Worker uLong size_filename; /* filename length 2 bytes */ 143*86ee64e7SAndroid Build Coastguard Worker uLong size_file_extra; /* extra field length 2 bytes */ 144*86ee64e7SAndroid Build Coastguard Worker uLong size_file_comment; /* file comment length 2 bytes */ 145*86ee64e7SAndroid Build Coastguard Worker 146*86ee64e7SAndroid Build Coastguard Worker uLong disk_num_start; /* disk number start 2 bytes */ 147*86ee64e7SAndroid Build Coastguard Worker uLong internal_fa; /* internal file attributes 2 bytes */ 148*86ee64e7SAndroid Build Coastguard Worker uLong external_fa; /* external file attributes 4 bytes */ 149*86ee64e7SAndroid Build Coastguard Worker 150*86ee64e7SAndroid Build Coastguard Worker tm_unz tmu_date; 151*86ee64e7SAndroid Build Coastguard Worker } unz_file_info; 152*86ee64e7SAndroid Build Coastguard Worker 153*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzStringFileNameCompare(const char* fileName1, 154*86ee64e7SAndroid Build Coastguard Worker const char* fileName2, 155*86ee64e7SAndroid Build Coastguard Worker int iCaseSensitivity); 156*86ee64e7SAndroid Build Coastguard Worker /* 157*86ee64e7SAndroid Build Coastguard Worker Compare two filenames (fileName1,fileName2). 158*86ee64e7SAndroid Build Coastguard Worker If iCaseSensitivity = 1, comparison is case sensitive (like strcmp) 159*86ee64e7SAndroid Build Coastguard Worker If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi 160*86ee64e7SAndroid Build Coastguard Worker or strcasecmp) 161*86ee64e7SAndroid Build Coastguard Worker If iCaseSensitivity = 0, case sensitivity is default of your operating system 162*86ee64e7SAndroid Build Coastguard Worker (like 1 on Unix, 2 on Windows) 163*86ee64e7SAndroid Build Coastguard Worker */ 164*86ee64e7SAndroid Build Coastguard Worker 165*86ee64e7SAndroid Build Coastguard Worker 166*86ee64e7SAndroid Build Coastguard Worker extern unzFile ZEXPORT unzOpen(const char *path); 167*86ee64e7SAndroid Build Coastguard Worker extern unzFile ZEXPORT unzOpen64(const void *path); 168*86ee64e7SAndroid Build Coastguard Worker /* 169*86ee64e7SAndroid Build Coastguard Worker Open a Zip file. path contain the full pathname (by example, 170*86ee64e7SAndroid Build Coastguard Worker on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer 171*86ee64e7SAndroid Build Coastguard Worker "zlib/zlib113.zip". 172*86ee64e7SAndroid Build Coastguard Worker If the zipfile cannot be opened (file don't exist or in not valid), the 173*86ee64e7SAndroid Build Coastguard Worker return value is NULL. 174*86ee64e7SAndroid Build Coastguard Worker Else, the return value is a unzFile Handle, usable with other function 175*86ee64e7SAndroid Build Coastguard Worker of this unzip package. 176*86ee64e7SAndroid Build Coastguard Worker the "64" function take a const void* pointer, because the path is just the 177*86ee64e7SAndroid Build Coastguard Worker value passed to the open64_file_func callback. 178*86ee64e7SAndroid Build Coastguard Worker Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path 179*86ee64e7SAndroid Build Coastguard Worker is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* 180*86ee64e7SAndroid Build Coastguard Worker does not describe the reality 181*86ee64e7SAndroid Build Coastguard Worker */ 182*86ee64e7SAndroid Build Coastguard Worker 183*86ee64e7SAndroid Build Coastguard Worker 184*86ee64e7SAndroid Build Coastguard Worker extern unzFile ZEXPORT unzOpen2(const char *path, 185*86ee64e7SAndroid Build Coastguard Worker zlib_filefunc_def* pzlib_filefunc_def); 186*86ee64e7SAndroid Build Coastguard Worker /* 187*86ee64e7SAndroid Build Coastguard Worker Open a Zip file, like unzOpen, but provide a set of file low level API 188*86ee64e7SAndroid Build Coastguard Worker for read/write the zip file (see ioapi.h) 189*86ee64e7SAndroid Build Coastguard Worker */ 190*86ee64e7SAndroid Build Coastguard Worker 191*86ee64e7SAndroid Build Coastguard Worker extern unzFile ZEXPORT unzOpen2_64(const void *path, 192*86ee64e7SAndroid Build Coastguard Worker zlib_filefunc64_def* pzlib_filefunc_def); 193*86ee64e7SAndroid Build Coastguard Worker /* 194*86ee64e7SAndroid Build Coastguard Worker Open a Zip file, like unz64Open, but provide a set of file low level API 195*86ee64e7SAndroid Build Coastguard Worker for read/write the zip file (see ioapi.h) 196*86ee64e7SAndroid Build Coastguard Worker */ 197*86ee64e7SAndroid Build Coastguard Worker 198*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzClose(unzFile file); 199*86ee64e7SAndroid Build Coastguard Worker /* 200*86ee64e7SAndroid Build Coastguard Worker Close a ZipFile opened with unzOpen. 201*86ee64e7SAndroid Build Coastguard Worker If there is files inside the .Zip opened with unzOpenCurrentFile (see later), 202*86ee64e7SAndroid Build Coastguard Worker these files MUST be closed with unzCloseCurrentFile before call unzClose. 203*86ee64e7SAndroid Build Coastguard Worker return UNZ_OK if there is no problem. */ 204*86ee64e7SAndroid Build Coastguard Worker 205*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGetGlobalInfo(unzFile file, 206*86ee64e7SAndroid Build Coastguard Worker unz_global_info *pglobal_info); 207*86ee64e7SAndroid Build Coastguard Worker 208*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGetGlobalInfo64(unzFile file, 209*86ee64e7SAndroid Build Coastguard Worker unz_global_info64 *pglobal_info); 210*86ee64e7SAndroid Build Coastguard Worker /* 211*86ee64e7SAndroid Build Coastguard Worker Write info about the ZipFile in the *pglobal_info structure. 212*86ee64e7SAndroid Build Coastguard Worker No preparation of the structure is needed 213*86ee64e7SAndroid Build Coastguard Worker return UNZ_OK if there is no problem. */ 214*86ee64e7SAndroid Build Coastguard Worker 215*86ee64e7SAndroid Build Coastguard Worker 216*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGetGlobalComment(unzFile file, 217*86ee64e7SAndroid Build Coastguard Worker char *szComment, 218*86ee64e7SAndroid Build Coastguard Worker uLong uSizeBuf); 219*86ee64e7SAndroid Build Coastguard Worker /* 220*86ee64e7SAndroid Build Coastguard Worker Get the global comment string of the ZipFile, in the szComment buffer. 221*86ee64e7SAndroid Build Coastguard Worker uSizeBuf is the size of the szComment buffer. 222*86ee64e7SAndroid Build Coastguard Worker return the number of byte copied or an error code <0 223*86ee64e7SAndroid Build Coastguard Worker */ 224*86ee64e7SAndroid Build Coastguard Worker 225*86ee64e7SAndroid Build Coastguard Worker 226*86ee64e7SAndroid Build Coastguard Worker /***************************************************************************/ 227*86ee64e7SAndroid Build Coastguard Worker /* Unzip package allow you browse the directory of the zipfile */ 228*86ee64e7SAndroid Build Coastguard Worker 229*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGoToFirstFile(unzFile file); 230*86ee64e7SAndroid Build Coastguard Worker /* 231*86ee64e7SAndroid Build Coastguard Worker Set the current file of the zipfile to the first file. 232*86ee64e7SAndroid Build Coastguard Worker return UNZ_OK if there is no problem 233*86ee64e7SAndroid Build Coastguard Worker */ 234*86ee64e7SAndroid Build Coastguard Worker 235*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGoToNextFile(unzFile file); 236*86ee64e7SAndroid Build Coastguard Worker /* 237*86ee64e7SAndroid Build Coastguard Worker Set the current file of the zipfile to the next file. 238*86ee64e7SAndroid Build Coastguard Worker return UNZ_OK if there is no problem 239*86ee64e7SAndroid Build Coastguard Worker return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 240*86ee64e7SAndroid Build Coastguard Worker */ 241*86ee64e7SAndroid Build Coastguard Worker 242*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzLocateFile(unzFile file, 243*86ee64e7SAndroid Build Coastguard Worker const char *szFileName, 244*86ee64e7SAndroid Build Coastguard Worker int iCaseSensitivity); 245*86ee64e7SAndroid Build Coastguard Worker /* 246*86ee64e7SAndroid Build Coastguard Worker Try locate the file szFileName in the zipfile. 247*86ee64e7SAndroid Build Coastguard Worker For the iCaseSensitivity signification, see unzStringFileNameCompare 248*86ee64e7SAndroid Build Coastguard Worker 249*86ee64e7SAndroid Build Coastguard Worker return value : 250*86ee64e7SAndroid Build Coastguard Worker UNZ_OK if the file is found. It becomes the current file. 251*86ee64e7SAndroid Build Coastguard Worker UNZ_END_OF_LIST_OF_FILE if the file is not found 252*86ee64e7SAndroid Build Coastguard Worker */ 253*86ee64e7SAndroid Build Coastguard Worker 254*86ee64e7SAndroid Build Coastguard Worker 255*86ee64e7SAndroid Build Coastguard Worker /* ****************************************** */ 256*86ee64e7SAndroid Build Coastguard Worker /* Ryan supplied functions */ 257*86ee64e7SAndroid Build Coastguard Worker /* unz_file_info contain information about a file in the zipfile */ 258*86ee64e7SAndroid Build Coastguard Worker typedef struct unz_file_pos_s 259*86ee64e7SAndroid Build Coastguard Worker { 260*86ee64e7SAndroid Build Coastguard Worker uLong pos_in_zip_directory; /* offset in zip file directory */ 261*86ee64e7SAndroid Build Coastguard Worker uLong num_of_file; /* # of file */ 262*86ee64e7SAndroid Build Coastguard Worker } unz_file_pos; 263*86ee64e7SAndroid Build Coastguard Worker 264*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGetFilePos( 265*86ee64e7SAndroid Build Coastguard Worker unzFile file, 266*86ee64e7SAndroid Build Coastguard Worker unz_file_pos* file_pos); 267*86ee64e7SAndroid Build Coastguard Worker 268*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGoToFilePos( 269*86ee64e7SAndroid Build Coastguard Worker unzFile file, 270*86ee64e7SAndroid Build Coastguard Worker unz_file_pos* file_pos); 271*86ee64e7SAndroid Build Coastguard Worker 272*86ee64e7SAndroid Build Coastguard Worker typedef struct unz64_file_pos_s 273*86ee64e7SAndroid Build Coastguard Worker { 274*86ee64e7SAndroid Build Coastguard Worker ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ 275*86ee64e7SAndroid Build Coastguard Worker ZPOS64_T num_of_file; /* # of file */ 276*86ee64e7SAndroid Build Coastguard Worker } unz64_file_pos; 277*86ee64e7SAndroid Build Coastguard Worker 278*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGetFilePos64( 279*86ee64e7SAndroid Build Coastguard Worker unzFile file, 280*86ee64e7SAndroid Build Coastguard Worker unz64_file_pos* file_pos); 281*86ee64e7SAndroid Build Coastguard Worker 282*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGoToFilePos64( 283*86ee64e7SAndroid Build Coastguard Worker unzFile file, 284*86ee64e7SAndroid Build Coastguard Worker const unz64_file_pos* file_pos); 285*86ee64e7SAndroid Build Coastguard Worker 286*86ee64e7SAndroid Build Coastguard Worker /* ****************************************** */ 287*86ee64e7SAndroid Build Coastguard Worker 288*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file, 289*86ee64e7SAndroid Build Coastguard Worker unz_file_info64 *pfile_info, 290*86ee64e7SAndroid Build Coastguard Worker char *szFileName, 291*86ee64e7SAndroid Build Coastguard Worker uLong fileNameBufferSize, 292*86ee64e7SAndroid Build Coastguard Worker void *extraField, 293*86ee64e7SAndroid Build Coastguard Worker uLong extraFieldBufferSize, 294*86ee64e7SAndroid Build Coastguard Worker char *szComment, 295*86ee64e7SAndroid Build Coastguard Worker uLong commentBufferSize); 296*86ee64e7SAndroid Build Coastguard Worker 297*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, 298*86ee64e7SAndroid Build Coastguard Worker unz_file_info *pfile_info, 299*86ee64e7SAndroid Build Coastguard Worker char *szFileName, 300*86ee64e7SAndroid Build Coastguard Worker uLong fileNameBufferSize, 301*86ee64e7SAndroid Build Coastguard Worker void *extraField, 302*86ee64e7SAndroid Build Coastguard Worker uLong extraFieldBufferSize, 303*86ee64e7SAndroid Build Coastguard Worker char *szComment, 304*86ee64e7SAndroid Build Coastguard Worker uLong commentBufferSize); 305*86ee64e7SAndroid Build Coastguard Worker /* 306*86ee64e7SAndroid Build Coastguard Worker Get Info about the current file 307*86ee64e7SAndroid Build Coastguard Worker if pfile_info!=NULL, the *pfile_info structure will contain some info about 308*86ee64e7SAndroid Build Coastguard Worker the current file 309*86ee64e7SAndroid Build Coastguard Worker if szFileName!=NULL, the filemane string will be copied in szFileName 310*86ee64e7SAndroid Build Coastguard Worker (fileNameBufferSize is the size of the buffer) 311*86ee64e7SAndroid Build Coastguard Worker if extraField!=NULL, the extra field information will be copied in extraField 312*86ee64e7SAndroid Build Coastguard Worker (extraFieldBufferSize is the size of the buffer). 313*86ee64e7SAndroid Build Coastguard Worker This is the Central-header version of the extra field 314*86ee64e7SAndroid Build Coastguard Worker if szComment!=NULL, the comment string of the file will be copied in szComment 315*86ee64e7SAndroid Build Coastguard Worker (commentBufferSize is the size of the buffer) 316*86ee64e7SAndroid Build Coastguard Worker */ 317*86ee64e7SAndroid Build Coastguard Worker 318*86ee64e7SAndroid Build Coastguard Worker 319*86ee64e7SAndroid Build Coastguard Worker /** Addition for GDAL : START */ 320*86ee64e7SAndroid Build Coastguard Worker 321*86ee64e7SAndroid Build Coastguard Worker extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file); 322*86ee64e7SAndroid Build Coastguard Worker 323*86ee64e7SAndroid Build Coastguard Worker /** Addition for GDAL : END */ 324*86ee64e7SAndroid Build Coastguard Worker 325*86ee64e7SAndroid Build Coastguard Worker 326*86ee64e7SAndroid Build Coastguard Worker /***************************************************************************/ 327*86ee64e7SAndroid Build Coastguard Worker /* for reading the content of the current zipfile, you can open it, read data 328*86ee64e7SAndroid Build Coastguard Worker from it, and close it (you can close it before reading all the file) 329*86ee64e7SAndroid Build Coastguard Worker */ 330*86ee64e7SAndroid Build Coastguard Worker 331*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzOpenCurrentFile(unzFile file); 332*86ee64e7SAndroid Build Coastguard Worker /* 333*86ee64e7SAndroid Build Coastguard Worker Open for reading data the current file in the zipfile. 334*86ee64e7SAndroid Build Coastguard Worker If there is no error, the return value is UNZ_OK. 335*86ee64e7SAndroid Build Coastguard Worker */ 336*86ee64e7SAndroid Build Coastguard Worker 337*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, 338*86ee64e7SAndroid Build Coastguard Worker const char* password); 339*86ee64e7SAndroid Build Coastguard Worker /* 340*86ee64e7SAndroid Build Coastguard Worker Open for reading data the current file in the zipfile. 341*86ee64e7SAndroid Build Coastguard Worker password is a crypting password 342*86ee64e7SAndroid Build Coastguard Worker If there is no error, the return value is UNZ_OK. 343*86ee64e7SAndroid Build Coastguard Worker */ 344*86ee64e7SAndroid Build Coastguard Worker 345*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzOpenCurrentFile2(unzFile file, 346*86ee64e7SAndroid Build Coastguard Worker int* method, 347*86ee64e7SAndroid Build Coastguard Worker int* level, 348*86ee64e7SAndroid Build Coastguard Worker int raw); 349*86ee64e7SAndroid Build Coastguard Worker /* 350*86ee64e7SAndroid Build Coastguard Worker Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 351*86ee64e7SAndroid Build Coastguard Worker if raw==1 352*86ee64e7SAndroid Build Coastguard Worker *method will receive method of compression, *level will receive level of 353*86ee64e7SAndroid Build Coastguard Worker compression 354*86ee64e7SAndroid Build Coastguard Worker note : you can set level parameter as NULL (if you did not want known level, 355*86ee64e7SAndroid Build Coastguard Worker but you CANNOT set method parameter as NULL 356*86ee64e7SAndroid Build Coastguard Worker */ 357*86ee64e7SAndroid Build Coastguard Worker 358*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzOpenCurrentFile3(unzFile file, 359*86ee64e7SAndroid Build Coastguard Worker int* method, 360*86ee64e7SAndroid Build Coastguard Worker int* level, 361*86ee64e7SAndroid Build Coastguard Worker int raw, 362*86ee64e7SAndroid Build Coastguard Worker const char* password); 363*86ee64e7SAndroid Build Coastguard Worker /* 364*86ee64e7SAndroid Build Coastguard Worker Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 365*86ee64e7SAndroid Build Coastguard Worker if raw==1 366*86ee64e7SAndroid Build Coastguard Worker *method will receive method of compression, *level will receive level of 367*86ee64e7SAndroid Build Coastguard Worker compression 368*86ee64e7SAndroid Build Coastguard Worker note : you can set level parameter as NULL (if you did not want known level, 369*86ee64e7SAndroid Build Coastguard Worker but you CANNOT set method parameter as NULL 370*86ee64e7SAndroid Build Coastguard Worker */ 371*86ee64e7SAndroid Build Coastguard Worker 372*86ee64e7SAndroid Build Coastguard Worker 373*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzCloseCurrentFile(unzFile file); 374*86ee64e7SAndroid Build Coastguard Worker /* 375*86ee64e7SAndroid Build Coastguard Worker Close the file in zip opened with unzOpenCurrentFile 376*86ee64e7SAndroid Build Coastguard Worker Return UNZ_CRCERROR if all the file was read but the CRC is not good 377*86ee64e7SAndroid Build Coastguard Worker */ 378*86ee64e7SAndroid Build Coastguard Worker 379*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzReadCurrentFile(unzFile file, 380*86ee64e7SAndroid Build Coastguard Worker voidp buf, 381*86ee64e7SAndroid Build Coastguard Worker unsigned len); 382*86ee64e7SAndroid Build Coastguard Worker /* 383*86ee64e7SAndroid Build Coastguard Worker Read bytes from the current file (opened by unzOpenCurrentFile) 384*86ee64e7SAndroid Build Coastguard Worker buf contain buffer where data must be copied 385*86ee64e7SAndroid Build Coastguard Worker len the size of buf. 386*86ee64e7SAndroid Build Coastguard Worker 387*86ee64e7SAndroid Build Coastguard Worker return the number of byte copied if some bytes are copied 388*86ee64e7SAndroid Build Coastguard Worker return 0 if the end of file was reached 389*86ee64e7SAndroid Build Coastguard Worker return <0 with error code if there is an error 390*86ee64e7SAndroid Build Coastguard Worker (UNZ_ERRNO for IO error, or zLib error for uncompress error) 391*86ee64e7SAndroid Build Coastguard Worker */ 392*86ee64e7SAndroid Build Coastguard Worker 393*86ee64e7SAndroid Build Coastguard Worker extern z_off_t ZEXPORT unztell(unzFile file); 394*86ee64e7SAndroid Build Coastguard Worker 395*86ee64e7SAndroid Build Coastguard Worker extern ZPOS64_T ZEXPORT unztell64(unzFile file); 396*86ee64e7SAndroid Build Coastguard Worker /* 397*86ee64e7SAndroid Build Coastguard Worker Give the current position in uncompressed data 398*86ee64e7SAndroid Build Coastguard Worker */ 399*86ee64e7SAndroid Build Coastguard Worker 400*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzeof(unzFile file); 401*86ee64e7SAndroid Build Coastguard Worker /* 402*86ee64e7SAndroid Build Coastguard Worker return 1 if the end of file was reached, 0 elsewhere 403*86ee64e7SAndroid Build Coastguard Worker */ 404*86ee64e7SAndroid Build Coastguard Worker 405*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzGetLocalExtrafield(unzFile file, 406*86ee64e7SAndroid Build Coastguard Worker voidp buf, 407*86ee64e7SAndroid Build Coastguard Worker unsigned len); 408*86ee64e7SAndroid Build Coastguard Worker /* 409*86ee64e7SAndroid Build Coastguard Worker Read extra field from the current file (opened by unzOpenCurrentFile) 410*86ee64e7SAndroid Build Coastguard Worker This is the local-header version of the extra field (sometimes, there is 411*86ee64e7SAndroid Build Coastguard Worker more info in the local-header version than in the central-header) 412*86ee64e7SAndroid Build Coastguard Worker 413*86ee64e7SAndroid Build Coastguard Worker if buf==NULL, it return the size of the local extra field 414*86ee64e7SAndroid Build Coastguard Worker 415*86ee64e7SAndroid Build Coastguard Worker if buf!=NULL, len is the size of the buffer, the extra header is copied in 416*86ee64e7SAndroid Build Coastguard Worker buf. 417*86ee64e7SAndroid Build Coastguard Worker the return value is the number of bytes copied in buf, or (if <0) 418*86ee64e7SAndroid Build Coastguard Worker the error code 419*86ee64e7SAndroid Build Coastguard Worker */ 420*86ee64e7SAndroid Build Coastguard Worker 421*86ee64e7SAndroid Build Coastguard Worker /***************************************************************************/ 422*86ee64e7SAndroid Build Coastguard Worker 423*86ee64e7SAndroid Build Coastguard Worker /* Get the current file offset */ 424*86ee64e7SAndroid Build Coastguard Worker extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file); 425*86ee64e7SAndroid Build Coastguard Worker extern uLong ZEXPORT unzGetOffset (unzFile file); 426*86ee64e7SAndroid Build Coastguard Worker 427*86ee64e7SAndroid Build Coastguard Worker /* Set the current file offset */ 428*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); 429*86ee64e7SAndroid Build Coastguard Worker extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); 430*86ee64e7SAndroid Build Coastguard Worker 431*86ee64e7SAndroid Build Coastguard Worker 432*86ee64e7SAndroid Build Coastguard Worker 433*86ee64e7SAndroid Build Coastguard Worker #ifdef __cplusplus 434*86ee64e7SAndroid Build Coastguard Worker } 435*86ee64e7SAndroid Build Coastguard Worker #endif 436*86ee64e7SAndroid Build Coastguard Worker 437*86ee64e7SAndroid Build Coastguard Worker #endif /* _unz64_H */ 438