ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
unzip.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "unzip.h"
#include <errno.h>
#include "crypt.h"
Include dependency graph for unzip.c:

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 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 uLongf z_crc_t
 
typedef struct unz_file_info64_internal_s unz_file_info64_internal
 

Functions

static int unz64local_getByte _Z_OF ((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi))
 
static int unz64local_getByte (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
 
static int unz64local_getShort _Z_OF ((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX))
 
static int unz64local_getShort (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
 
static int unz64local_getLong (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
 
static int unz64local_getLong64 _Z_OF ((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX))
 
static int unz64local_getLong64 (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
 
static int strcmpcasenosensitive_internal (const char *fileName1, const char *fileName2)
 
int ZEXPORT unzStringFileNameCompare (const char *fileName1, const char *fileName2, int iCaseSensitivity)
 
static ZPOS64_T unz64local_SearchCentralDir _Z_OF ((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream))
 
static ZPOS64_T unz64local_SearchCentralDir (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
 
static ZPOS64_T unz64local_SearchCentralDir64 (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
 
unzFile ZEXPORT unzOpen2 (voidpf file, zlib_filefunc_def *pzlib_filefunc32_def)
 
unzFile ZEXPORT unzOpen2_64 (voidpf file, zlib_filefunc64_def *pzlib_filefunc_def)
 
unzFile ZEXPORT unzOpen (voidpf file)
 
unzFile ZEXPORT unzOpen64 (voidpf file)
 
int ZEXPORT unzClose (unzFile file)
 
int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64 *pglobal_info)
 
int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info *pglobal_info32)
 
static void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz *ptm)
 
static int unz64local_GetCurrentFileInfoInternal _Z_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))
 
int ZEXPORT unzGetCurrentFileInfo64 (unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
 
int ZEXPORT unzGetCurrentFileInfo (unzFile file, unz_file_info *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
 
int ZEXPORT unzGoToFirstFile (unzFile file)
 
int ZEXPORT unzGoToNextFile (unzFile file)
 
int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
 
int ZEXPORT unzGetFilePos64 (unzFile file, unz64_file_pos *file_pos)
 
int ZEXPORT unzGetFilePos (unzFile file, unz_file_pos *file_pos)
 
int ZEXPORT unzGoToFilePos64 (unzFile file, const unz64_file_pos *file_pos)
 
int ZEXPORT unzGoToFilePos (unzFile file, unz_file_pos *file_pos)
 
static int unz64local_CheckCurrentFileCoherencyHeader (unz64_s *s, uInt *piSizeVar, ZPOS64_T *poffset_local_extrafield, uInt *psize_local_extrafield)
 
int ZEXPORT unzOpenCurrentFile3 (unzFile file, int *method, int *level, int raw, const char *password)
 
int ZEXPORT unzOpenCurrentFile (unzFile file)
 
int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char *password)
 
int ZEXPORT unzOpenCurrentFile2 (unzFile file, int *method, int *level, int raw)
 
ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 (unzFile file)
 
int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
 
z_off_t ZEXPORT unztell (unzFile file)
 
ZPOS64_T ZEXPORT unztell64 (unzFile file)
 
int ZEXPORT unzeof (unzFile file)
 
int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
 
int ZEXPORT unzCloseCurrentFile (unzFile file)
 
int ZEXPORT unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf)
 
ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file)
 
uLong ZEXPORT unzGetOffset (unzFile file)
 
int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos)
 
int ZEXPORT unzSetOffset (unzFile file, uLong pos)
 
int ZEXPORT unzSetFlags (unzFile file, unsigned flags)
 
int ZEXPORT unzClearFlags (unzFile file, unsigned flags)
 

Variables

const char unz_copyright []
 

Macro Definition Documentation

◆ ALLOC

#define ALLOC (   size)    (malloc(size))

Definition at line 114 of file unzip.c.

◆ BUFREADCOMMENT

#define BUFREADCOMMENT   (0x400)

Definition at line 408 of file unzip.c.

◆ CASESENSITIVITYDEFAULT_NO

#define CASESENSITIVITYDEFAULT_NO

Definition at line 100 of file unzip.c.

◆ CASESENSITIVITYDEFAULTVALUE

#define CASESENSITIVITYDEFAULTVALUE   2

Definition at line 375 of file unzip.c.

◆ local

#define local   static

Definition at line 93 of file unzip.c.

◆ SIZECENTRALDIRITEM

#define SIZECENTRALDIRITEM   (0x2e)

Definition at line 120 of file unzip.c.

◆ SIZEZIPLOCALHEADER

#define SIZEZIPLOCALHEADER   (0x1e)

Definition at line 121 of file unzip.c.

◆ STRCMPCASENOSENTIVEFUNCTION

#define STRCMPCASENOSENTIVEFUNCTION   strcmpcasenosensitive_internal

Definition at line 381 of file unzip.c.

◆ TRYFREE

#define TRYFREE (   p)    {if (p) free(p);}

Definition at line 117 of file unzip.c.

◆ UNZ_BUFSIZE

#define UNZ_BUFSIZE   (16384)

Definition at line 106 of file unzip.c.

◆ UNZ_MAXFILENAMEINZIP

#define UNZ_MAXFILENAMEINZIP   (256)

Definition at line 110 of file unzip.c.

Typedef Documentation

◆ unz_file_info64_internal

◆ z_crc_t

typedef uLongf z_crc_t

Definition at line 76 of file unzip.c.

Function Documentation

◆ _Z_OF() [1/5]

static ZPOS64_T unz64local_SearchCentralDir _Z_OF ( (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)  )
static

◆ _Z_OF() [2/5]

static int unz64local_getByte _Z_OF ( (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)  )
static

◆ _Z_OF() [3/5]

static int unz64local_getShort _Z_OF ( (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)  )
static

◆ _Z_OF() [4/5]

static int unz64local_getLong64 _Z_OF ( (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)  )
static

◆ _Z_OF() [5/5]

static int unz64local_GetCurrentFileInfoInternal _Z_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)  )
static

◆ strcmpcasenosensitive_internal()

static int strcmpcasenosensitive_internal ( const char *  fileName1,
const char *  fileName2 
)
static

Definition at line 352 of file unzip.c.

◆ unz64local_CheckCurrentFileCoherencyHeader()

◆ unz64local_DosDateToTmuDate()

static void unz64local_DosDateToTmuDate ( ZPOS64_T  ulDosDate,
tm_unz ptm 
)
static

◆ unz64local_getByte()

static int unz64local_getByte ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream,
int *  pi 
)
static

Definition at line 215 of file unzip.c.

References UNZ_EOF, UNZ_ERRNO, UNZ_OK, ZERROR64, and ZREAD64.

Referenced by unz64local_getLong(), unz64local_getLong64(), and unz64local_getShort().

◆ unz64local_getLong()

static int unz64local_getLong ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream,
uLong *  pX 
)
static

◆ unz64local_getLong64()

static int unz64local_getLong64 ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream,
ZPOS64_T pX 
)
static

Definition at line 305 of file unzip.c.

References unz64local_getByte(), and UNZ_OK.

Referenced by unz64local_SearchCentralDir64().

◆ unz64local_getShort()

static int unz64local_getShort ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream,
uLong *  pX 
)
static

Definition at line 242 of file unzip.c.

References unz64local_getByte(), and UNZ_OK.

Referenced by unz64local_CheckCurrentFileCoherencyHeader().

◆ unz64local_SearchCentralDir()

static ZPOS64_T unz64local_SearchCentralDir ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream 
)
static

◆ unz64local_SearchCentralDir64()

static ZPOS64_T unz64local_SearchCentralDir64 ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream 
)
static

◆ unzClearFlags()

int ZEXPORT unzClearFlags ( unzFile  file,
unsigned  flags 
)

Definition at line 2139 of file unzip.c.

References unz64_s::flags, NULL, UNZ_OK, and UNZ_PARAMERROR.

◆ unzClose()

◆ unzCloseCurrentFile()

◆ unzeof()

int ZEXPORT unzeof ( unzFile  file)

◆ unzGetCurrentFileInfo()

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 1146 of file unzip.c.

◆ unzGetCurrentFileInfo64()

int ZEXPORT unzGetCurrentFileInfo64 ( unzFile  file,
unz_file_info64 pfile_info,
char *  szFileName,
uLong  fileNameBufferSize,
void *  extraField,
uLong  extraFieldBufferSize,
char *  szComment,
uLong  commentBufferSize 
)

◆ unzGetCurrentFileZStreamPos64()

ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 ( unzFile  file)

◆ unzGetFilePos()

◆ unzGetFilePos64()

◆ unzGetGlobalComment()

int ZEXPORT unzGetGlobalComment ( unzFile  file,
char *  szComment,
uLong  uSizeBuf 
)

◆ unzGetGlobalInfo()

◆ unzGetGlobalInfo64()

int ZEXPORT unzGetGlobalInfo64 ( unzFile  file,
unz_global_info64 pglobal_info 
)

◆ unzGetLocalExtrafield()

◆ unzGetOffset()

uLong ZEXPORT unzGetOffset ( unzFile  file)

Definition at line 2094 of file unzip.c.

References NULL, and unzGetOffset64().

◆ unzGetOffset64()

ZPOS64_T ZEXPORT unzGetOffset64 ( unzFile  file)

◆ unzGoToFilePos()

◆ unzGoToFilePos64()

int ZEXPORT unzGoToFilePos64 ( unzFile  file,
const unz64_file_pos file_pos 
)

◆ unzGoToFirstFile()

int ZEXPORT unzGoToFirstFile ( unzFile  file)

◆ unzGoToNextFile()

◆ unzLocateFile()

◆ unzOpen()

unzFile ZEXPORT unzOpen ( voidpf  file)

Definition at line 800 of file unzip.c.

◆ unzOpen2()

unzFile ZEXPORT unzOpen2 ( voidpf  file,
zlib_filefunc_def pzlib_filefunc32_def 
)

Definition at line 772 of file unzip.c.

References fill_zlib_filefunc64_32_def_from_filefunc32(), and NULL.

◆ unzOpen2_64()

unzFile ZEXPORT unzOpen2_64 ( voidpf  file,
zlib_filefunc64_def pzlib_filefunc_def 
)

◆ unzOpen64()

unzFile ZEXPORT unzOpen64 ( voidpf  file)

Definition at line 805 of file unzip.c.

Referenced by cloudViewer::utility::ExtractFromZIP().

◆ unzOpenCurrentFile()

int ZEXPORT unzOpenCurrentFile ( unzFile  file)

Definition at line 1649 of file unzip.c.

References NULL, and unzOpenCurrentFile3().

◆ unzOpenCurrentFile2()

int ZEXPORT unzOpenCurrentFile2 ( unzFile  file,
int *  method,
int *  level,
int  raw 
)

Definition at line 1659 of file unzip.c.

References NULL, and unzOpenCurrentFile3().

◆ unzOpenCurrentFile3()

int ZEXPORT unzOpenCurrentFile3 ( unzFile  file,
int *  method,
int *  level,
int  raw,
const char *  password 
)

Definition at line 1480 of file unzip.c.

References ALLOC, file_in_zip64_read_info_s::byte_before_the_zipfile, unz64_s::byte_before_the_zipfile, unz_file_info64_s::compressed_size, file_in_zip64_read_info_s::compression_method, unz_file_info64_s::compression_method, unz_file_info64_s::crc, file_in_zip64_read_info_s::crc32, file_in_zip64_read_info_s::crc32_wait, unz64_s::cur_file_info, unz64_s::cur_file_info_internal, unz64_s::current_file_ok, unz64_s::encrypted, file_in_zip64_read_info_s::filestream, unz64_s::filestream, unz_file_info64_s::flag, init_keys(), unz64_s::keys, NULL, unz_file_info64_internal_s::offset_curfile, file_in_zip64_read_info_s::offset_local_extrafield, unz64_s::pcrc_32_tab, unz64_s::pfile_in_zip_read, 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, SEEK_SET, file_in_zip64_read_info_s::size_local_extrafield, SIZEZIPLOCALHEADER, file_in_zip64_read_info_s::stream, file_in_zip64_read_info_s::stream_initialised, file_in_zip64_read_info_s::total_out_64, TRYFREE, unz_file_info64_s::uncompressed_size, unz64local_CheckCurrentFileCoherencyHeader(), UNZ_BADZIPFILE, UNZ_BUFSIZE, UNZ_INTERNALERROR, UNZ_OK, UNZ_PARAMERROR, unzCloseCurrentFile(), Z_BZIP2ED, file_in_zip64_read_info_s::z_filefunc, unz64_s::z_filefunc, zdecode, ZREAD64, and ZSEEK64.

Referenced by QuaZipFile::open(), unzOpenCurrentFile(), unzOpenCurrentFile2(), and unzOpenCurrentFilePassword().

◆ unzOpenCurrentFilePassword()

int ZEXPORT unzOpenCurrentFilePassword ( unzFile  file,
const char *  password 
)

Definition at line 1654 of file unzip.c.

References NULL, and unzOpenCurrentFile3().

Referenced by cloudViewer::utility::ExtractCurrentFile().

◆ unzReadCurrentFile()

◆ unzSetFlags()

int ZEXPORT unzSetFlags ( unzFile  file,
unsigned  flags 
)

Definition at line 2128 of file unzip.c.

References unz64_s::flags, NULL, UNZ_OK, and UNZ_PARAMERROR.

◆ unzSetOffset()

int ZEXPORT unzSetOffset ( unzFile  file,
uLong  pos 
)

Definition at line 2122 of file unzip.c.

References unzSetOffset64().

◆ unzSetOffset64()

int ZEXPORT unzSetOffset64 ( unzFile  file,
ZPOS64_T  pos 
)

◆ unzStringFileNameCompare()

int ZEXPORT unzStringFileNameCompare ( const char *  fileName1,
const char *  fileName2,
int  iCaseSensitivity 
)

Definition at line 393 of file unzip.c.

References CASESENSITIVITYDEFAULTVALUE, and STRCMPCASENOSENTIVEFUNCTION.

Referenced by unzLocateFile().

◆ unztell()

z_off_t ZEXPORT unztell ( unzFile  file)

◆ unztell64()

ZPOS64_T ZEXPORT unztell64 ( unzFile  file)

Definition at line 1904 of file unzip.c.

References NULL, unz64_s::pfile_in_zip_read, and file_in_zip64_read_info_s::total_out_64.

Referenced by QuaZipFile::pos().

Variable Documentation

◆ unz_copyright

const char unz_copyright[]
Initial value:
=
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"

Definition at line 124 of file unzip.c.