JubeatPlus 3.9.11
Loading...
Searching...
No Matches
unzip.h File Reference

IO for reading .zip files, the subset of minizip's unz* API that KUnzip drives. More...

#include "ioapi.h"
Include dependency graph for unzip.h:

Go to the source code of this file.

Classes

struct  tm_unz_s
 An entry's last-modified date and time, decoded from the DOS date field. More...
struct  unz_global_info64_s
 Archive-wide information taken from the end-of-central-directory record. More...
struct  unz_file_info64_s
 Per-entry information taken from the entry's central-directory header. More...

Macros

#define UNZ_OK   (0)
 The operation succeeded.
#define UNZ_END_OF_LIST_OF_FILE   (-100)
 The directory walk passed the last entry.
#define UNZ_ERRNO   (Z_ERRNO)
 An I/O callback failed.
#define UNZ_EOF   (0)
 The end of the current entry's data was reached.
#define UNZ_PARAMERROR   (-102)
 An argument was invalid.
#define UNZ_BADZIPFILE   (-103)
 The archive is not a valid .zip.
#define UNZ_INTERNALERROR   (-104)
 An internal allocation or state error occurred.
#define UNZ_CRCERROR   (-105)
 The decompressed data failed its CRC check.

Typedefs

typedef void * unzFile
 minizip's opaque unzip archive handle.
typedef unsigned long long ZPOS64_T
 minizip's 64-bit file-position type (zlib's ZPOS64_T).
typedef struct tm_unz_s tm_unz
 An entry's last-modified date and time, decoded from the DOS date field.
typedef struct unz_global_info64_s unz_global_info64
 Archive-wide information taken from the end-of-central-directory record.
typedef struct unz_file_info64_s unz_file_info64
 Per-entry information taken from the entry's central-directory header.

Functions

unzFile unzOpen (const char *path)
 Opens a .zip archive at a path using the default stdio I/O callbacks.
unzFile unzOpenInternal (voidpf file, zlib_filefunc_def *pzlib_filefunc_def)
 Opens a .zip archive using a caller-supplied I/O callback table.
int unzClose (unzFile file)
 Closes an archive opened with unzOpen or unzOpenInternal.
int unzGetGlobalInfo64 (unzFile file, unz_global_info64 *pglobal_info)
 Writes the archive-wide information into pglobal_info.
int unzGoToFirstFile (unzFile file)
 Makes the first entry the current entry.
int unzGoToNextFile (unzFile file)
 Makes the next entry the current entry.
int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
 Locates an entry by name and makes it the current entry.
int unzGetCurrentFileInfo64 (unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
 Reads the current entry's information and, optionally, its name, extra field, and comment.
int unzOpenCurrentFile (unzFile file)
 Opens the current entry for reading its decompressed data.
int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
 Reads decompressed bytes from the current entry.
int unzCloseCurrentFile (unzFile file)
 Closes the current entry opened with unzOpenCurrentFile.

Detailed Description

IO for reading .zip files, the subset of minizip's unz* API that KUnzip drives.

This is upstream third-party library code, not a routine reconstructed from the binary: it is Gilles Vollant's minizip unzip.c/unzip.h (the version bundled with zlib's contrib/minizip), recovered as the library the way NSData+Base64 and ioapi.c are. The shipped KUnzip was built against a hybrid minizip variant — the classic 1.01e reader with its 32-bit zlib_filefunc_def I/O table (see ioapi.h) and a two-argument internal open, but with the public per-entry and archive-wide info structures widened to the Zip64 *64 names. Only the entry points KUnzip references are declared. The I/O callback table, the voidpf opaque, and uLong come from ioapi.h.

Condition of use and distribution are the same as zlib.

Function Documentation

◆ unzClose()

int unzClose ( unzFile file)

Closes an archive opened with unzOpen or unzOpenInternal.

Parameters
fileThe archive handle.
Returns
UNZ_OK on success, or UNZ_PARAMERROR when file is nullptr.
Ghidra address:
0x74a50

◆ unzCloseCurrentFile()

int unzCloseCurrentFile ( unzFile file)

Closes the current entry opened with unzOpenCurrentFile.

Parameters
fileThe archive handle.
Returns
UNZ_OK on success, or UNZ_CRCERROR when the whole entry was read and its CRC did not match.
Ghidra address:
0x74ac8

◆ unzGetCurrentFileInfo64()

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

Reads the current entry's information and, optionally, its name, extra field, and comment.

Parameters
fileThe archive handle.
pfile_infoThe structure to fill, or nullptr.
szFileNameA buffer for the entry name, or nullptr.
fileNameBufferSizeThe size of szFileName.
extraFieldA buffer for the central-header extra field, or nullptr.
extraFieldBufferSizeThe size of extraField.
szCommentA buffer for the entry comment, or nullptr.
commentBufferSizeThe size of szComment.
Returns
UNZ_OK on success.
Ghidra address:
0x74b84

◆ unzGetGlobalInfo64()

int unzGetGlobalInfo64 ( unzFile file,
unz_global_info64 * pglobal_info )

Writes the archive-wide information into pglobal_info.

Parameters
fileThe archive handle.
pglobal_infoThe structure to fill; needs no preparation.
Returns
UNZ_OK on success, or UNZ_PARAMERROR when file is nullptr.
Ghidra address:
0x74b64

◆ unzGoToFirstFile()

int unzGoToFirstFile ( unzFile file)

Makes the first entry the current entry.

Parameters
fileThe archive handle.
Returns
UNZ_OK on success.
Ghidra address:
0x749dc

◆ unzGoToNextFile()

int unzGoToNextFile ( unzFile file)

Makes the next entry the current entry.

Parameters
fileThe archive handle.
Returns
UNZ_OK on success, or UNZ_END_OF_LIST_OF_FILE past the last entry.
Ghidra address:
0x753c8

◆ unzLocateFile()

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

Locates an entry by name and makes it the current entry.

Parameters
fileThe archive handle.
szFileNameThe entry name to find.
iCaseSensitivity1 for a case-sensitive match, 2 for case-insensitive, 0 for the operating system default.
Returns
UNZ_OK when the entry is found, or UNZ_END_OF_LIST_OF_FILE when it is not.
Ghidra address:
0x75478

◆ unzOpen()

unzFile unzOpen ( const char * path)

Opens a .zip archive at a path using the default stdio I/O callbacks.

Parameters
pathThe archive's path.
Returns
The opened archive handle, or nullptr when the file does not exist or is not a valid archive.
Ghidra address:
0x74a48

◆ unzOpenCurrentFile()

int unzOpenCurrentFile ( unzFile file)

Opens the current entry for reading its decompressed data.

Parameters
fileThe archive handle.
Returns
UNZ_OK on success.
Ghidra address:
0x75df0

◆ unzOpenInternal()

unzFile unzOpenInternal ( voidpf file,
zlib_filefunc_def * pzlib_filefunc_def )

Opens a .zip archive using a caller-supplied I/O callback table.

Parameters
fileThe value passed through to the table's zopen_file callback as its filename.
pzlib_filefunc_defThe I/O callback table, or nullptr to use the default stdio table.
Returns
The opened archive handle, or nullptr when the archive cannot be opened.
Ghidra address:
0x74228

◆ unzReadCurrentFile()

int unzReadCurrentFile ( unzFile file,
void * buf,
unsigned len )

Reads decompressed bytes from the current entry.

Parameters
fileThe archive handle.
bufThe destination buffer.
lenThe size of buf.
Returns
The number of bytes copied, 0 at the end of the entry, or a negative error code.
Ghidra address:
0x75e04