Version 0.13.49
#include <zzip/lib.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zzip_error(ZZIP_DIR * dir)
: int
|
zzip_seterror(ZZIP_DIR * dir, int errcode)
: void
|
just returns dir->errcode of the ZZIP_DIR handle
see: | ||
The |
zzip_open(zzip_char_t* filename, int o_flags)
: ZZIP_FILE*
|
zzip_open_ext_io(zzip_char_t* filename, int o_flags, int o_modes,
zzip_strings_t* ext, zzip_plugin_io_t io)
: ZZIP_FILE*
|
zzip_open_shared_io(ZZIP_FILE* stream,
zzip_char_t* filename, int o_flags, int o_modes,
zzip_strings_t* ext, zzip_plugin_io_t io)
: ZZIP_FILE*
|
The It has some magic functionality 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
There was a possibility to transfer zziplib-specific openmodes
through o_flags but you should please not use them anymore and
look into
you must stop using this extra functionality (not well known anyway) since zzip_open might be later usable to open files for writing in which case the _EXTRAFLAGS will get in conflict.
compare with | ||
The note that the two flag types have been split into an o_flags (for fcntl-like openflags) and o_modes where the latter shall carry the zzip_flags and possibly accessmodes for unix filesystems. Since this version of zziplib can not write zipfiles, it is not yet used for anything else than zzip-specific modeflags.
The | ||
The
The benefit for the
Note that the
The |
zzip_opendir(zzip_char_t* filename)
: ZZIP_DIR*
|
zzip_opendir_ext_io(zzip_char_t* filename, int o_modes,
zzip_strings_t* ext, zzip_plugin_io_t io)
: ZZIP_DIR*
|
| ||
The |
zzip_file_real(ZZIP_FILE* fp)
: int
|
zzip_dir_real(ZZIP_DIR* dir)
: int
|
zzip_realdir(ZZIP_DIR* dir)
: void*
|
zzip_realfd(ZZIP_FILE* fp)
: int
|
| ||
The | ||
The | ||
The |
zzip_dir_stat(ZZIP_DIR * dir, zzip_char_t* name, ZZIP_STAT * zs, int flags)
: int
|
zzip_file_stat(ZZIP_FILE* file, ZZIP_STAT* zs)
: int |
zzip_fstat(ZZIP_FILE* file, ZZIP_STAT* zs)
: int |
| ||
The | ||
The |
zzip_strerror(int errcode)
: zzip_char_t*
|
zzip_strerror_of(ZZIP_DIR* dir)
: zzip_char_t*
|
| ||
The |
zzip_dir_open(zzip_char_t* filename, zzip_error_t* e)
: ZZIP_DIR*
|
zzip_dir_open_ext_io(zzip_char_t* filename, zzip_error_t* e,
zzip_strings_t* ext, zzip_plugin_io_t io)
: ZZIP_DIR*
|
zzip_dir_read(ZZIP_DIR * dir, ZZIP_DIRENT * d )
: int
|
| ||
the | ||
fills the dirent-argument with the values and increments the read-pointer of the dir-argument. returns 0 if there no entry (anymore). |
zzip_init_io(zzip_plugin_io_handlers_t io, int flags)
: int |
zzip_get_default_io()
: zzip_plugin_io_t
|
| ||
The |
zzip_rewinddir(ZZIP_DIR * dir)
: void
|
zzip_telldir(ZZIP_DIR* dir)
: zzip_off_t
|
zzip_seekdir(ZZIP_DIR* dir, zzip_off_t offset)
: void
|
The | ||
The | ||
The |
zzip_fopen(zzip_char_t* filename, zzip_char_t* mode)
: ZZIP_FILE*
|
zzip_freopen(zzip_char_t* filename, zzip_char_t* mode, ZZIP_FILE* stream)
: ZZIP_FILE*
|
The It has some magic functionality 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
unlike the posix-wrapper
all other modes will be ignored for zip-contained entries but they are transferred for compatibility and portability, including these extra sugar bits:
... the access bits are in traditional unix bit format with 7 = read/write/execute, 6 = read/write, 4 = read-only. The default access mode is 0664, and the compression level is ignored since the lib can not yet write zip files, otherwise it would be the initialisation value for the zlib deflateInit where 0 = no-compression, 1 = best-speed, 9 = best-compression.
The | ||
The Per default, the old file stream is closed and only the internal structures associated with it are kept. These internal structures may be reused for the return value, and this is a lot quicker when the filename matches a zipped file that is incidently in the very same zip arch as the old filename wrapped in the stream struct.
That's simply because the zip arch's central directory does not
need to be read again. As an extension for the
The |
zzip_dirhandle(ZZIP_FILE * fp)
: ZZIP_DIR *
|
zzip_dirfd(ZZIP_DIR* dir)
: int
|
The If a ZZIP_FILE is contained within a zip-file that one will be a valid pointer, otherwise a NULL is returned and the ZZIP_FILE wraps a real file. | ||
The If a ZZIP_DIR does point to a zipfile then the file-descriptor of that zipfile is returned, otherwise a NULL is returned and the ZZIP_DIR wraps a real directory DIR (if you have dirent on your system). |
zzip_read(ZZIP_FILE * fp, void * buf, zzip_size_t len)
: zzip_ssize_t
|
zzip_fread(void *ptr, zzip_size_t size, zzip_size_t nmemb, ZZIP_FILE *file)
: zzip_size_t
|
The
the replacement for
If the file-handle is wrapping a stat'able file then it will actually just
perform a normal | ||
zzip_dir_free(ZZIP_DIR * dir)
: int
|
zzip_dir_close(ZZIP_DIR * dir)
: int
|
| ||
It will also |
zzip_fclose(ZZIP_FILE * fp)
: int
|
zzip_close(ZZIP_FILE* fp)
: int
|
The If the ZZIP_FILE wraps a normal stat'fd then it is just that int'fd that is being closed and the otherwise empty ZZIP_FILE gets freed. | ||
zzip_dir_fdopen(int fd, zzip_error_t * errcode_p)
: ZZIP_DIR *
|
zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errcode_p,
zzip_strings_t* ext, const zzip_plugin_io_t io)
: ZZIP_DIR *
|
used by the NOTE: refcount is zero, so an _open/_close pair will also delete this _dirhandle | ||
the |
zzip_dir_alloc_ext_io(zzip_strings_t* ext, const zzip_plugin_io_t io)
: ZZIP_DIR*
|
zzip_dir_alloc(zzip_strings_t* fileext)
: ZZIP_DIR*
|
| ||
the |
zzip_readdir(ZZIP_DIR * dir)
: ZZIP_DIRENT*
|
|
zzip_closedir(ZZIP_DIR* dir)
: int
|
|
zzip_errno(int errcode)
: int
|
|
zzip_file_close(ZZIP_FILE * fp)
: int
|
|
zzip_file_open(ZZIP_DIR * dir, zzip_char_t* name, int o_mode)
: ZZIP_FILE *
|
|
zzip_inflate_init(ZZIP_FILE * fp, struct zzip_dir_hdr* hdr)
: static int
|
|
zzip_file_read(ZZIP_FILE * fp, void * buf, zzip_size_t len)
: zzip_ssize_t
|
The
It works like
This is the routines that needs the 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_rewind(ZZIP_FILE *fp)
: int
|
The It seeks to the beginning of this file's data in the zip, or the beginning of the file for a stat'fd. |
zzip_seek(ZZIP_FILE * fp, zzip_off_t offset, int whence)
: zzip_off_t
|
The It will try to seek to the offset specified by offset, relative to whence, which is one of SEEK_SET, SEEK_CUR or SEEK_END.
If the file-handle is wrapping a stat'able file then it will actually just
perform a normal |
zzip_tell(ZZIP_FILE * fp)
: zzip_off_t
|
The It will return the current offset within the real/zipped file, measured in uncompressed bytes for the zipped-file case.
If the file-handle is wrapping a stat'able file then it will actually just
perform a normal |
zzip_compr_str(int compr)
: zzip_char_t*
|
|
__zzip_fetch_disk_trailer(int fd, zzip_off_t filesize,
struct _disk_trailer * _zzip_restrict trailer,
zzip_plugin_io_t io)
: int
|
|
__zzip_parse_root_directory(int fd,
struct _disk_trailer * trailer,
struct zzip_dir_hdr ** hdr_return,
zzip_plugin_io_t io)
: int
|
|
__zzip_try_open(zzip_char_t* filename, int filemode,
zzip_strings_t* ext, zzip_plugin_io_t io)
: int
|
|