uint32_t | __zzip_get32 | (unsigned char * s)
|
uint16_t | __zzip_get16 | (unsigned char * s)
|
int
| zzip_find_disk_trailer | (int fd, int filesize, struct zzip_disk_trailer * trailer)
|
int
| zzip_parse_root_directory | (int fd,
struct zzip_disk_trailer * trailer,
struct zzip_dir_hdr ** hdr_return)
|
ZZIP_DIR*
| zzip_dir_alloc | (const char** fileext)
|
int
| zzip_dir_free | (ZZIP_DIR * dir)
|
int
| zzip_dir_close | (ZZIP_DIR * dir)
|
ZZIP_DIR *
| zzip_dir_fdopen | (int fd, zzip_error_t * errcode_p)
|
int
| __zzip_open_zip | (const char* filename, int filemode)
|
ZZIP_DIR*
| zzip_dir_open | (const char* filename, zzip_error_t* e)
|
int
| zzip_dir_read | (ZZIP_DIR * dir, ZZIP_DIRENT * d )
|
void
| zzip_file_close | (ZZIP_FILE * fp)
|
ZZIP_FILE *
| zzip_file_open | (ZZIP_DIR * dir, const char * name, int flags)
|
static int
| zzip_inflate_init | (ZZIP_FILE * fp, struct zzip_dir_hdr* hdr)
|
void
| zzip_close | (ZZIP_FILE * fp)
|
int
| zzip_file_read | (ZZIP_FILE * fp, char * buf, int len)
|
int
| zzip_read | (ZZIP_FILE * fp, char * buf, int len)
|
ZZIP_FILE*
| zzip_open | (const char* filename, int flags)
|
int
| zzip_rewind | (ZZIP_FILE *fp)
|
int
| zzip_seek | (ZZIP_FILE * fp, int offset, int whence)
|
int
| zzip_tell | (ZZIP_FILE * fp)
|
void
| zzip_rewinddir | (ZZIP_DIR * dir)
|
ZZIP_DIRENT*
| zzip_readdir | (ZZIP_DIR * dir)
|
ZZIP_off_t
| zzip_telldir | (ZZIP_DIR* dir)
|
void
| zzip_seekdir | (ZZIP_DIR* dir, ZZIP_off_t offset)
|
ZZIP_DIR*
| zzip_opendir | (const char* filename)
|
int
| zzip_closedir | (ZZIP_DIR* dir)
|
int
| zzip_dir_stat | (ZZIP_DIR * dir, const char * name, ZZIP_STAT * zs, int flags)
|
int
| zzip_error | (ZZIP_DIR * dir)
|
void
| zzip_seterror | (ZZIP_DIR * dir, int errcode)
|
ZZIP_DIR *
| zzip_dirhandle | (ZZIP_FILE * fp)
|
int
| zzip_dirfd | (ZZIP_DIR* dir)
|
const char*
| zzip_compr_str | (int compr)
|
int
| zzip_dir_real | (ZZIP_DIR* dir)
|
int
| zzip_file_real | (ZZIP_FILE* fp)
|
void*
| zzip_realdir | (ZZIP_DIR* dir)
|
int
| zzip_realfd | (ZZIP_FILE* fp)
|
const char*
| zzip_strerror | (int errcode)
|
const char*
| zzip_strerror_of | (ZZIP_DIR* dir)
|
int
| zzip_errno | (int errcode)
|
uint32_t
__zzip_get32
(unsigned char * s)
(zzip-zip.c)
uint16_t
__zzip_get16
(unsigned char * s)
(zzip-zip.c)
int
zzip_find_disk_trailer
(int fd, int filesize, struct zzip_disk_trailer * trailer)
zzip_file_open
. Tries to find
(zzip-zip.c)
int
zzip_parse_root_directory
(int fd,
struct zzip_disk_trailer * trailer,
struct zzip_dir_hdr ** hdr_return)
zzip_file_open
, it is usually called after
zzip_find_disk_trailer
. It will parse the zip's central directory
(zzip-zip.c)
ZZIP_DIR*
zzip_dir_alloc
(const char** fileext)
zzip_dir_fdopen
zzip_dir_open
zzip_file_open
or through
zzip_open
(zzip-zip.c)
int
zzip_dir_free
(ZZIP_DIR * dir)
zzip_dir_alloc
, and both
zzip_dir_close
= zzip_close
(zzip-zip.c)
int
zzip_dir_close
(ZZIP_DIR * dir)
free
(2) the ZZIP_DIR
-handle given.
zzip_dir_open
zzip_dir_free
(zzip-zip.c)
ZZIP_DIR *
zzip_dir_fdopen
(int fd, zzip_error_t * errcode_p)
zzip_dir_open
and zzip_opendir(2) call. Opens the
NOTE: refcount is zero, so an _open/_close pair will also delete
this _dirhandle
(zzip-zip.c)
int
__zzip_open_zip
(const char* filename, int filemode)
open
(2). This is a helper function for
zzip_dir_open
, zzip_opendir
and zzip_open
.
(zzip-zip.c)
ZZIP_DIR*
zzip_dir_open
(const char* filename, zzip_error_t* e)
(zzip-zip.c)
int
zzip_dir_read
(ZZIP_DIR * dir, ZZIP_DIRENT * d )
returns 0 if there no entry (anymore).
(zzip-zip.c)
void
zzip_file_close
(ZZIP_FILE * fp)
zzip_close
(fp). it will cleanup the
zlib
and free the structure given.
it is called quite from the error-cleanup parts
of the various _open
functions.
the .refcount is decreased and if zero the fp->dir is closed just as well.
(zzip-file.c)
ZZIP_FILE *
zzip_file_open
(ZZIP_DIR * dir, const char * name, int flags)
ZZIP_FILE
from an already open ZZIP_DIR
handle. Since
buf32k
and ZZIP_FILE
memchunk
Note: the zlib supports 2..15 bit windowsize, hence we provide a 32k
memchunk here... just to be safe.
(zzip-file.c)
static int
zzip_inflate_init
(ZZIP_FILE * fp, struct zzip_dir_hdr* hdr)
inflateInit
and setup fp's iterator variables,
_open
functions.
(zzip-file.c)
void
zzip_close
(ZZIP_FILE * fp)
(zzip-file.c)
int
zzip_file_read
(ZZIP_FILE * fp, char * buf, int len)
read
(2), it will fill the given buffer with bytes from
EOF
This is the routines that needs the buf32k
buffer, and it would have
need for much more polishing but it does already work quite well.
Note: the 32K buffer is rather big. The original inflate-algorithm
required just that but the latest zlib would work just fine with
a smaller buffer.
(zzip-file.c)
int
zzip_read
(ZZIP_FILE * fp, char * buf, int len)
read
(2), it will fill the given buffer with bytes from
If the file-handle is wrapping a stat'able file then it will actually just
perform a normal read
(2)-call, otherwise zzip_file_read
is called
to decompress the data stream and any error is mapped to errno
(3).
(zzip-file.c)
ZZIP_FILE*
zzip_open
(const char* filename, int flags)
open
(2).
This functions has some magic builtin - it will first try to open
the given filename as a normal file. If it does not
exist, the given path to the filename (if any) is split into
its directory-part and the file-part. A ".zip" extension is
then added to the directory-part to create the name of a
zip-archive. That zip-archive (if it exists) is being searched
for the file-part, and if found a zzip-handle is returned.
Note that if the file is found in the normal fs-directory the
returned structure is mostly empty and the zzip_read
call will
use the libc read
to obtain data. Otherwise a zzip_file_open
is performed and any error mapped to errno
(3).
(zzip-file.c)
int
zzip_rewind
(ZZIP_FILE *fp)
(zzip-file.c)
int
zzip_seek
(ZZIP_FILE * fp, int offset, int whence)
lseek
(2), it will seek to the offset
If the file-handle is wrapping a stat'able file then it will actually just
perform a normal lseek
(2)-call. Otherwise the relative offset
is calculated, negative offsets are transformed into positive ones
by rewinding the file, and then data is read until the offset is
reached. This can make the function terribly slow, but this is
how gzio implements it, so I'm not sure there is a better way
without using the internals of the algorithm.
(zzip-file.c)
int
zzip_tell
(ZZIP_FILE * fp)
tell
(2), it will return the current offset
If the file-handle is wrapping a stat'able file then it will actually just
perform a normal tell
(2)-call, otherwise the offset is
calculated from the amount of data left and the total uncompressed
size;
(zzip-file.c)
void
zzip_rewinddir
(ZZIP_DIR * dir)
rewinddir
(2), rewinds the DIR returned by zzip_opendir
(zzip-dir.c)
ZZIP_DIRENT*
zzip_readdir
(ZZIP_DIR * dir)
readdir
(2), reads the DIR returned by zzip_opendir
(zzip-dir.c)
ZZIP_off_t
zzip_telldir
(ZZIP_DIR* dir)
telldir
(2)
(zzip-dir.c)
void
zzip_seekdir
(ZZIP_DIR* dir, ZZIP_off_t offset)
seekdir
(2)
(zzip-dir.c)
ZZIP_DIR*
zzip_opendir
(const char* filename)
opendir
(3).
This function has some magic - if the given argument-path
is a directory, it will wrap a real opendir
(3) into the ZZIP_DIR
structure. Otherwise it will divert to zzip_dir_open
which
can also attach a .zip extension if needed to find the archive.
the error-code is mapped to errno
(3).
(zzip-dir.c)
int
zzip_closedir
(ZZIP_DIR* dir)
closedir
(3).
This function is magic - if the given arg-ZZIP_DIR
is a real directory, it will call the real closedir
(3) and then
free the wrapping ZZIP_DIR structure. Otherwise it will divert
to zzip_dir_close
which will free the ZZIP_DIR structure.
(zzip-dir.c)
int
zzip_dir_stat
(ZZIP_DIR * dir, const char * name, ZZIP_STAT * zs, int flags)
(zzip-stat.c)
int
zzip_error
(ZZIP_DIR * dir)
(zzip-info.c)
void
zzip_seterror
(ZZIP_DIR * dir, int errcode)
(zzip-info.c)
ZZIP_DIR *
zzip_dirhandle
(ZZIP_FILE * fp)
(zzip-info.c)
int
zzip_dirfd
(ZZIP_DIR* dir)
(zzip-info.c)
const char*
zzip_compr_str
(int compr)
(zzip-info.c)
int
zzip_dir_real
(ZZIP_DIR* dir)
(zzip-info.c)
int
zzip_file_real
(ZZIP_FILE* fp)
(zzip-info.c)
void*
zzip_realdir
(ZZIP_DIR* dir)
zzip_dir_real
if the
(zzip-info.c)
int
zzip_realfd
(ZZIP_FILE* fp)
zzip_file_real
if the
(zzip-info.c)
const char*
zzip_strerror
(int errcode)
libz
libzzip
, which is an
ZZIP_ERROR
(zzip-err.c)
const char*
zzip_strerror_of
(ZZIP_DIR* dir)
DIR
-handle and run it
zzip_strerror
to obtain the static string
(zzip-err.c)
int
zzip_errno
(int errcode)
open
(2) call had been
(zzip-err.c)