Rizin
unix-like reverse engineering framework and cli tools
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "unzip.h"
#include <errno.h>
Go to the source code of this file.
Classes | |
struct | unz_file_info64_internal_s |
struct | file_in_zip64_read_info_s |
struct | unz64_s |
Macros | |
#define | NOUNCRYPT |
#define | local static |
#define | CASESENSITIVITYDEFAULT_NO |
#define | UNZ_BUFSIZE (16384) |
#define | UNZ_MAXFILENAMEINZIP (256) |
#define | ALLOC(size) (malloc(size)) |
#define | TRYFREE(p) {if (p) free(p);} |
#define | SIZECENTRALDIRITEM (0x2e) |
#define | SIZEZIPLOCALHEADER (0x1e) |
#define | CASESENSITIVITYDEFAULTVALUE 2 |
#define | STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal |
#define | BUFREADCOMMENT (0x400) |
Typedefs | |
typedef struct unz_file_info64_internal_s | unz_file_info64_internal |
Variables | |
const char | unz_copyright [] |
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal |
typedef struct unz_file_info64_internal_s unz_file_info64_internal |
ZPOS64_T unz64local_SearchCentralDir OF | ( | (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream) | ) |
int unz64local_getByte OF | ( | (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi) | ) |
int unz64local_getShort OF | ( | (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX) | ) |
int unz64local_getLong64 OF | ( | (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) | ) |
int unz64local_GetCurrentFileInfoInternal OF | ( | (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) | ) |
Definition at line 349 of file unzip.c.
int unz64local_CheckCurrentFileCoherencyHeader | ( | unz64_s * | s, |
uInt * | piSizeVar, | ||
ZPOS64_T * | poffset_local_extrafield, | ||
uInt * | psize_local_extrafield | ||
) |
Definition at line 1385 of file unzip.c.
References err, s, SIZEZIPLOCALHEADER, unz64local_getLong(), unz64local_getShort(), UNZ_BADZIPFILE, UNZ_ERRNO, UNZ_OK, Z_BZIP2ED, Z_DEFLATED, ZLIB_FILEFUNC_SEEK_SET, and ZSEEK64.
Referenced by unzOpenCurrentFile3().
Definition at line 852 of file unzip.c.
References int, tm_unz_s::tm_hour, tm_unz_s::tm_mday, tm_unz_s::tm_min, tm_unz_s::tm_mon, tm_unz_s::tm_sec, and tm_unz_s::tm_year.
Referenced by unz64local_GetCurrentFileInfoInternal().
int unz64local_getByte | ( | const zlib_filefunc64_32_def * | pzlib_filefunc_def, |
voidpf | filestream, | ||
int * | pi | ||
) |
Definition at line 212 of file unzip.c.
References c, err, int, UNZ_EOF, UNZ_ERRNO, UNZ_OK, ZERROR64, and ZREAD64.
Referenced by unz64local_getLong(), unz64local_getLong64(), and unz64local_getShort().
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 | ||
) |
Definition at line 879 of file unzip.c.
References unz_file_info64_s::compressed_size, unz_file_info64_s::compression_method, unz_file_info64_s::crc, unz_file_info64_s::disk_num_start, unz_file_info64_s::dosDate, err, unz_file_info64_s::external_fa, unz_file_info64_s::flag, unz_file_info64_s::internal_fa, MAXU32, NULL, unz_file_info64_internal_s::offset_curfile, s, unz_file_info64_s::size_file_comment, unz_file_info64_s::size_file_extra, unz_file_info64_s::size_filename, unz_file_info64_s::tmu_date, unz_file_info64_s::uncompressed_size, unz64local_DosDateToTmuDate(), unz64local_getLong(), unz64local_getLong64(), unz64local_getShort(), UNZ_BADZIPFILE, UNZ_ERRNO, UNZ_OK, UNZ_PARAMERROR, unz_file_info64_s::version, unz_file_info64_s::version_needed, ZLIB_FILEFUNC_SEEK_CUR, ZLIB_FILEFUNC_SEEK_SET, ZREAD64, and ZSEEK64.
Referenced by unzGetCurrentFileInfo(), unzGetCurrentFileInfo64(), unzGoToFilePos64(), unzGoToFirstFile(), unzGoToNextFile(), and unzSetOffset64().
int unz64local_getLong | ( | const zlib_filefunc64_32_def * | pzlib_filefunc_def, |
voidpf | filestream, | ||
uLong * | pX | ||
) |
Definition at line 266 of file unzip.c.
References err, i, unz64local_getByte(), UNZ_OK, and x.
Referenced by unz64local_CheckCurrentFileCoherencyHeader(), unz64local_GetCurrentFileInfoInternal(), unz64local_SearchCentralDir64(), and unzOpenInternal().
int unz64local_getLong64 | ( | const zlib_filefunc64_32_def * | pzlib_filefunc_def, |
voidpf | filestream, | ||
ZPOS64_T * | pX | ||
) |
Definition at line 302 of file unzip.c.
References err, i, unz64local_getByte(), UNZ_OK, and x.
Referenced by unz64local_GetCurrentFileInfoInternal(), unz64local_SearchCentralDir64(), and unzOpenInternal().
int unz64local_getShort | ( | const zlib_filefunc64_32_def * | pzlib_filefunc_def, |
voidpf | filestream, | ||
uLong * | pX | ||
) |
Definition at line 239 of file unzip.c.
References err, i, unz64local_getByte(), UNZ_OK, and x.
Referenced by unz64local_CheckCurrentFileCoherencyHeader(), unz64local_GetCurrentFileInfoInternal(), and unzOpenInternal().
ZPOS64_T unz64local_SearchCentralDir | ( | const zlib_filefunc64_32_def * | pzlib_filefunc_def, |
voidpf | filestream | ||
) |
Definition at line 413 of file unzip.c.
References ALLOC, BUFREADCOMMENT, i, NULL, TRYFREE, unsigned, ZLIB_FILEFUNC_SEEK_END, ZLIB_FILEFUNC_SEEK_SET, ZREAD64, ZSEEK64, and ZTELL64.
Referenced by unzOpenInternal().
ZPOS64_T unz64local_SearchCentralDir64 | ( | const zlib_filefunc64_32_def * | pzlib_filefunc_def, |
voidpf | filestream | ||
) |
Definition at line 478 of file unzip.c.
References ALLOC, BUFREADCOMMENT, i, NULL, TRYFREE, unsigned, unz64local_getLong(), unz64local_getLong64(), UNZ_OK, ZLIB_FILEFUNC_SEEK_END, ZLIB_FILEFUNC_SEEK_SET, ZREAD64, ZSEEK64, and ZTELL64.
Referenced by unzOpenInternal().
Definition at line 808 of file unzip.c.
References NULL, s, TRYFREE, UNZ_OK, UNZ_PARAMERROR, unzCloseCurrentFile(), and ZCLOSE64.
Referenced by main().
Definition at line 2007 of file unzip.c.
References file_in_zip64_read_info_s::crc32, file_in_zip64_read_info_s::crc32_wait, err, inflateEnd(), NULL, file_in_zip64_read_info_s::raw, file_in_zip64_read_info_s::read_buffer, file_in_zip64_read_info_s::rest_read_uncompressed, s, file_in_zip64_read_info_s::stream, file_in_zip64_read_info_s::stream_initialised, TRYFREE, UNZ_CRCERROR, UNZ_OK, UNZ_PARAMERROR, Z_BZIP2ED, and Z_DEFLATED.
Referenced by do_extract_currentfile(), unzClose(), and unzOpenCurrentFile3().
Definition at line 1927 of file unzip.c.
References NULL, file_in_zip64_read_info_s::rest_read_uncompressed, s, and UNZ_PARAMERROR.
int ZEXPORT unzGetCurrentFileInfo | ( | unzFile | file, |
unz_file_info * | pfile_info, | ||
char * | szFileName, | ||
uLong | fileNameBufferSize, | ||
void * | extraField, | ||
uLong | extraFieldBufferSize, | ||
char * | szComment, | ||
uLong | commentBufferSize | ||
) |
Definition at line 1136 of file unzip.c.
References unz_file_info64_s::compressed_size, unz_file_info_s::compressed_size, unz_file_info64_s::compression_method, unz_file_info_s::compression_method, unz_file_info64_s::crc, unz_file_info_s::crc, unz_file_info64_s::disk_num_start, unz_file_info_s::disk_num_start, unz_file_info64_s::dosDate, unz_file_info_s::dosDate, err, unz_file_info64_s::external_fa, unz_file_info_s::external_fa, unz_file_info64_s::flag, unz_file_info_s::flag, unz_file_info64_s::internal_fa, unz_file_info_s::internal_fa, NULL, unz_file_info64_s::size_file_comment, unz_file_info_s::size_file_comment, unz_file_info64_s::size_file_extra, unz_file_info_s::size_file_extra, unz_file_info64_s::size_filename, unz_file_info_s::size_filename, unz_file_info64_s::tmu_date, unz_file_info_s::tmu_date, unz_file_info64_s::uncompressed_size, unz_file_info_s::uncompressed_size, unz64local_GetCurrentFileInfoInternal(), UNZ_OK, unz_file_info64_s::version, unz_file_info_s::version, unz_file_info64_s::version_needed, and unz_file_info_s::version_needed.
int ZEXPORT unzGetCurrentFileInfo64 | ( | unzFile | file, |
unz_file_info64 * | pfile_info, | ||
char * | szFileName, | ||
uLong | fileNameBufferSize, | ||
void * | extraField, | ||
uLong | extraFieldBufferSize, | ||
char * | szComment, | ||
uLong | commentBufferSize | ||
) |
Definition at line 1124 of file unzip.c.
References NULL, and unz64local_GetCurrentFileInfoInternal().
Referenced by do_extract_currentfile(), do_list(), and unzLocateFile().
Addition for GDAL : START
Definition at line 1658 of file unzip.c.
References file_in_zip64_read_info_s::byte_before_the_zipfile, NULL, file_in_zip64_read_info_s::pos_in_zipfile, and s.
int ZEXPORT unzGetFilePos | ( | unzFile | file, |
unz_file_pos * | file_pos | ||
) |
Definition at line 1324 of file unzip.c.
References err, unz_file_pos_s::num_of_file, unz64_file_pos_s::num_of_file, unz_file_pos_s::pos_in_zip_directory, unz64_file_pos_s::pos_in_zip_directory, UNZ_OK, and unzGetFilePos64().
int ZEXPORT unzGetFilePos64 | ( | unzFile | file, |
unz64_file_pos * | file_pos | ||
) |
Definition at line 1308 of file unzip.c.
References NULL, unz64_file_pos_s::num_of_file, unz64_file_pos_s::pos_in_zip_directory, s, UNZ_END_OF_LIST_OF_FILE, UNZ_OK, and UNZ_PARAMERROR.
Referenced by unzGetFilePos().
Definition at line 2054 of file unzip.c.
References NULL, s, UNZ_ERRNO, UNZ_PARAMERROR, ZLIB_FILEFUNC_SEEK_SET, ZREAD64, and ZSEEK64.
int ZEXPORT unzGetGlobalInfo | ( | unzFile | file, |
unz_global_info * | pglobal_info32 | ||
) |
Definition at line 838 of file unzip.c.
References NULL, unz_global_info_s::number_entry, s, unz_global_info_s::size_comment, UNZ_OK, and UNZ_PARAMERROR.
int ZEXPORT unzGetGlobalInfo64 | ( | unzFile | file, |
unz_global_info64 * | pglobal_info | ||
) |
Definition at line 1959 of file unzip.c.
References file_in_zip64_read_info_s::filestream, len, NULL, file_in_zip64_read_info_s::offset_local_extrafield, file_in_zip64_read_info_s::pos_local_extrafield, s, file_in_zip64_read_info_s::size_local_extrafield, UNZ_ERRNO, UNZ_PARAMERROR, file_in_zip64_read_info_s::z_filefunc, ZLIB_FILEFUNC_SEEK_SET, ZREAD64, and ZSEEK64.
int ZEXPORT unzGoToFilePos | ( | unzFile | file, |
unz_file_pos * | file_pos | ||
) |
Definition at line 1360 of file unzip.c.
References NULL, unz_file_pos_s::num_of_file, unz64_file_pos_s::num_of_file, unz_file_pos_s::pos_in_zip_directory, unz64_file_pos_s::pos_in_zip_directory, UNZ_PARAMERROR, and unzGoToFilePos64().
int ZEXPORT unzGoToFilePos64 | ( | unzFile | file, |
const unz64_file_pos * | file_pos | ||
) |
Definition at line 1338 of file unzip.c.
References err, NULL, unz64_file_pos_s::num_of_file, unz64_file_pos_s::pos_in_zip_directory, s, unz64local_GetCurrentFileInfoInternal(), UNZ_OK, and UNZ_PARAMERROR.
Referenced by unzGoToFilePos().
Definition at line 1178 of file unzip.c.
References err, NULL, s, unz64local_GetCurrentFileInfoInternal(), UNZ_OK, and UNZ_PARAMERROR.
Referenced by unzLocateFile(), and unzOpenInternal().
Definition at line 1199 of file unzip.c.
References err, NULL, s, SIZECENTRALDIRITEM, unz64local_GetCurrentFileInfoInternal(), UNZ_END_OF_LIST_OF_FILE, UNZ_OK, and UNZ_PARAMERROR.
Referenced by do_extract(), do_list(), and unzLocateFile().
Definition at line 1232 of file unzip.c.
References err, NULL, s, UNZ_END_OF_LIST_OF_FILE, UNZ_MAXFILENAMEINZIP, UNZ_OK, UNZ_PARAMERROR, unzGetCurrentFileInfo64(), unzGoToFirstFile(), unzGoToNextFile(), and unzStringFileNameCompare().
Referenced by do_extract_onefile().
Definition at line 793 of file unzip.c.
References NULL, path, and unzOpenInternal().
unzFile ZEXPORT unzOpen2 | ( | const char * | path, |
zlib_filefunc_def * | pzlib_filefunc32_def | ||
) |
Definition at line 765 of file unzip.c.
References fill_zlib_filefunc64_32_def_from_filefunc32(), NULL, path, and unzOpenInternal().
unzFile ZEXPORT unzOpen2_64 | ( | const void * | path, |
zlib_filefunc64_def * | pzlib_filefunc_def | ||
) |
Definition at line 778 of file unzip.c.
References NULL, path, unzOpenInternal(), zlib_filefunc64_32_def_s::zfile_func64, zlib_filefunc64_32_def_s::zseek32_file, and zlib_filefunc64_32_def_s::ztell32_file.
Referenced by main().
Definition at line 1641 of file unzip.c.
References NULL, and unzOpenCurrentFile3().
Definition at line 1651 of file unzip.c.
References level, NULL, and unzOpenCurrentFile3().
int ZEXPORT unzOpenCurrentFile3 | ( | unzFile | file, |
int * | method, | ||
int * | level, | ||
int | raw, | ||
const char * | password | ||
) |
Definition at line 1472 of file unzip.c.
References ALLOC, z_stream_s::avail_in, file_in_zip64_read_info_s::byte_before_the_zipfile, file_in_zip64_read_info_s::compression_method, file_in_zip64_read_info_s::crc32, file_in_zip64_read_info_s::crc32_wait, err, file_in_zip64_read_info_s::filestream, get_crc_table(), i, if(), inflateInit2, init_keys(), int, level, MAX_WBITS, z_stream_s::next_in, NULL, file_in_zip64_read_info_s::offset_local_extrafield, z_stream_s::opaque, file_in_zip64_read_info_s::pos_in_zipfile, file_in_zip64_read_info_s::pos_local_extrafield, file_in_zip64_read_info_s::raw, file_in_zip64_read_info_s::read_buffer, file_in_zip64_read_info_s::rest_read_compressed, file_in_zip64_read_info_s::rest_read_uncompressed, s, SEEK_SET, file_in_zip64_read_info_s::size_local_extrafield, SIZEZIPLOCALHEADER, source, file_in_zip64_read_info_s::stream, file_in_zip64_read_info_s::stream_initialised, z_stream_s::total_out, file_in_zip64_read_info_s::total_out_64, TRYFREE, unz64local_CheckCurrentFileCoherencyHeader(), UNZ_BADZIPFILE, UNZ_BUFSIZE, UNZ_INTERNALERROR, UNZ_OK, UNZ_PARAMERROR, unzCloseCurrentFile(), Z_BZIP2ED, Z_DEFLATED, file_in_zip64_read_info_s::z_filefunc, Z_OK, z_stream_s::zalloc, zdecode, z_stream_s::zfree, ZREAD64, and ZSEEK64.
Referenced by unzOpenCurrentFile(), unzOpenCurrentFile2(), and unzOpenCurrentFilePassword().
Definition at line 1646 of file unzip.c.
References NULL, and unzOpenCurrentFile3().
Referenced by do_extract_currentfile().
unzFile unzOpenInternal | ( | const void * | path, |
zlib_filefunc64_32_def * | pzlib_filefunc64_32_def, | ||
int | is64bitOpenFunction | ||
) |
Definition at line 584 of file unzip.c.
References ALLOC, unz64_s::byte_before_the_zipfile, unz64_s::central_pos, unz64_s::encrypted, err, unz64_s::filestream, fill_fopen64_filefunc(), unz64_s::gi, unz64_s::is64bitOpenFunction, unz64_s::isZip64, NULL, unz_global_info64_s::number_entry, unz64_s::offset_central_dir, path, unz64_s::pfile_in_zip_read, s, unz64_s::size_central_dir, unz_global_info64_s::size_comment, unz64local_getLong(), unz64local_getLong64(), unz64local_getShort(), unz64local_SearchCentralDir(), unz64local_SearchCentralDir64(), UNZ_BADZIPFILE, unz_copyright, UNZ_ERRNO, UNZ_OK, unzGoToFirstFile(), unz64_s::z_filefunc, ZCLOSE64, zlib_filefunc64_32_def_s::zfile_func64, ZLIB_FILEFUNC_MODE_EXISTING, ZLIB_FILEFUNC_MODE_READ, ZLIB_FILEFUNC_SEEK_SET, ZOPEN64, zlib_filefunc64_32_def_s::zseek32_file, ZSEEK64, and zlib_filefunc64_32_def_s::ztell32_file.
Referenced by unzOpen(), unzOpen2(), unzOpen2_64(), and unzOpen64().
Addition for GDAL : END
Definition at line 1684 of file unzip.c.
References z_stream_s::avail_in, z_stream_s::avail_out, file_in_zip64_read_info_s::byte_before_the_zipfile, file_in_zip64_read_info_s::compression_method, file_in_zip64_read_info_s::crc32, crc32(), err, file_in_zip64_read_info_s::filestream, i, if(), inflate(), int, len, z_stream_s::msg, z_stream_s::next_in, z_stream_s::next_out, NULL, file_in_zip64_read_info_s::pos_in_zipfile, file_in_zip64_read_info_s::raw, file_in_zip64_read_info_s::read_buffer, file_in_zip64_read_info_s::rest_read_compressed, file_in_zip64_read_info_s::rest_read_uncompressed, s, file_in_zip64_read_info_s::stream, z_stream_s::total_in, z_stream_s::total_out, file_in_zip64_read_info_s::total_out_64, UNZ_BUFSIZE, UNZ_END_OF_LIST_OF_FILE, UNZ_EOF, UNZ_ERRNO, UNZ_OK, UNZ_PARAMERROR, while(), Z_BZIP2ED, Z_DATA_ERROR, file_in_zip64_read_info_s::z_filefunc, Z_OK, Z_STREAM_END, Z_SYNC_FLUSH, zdecode, ZLIB_FILEFUNC_SEEK_SET, ZREAD64, and ZSEEK64.
Referenced by do_extract_currentfile().
Definition at line 2107 of file unzip.c.
References err, NULL, pos, s, unz64local_GetCurrentFileInfoInternal(), UNZ_OK, and UNZ_PARAMERROR.
Referenced by unzSetOffset().
int ZEXPORT unzStringFileNameCompare | ( | const char * | fileName1, |
const char * | fileName2, | ||
int | iCaseSensitivity | ||
) |
Definition at line 390 of file unzip.c.
References CASESENSITIVITYDEFAULTVALUE, and STRCMPCASENOSENTIVEFUNCTION.
Referenced by unzLocateFile().
Definition at line 1892 of file unzip.c.
References NULL, s, file_in_zip64_read_info_s::stream, z_stream_s::total_out, UNZ_PARAMERROR, and z_off_t.
Definition at line 1907 of file unzip.c.
References NULL, s, and file_in_zip64_read_info_s::total_out_64.
const char unz_copyright[] |
Definition at line 122 of file unzip.c.
Referenced by unzOpenInternal().