Rizin
unix-like reverse engineering framework and cli tools
unzip.h File Reference
#include "zlib.h"
#include "ioapi.h"

Go to the source code of this file.

Classes

struct  tm_unz_s
 
struct  unz_global_info64_s
 
struct  unz_global_info_s
 
struct  unz_file_info64_s
 
struct  unz_file_info_s
 
struct  unz_file_pos_s
 
struct  unz64_file_pos_s
 

Macros

#define Z_BZIP2ED   12
 
#define UNZ_OK   (0)
 
#define UNZ_END_OF_LIST_OF_FILE   (-100)
 
#define UNZ_ERRNO   (Z_ERRNO)
 
#define UNZ_EOF   (0)
 
#define UNZ_PARAMERROR   (-102)
 
#define UNZ_BADZIPFILE   (-103)
 
#define UNZ_INTERNALERROR   (-104)
 
#define UNZ_CRCERROR   (-105)
 

Typedefs

typedef voidp unzFile
 
typedef struct tm_unz_s tm_unz
 
typedef struct unz_global_info64_s unz_global_info64
 
typedef struct unz_global_info_s unz_global_info
 
typedef struct unz_file_info64_s unz_file_info64
 
typedef struct unz_file_info_s unz_file_info
 
typedef struct unz_file_pos_s unz_file_pos
 
typedef struct unz64_file_pos_s unz64_file_pos
 

Functions

int ZEXPORT unzStringFileNameCompare OF ((const char *fileName1, const char *fileName2, int iCaseSensitivity))
 
unzFile ZEXPORT unzOpen OF ((const char *path))
 
unzFile ZEXPORT unzOpen64 OF ((const void *path))
 
unzFile ZEXPORT unzOpen2 OF ((const char *path, zlib_filefunc_def *pzlib_filefunc_def))
 
unzFile ZEXPORT unzOpen2_64 OF ((const void *path, zlib_filefunc64_def *pzlib_filefunc_def))
 
int ZEXPORT unzClose OF ((unzFile file))
 
int ZEXPORT unzGetGlobalInfo OF ((unzFile file, unz_global_info *pglobal_info))
 
int ZEXPORT unzGetGlobalInfo64 OF ((unzFile file, unz_global_info64 *pglobal_info))
 
int ZEXPORT unzGetGlobalComment OF ((unzFile file, char *szComment, uLong uSizeBuf))
 
int ZEXPORT unzLocateFile OF ((unzFile file, const char *szFileName, int iCaseSensitivity))
 
int ZEXPORT unzGetFilePos (unzFile file, unz_file_pos *file_pos)
 
int ZEXPORT unzGoToFilePos (unzFile file, unz_file_pos *file_pos)
 
int ZEXPORT unzGetFilePos64 (unzFile file, unz64_file_pos *file_pos)
 
int ZEXPORT unzGoToFilePos64 (unzFile file, const unz64_file_pos *file_pos)
 
int ZEXPORT unzGetCurrentFileInfo64 OF ((unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize))
 
int ZEXPORT unzGetCurrentFileInfo OF ((unzFile file, unz_file_info *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize))
 
int ZEXPORT unzOpenCurrentFilePassword OF ((unzFile file, const char *password))
 
int ZEXPORT unzOpenCurrentFile2 OF ((unzFile file, int *method, int *level, int raw))
 
int ZEXPORT unzOpenCurrentFile3 OF ((unzFile file, int *method, int *level, int raw, const char *password))
 
int ZEXPORT unzReadCurrentFile OF ((unzFile file, voidp buf, unsigned len))
 
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)
 

Macro Definition Documentation

◆ UNZ_BADZIPFILE

#define UNZ_BADZIPFILE   (-103)

Definition at line 79 of file unzip.h.

◆ UNZ_CRCERROR

#define UNZ_CRCERROR   (-105)

Definition at line 81 of file unzip.h.

◆ UNZ_END_OF_LIST_OF_FILE

#define UNZ_END_OF_LIST_OF_FILE   (-100)

Definition at line 75 of file unzip.h.

◆ UNZ_EOF

#define UNZ_EOF   (0)

Definition at line 77 of file unzip.h.

◆ UNZ_ERRNO

#define UNZ_ERRNO   (Z_ERRNO)

Definition at line 76 of file unzip.h.

◆ UNZ_INTERNALERROR

#define UNZ_INTERNALERROR   (-104)

Definition at line 80 of file unzip.h.

◆ UNZ_OK

#define UNZ_OK   (0)

Definition at line 74 of file unzip.h.

◆ UNZ_PARAMERROR

#define UNZ_PARAMERROR   (-102)

Definition at line 78 of file unzip.h.

◆ Z_BZIP2ED

#define Z_BZIP2ED   12

Definition at line 62 of file unzip.h.

Typedef Documentation

◆ tm_unz

typedef struct tm_unz_s tm_unz

◆ unz64_file_pos

◆ unz_file_info

◆ unz_file_info64

◆ unz_file_pos

typedef struct unz_file_pos_s unz_file_pos

◆ unz_global_info

◆ unz_global_info64

◆ unzFile

typedef voidp unzFile

Definition at line 70 of file unzip.h.

Function Documentation

◆ OF() [1/16]

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

◆ OF() [2/16]

unzFile ZEXPORT unzOpen OF ( (const char *path )

◆ OF() [3/16]

unzFile ZEXPORT unzOpen2 OF ( (const char *path, zlib_filefunc_def *pzlib_filefunc_def)  )

◆ OF() [4/16]

unzFile ZEXPORT unzOpen64 OF ( (const void *path )

◆ OF() [5/16]

unzFile ZEXPORT unzOpen2_64 OF ( (const void *path, zlib_filefunc64_def *pzlib_filefunc_def)  )

◆ OF() [6/16]

Addition for GDAL : START

Addition for GDAL : END

◆ OF() [7/16]

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

◆ OF() [8/16]

◆ OF() [9/16]

int ZEXPORT unzLocateFile OF ( (unzFile file, const char *szFileName, int iCaseSensitivity)  )

◆ OF() [10/16]

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

◆ OF() [11/16]

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

◆ OF() [12/16]

int ZEXPORT unzGetCurrentFileInfo OF ( (unzFile file, unz_file_info *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)  )

◆ OF() [13/16]

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

◆ OF() [14/16]

◆ OF() [15/16]

◆ OF() [16/16]

◆ unzGetFilePos()

int ZEXPORT unzGetFilePos ( unzFile  file,
unz_file_pos file_pos 
)

Definition at line 1324 of file unzip.c.

1327 {
1328  unz64_file_pos file_pos64;
1329  int err = unzGetFilePos64(file,&file_pos64);
1330  if (err==UNZ_OK)
1331  {
1332  file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory;
1333  file_pos->num_of_file = (uLong)file_pos64.num_of_file;
1334  }
1335  return err;
1336 }
static bool err
Definition: armass.c:435
Definition: gzappend.c:170
ZPOS64_T num_of_file
Definition: unzip.h:275
ZPOS64_T pos_in_zip_directory
Definition: unzip.h:274
uLong num_of_file
Definition: unzip.h:261
uLong pos_in_zip_directory
Definition: unzip.h:260
int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos *file_pos)
Definition: unzip.c:1308
#define UNZ_OK
Definition: unzip.h:74
unsigned long uLong
Definition: zconf.h:394

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().

◆ unzGetFilePos64()

int ZEXPORT unzGetFilePos64 ( unzFile  file,
unz64_file_pos file_pos 
)

Definition at line 1308 of file unzip.c.

1309 {
1310  unz64_s* s;
1311 
1312  if (file==NULL || file_pos==NULL)
1313  return UNZ_PARAMERROR;
1314  s=(unz64_s*)file;
1315  if (!s->current_file_ok)
1316  return UNZ_END_OF_LIST_OF_FILE;
1317 
1318  file_pos->pos_in_zip_directory = s->pos_in_central_dir;
1319  file_pos->num_of_file = s->num_file;
1320 
1321  return UNZ_OK;
1322 }
#define NULL
Definition: cris-opc.c:27
static RzSocket * s
Definition: rtr.c:28
Definition: unzip.c:166
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
#define UNZ_PARAMERROR
Definition: unzip.h:78

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().

◆ unzGetOffset()

uLong ZEXPORT unzGetOffset ( unzFile  file)

Definition at line 2097 of file unzip.c.

2098 {
2099  ZPOS64_T offset64;
2100 
2101  if (file==NULL)
2102  return 0; //UNZ_PARAMERROR;
2103  offset64 = unzGetOffset64(file);
2104  return (uLong)offset64;
2105 }
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
Definition: unzip.c:2082

References NULL, and unzGetOffset64().

◆ unzGetOffset64()

ZPOS64_T ZEXPORT unzGetOffset64 ( unzFile  file)

Definition at line 2082 of file unzip.c.

2083 {
2084  unz64_s* s;
2085 
2086  if (file==NULL)
2087  return 0; //UNZ_PARAMERROR;
2088  s=(unz64_s*)file;
2089  if (!s->current_file_ok)
2090  return 0;
2091  if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
2092  if (s->num_file==s->gi.number_entry)
2093  return 0;
2094  return s->pos_in_central_dir;
2095 }

References NULL, and s.

Referenced by unzGetOffset().

◆ unzGoToFilePos()

int ZEXPORT unzGoToFilePos ( unzFile  file,
unz_file_pos file_pos 
)

Definition at line 1360 of file unzip.c.

1363 {
1364  unz64_file_pos file_pos64;
1365  if (file_pos == NULL)
1366  return UNZ_PARAMERROR;
1367 
1368  file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory;
1369  file_pos64.num_of_file = file_pos->num_of_file;
1370  return unzGoToFilePos64(file,&file_pos64);
1371 }
int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos *file_pos)
Definition: unzip.c:1338

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().

◆ unzGoToFilePos64()

int ZEXPORT unzGoToFilePos64 ( unzFile  file,
const unz64_file_pos file_pos 
)

Definition at line 1338 of file unzip.c.

1339 {
1340  unz64_s* s;
1341  int err;
1342 
1343  if (file==NULL || file_pos==NULL)
1344  return UNZ_PARAMERROR;
1345  s=(unz64_s*)file;
1346 
1347  /* jump to the right spot */
1348  s->pos_in_central_dir = file_pos->pos_in_zip_directory;
1349  s->num_file = file_pos->num_of_file;
1350 
1351  /* set the current file */
1352  err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
1353  &s->cur_file_info_internal,
1354  NULL,0,NULL,0,NULL,0);
1355  /* return results */
1356  s->current_file_ok = (err == UNZ_OK);
1357  return err;
1358 }
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: unzip.c:879

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().

◆ unzSetOffset()

int ZEXPORT unzSetOffset ( unzFile  file,
uLong  pos 
)

Definition at line 2125 of file unzip.c.

2126 {
2127  return unzSetOffset64(file,pos);
2128 }
int pos
Definition: main.c:11
int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
Definition: unzip.c:2107

References pos, and unzSetOffset64().

◆ unzSetOffset64()

int ZEXPORT unzSetOffset64 ( unzFile  file,
ZPOS64_T  pos 
)

Definition at line 2107 of file unzip.c.

2108 {
2109  unz64_s* s;
2110  int err;
2111 
2112  if (file==NULL)
2113  return UNZ_PARAMERROR;
2114  s=(unz64_s*)file;
2115 
2116  s->pos_in_central_dir = pos;
2117  s->num_file = s->gi.number_entry; /* hack */
2118  err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
2119  &s->cur_file_info_internal,
2120  NULL,0,NULL,0,NULL,0);
2121  s->current_file_ok = (err == UNZ_OK);
2122  return err;
2123 }

References err, NULL, pos, s, unz64local_GetCurrentFileInfoInternal(), UNZ_OK, and UNZ_PARAMERROR.

Referenced by unzSetOffset().