1 /* ioapi.h -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API
4 Version 1.01h, December 28th, 2009
6 Copyright (C) 1998-2009 Gilles Vollant
12 // Needed for some zlib installations:
18 #define ZLIB_FILEFUNC_SEEK_CUR (1)
19 #define ZLIB_FILEFUNC_SEEK_END (2)
20 #define ZLIB_FILEFUNC_SEEK_SET (0)
22 #define ZLIB_FILEFUNC_MODE_READ (1)
23 #define ZLIB_FILEFUNC_MODE_WRITE (2)
24 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
26 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
27 #define ZLIB_FILEFUNC_MODE_CREATE (8)
32 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
33 #define ZCALLBACK CALLBACK
43 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
44 typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
45 typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
46 typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
47 typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
48 typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
49 typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
51 typedef struct zlib_filefunc_def_s
53 open_file_func zopen_file;
54 read_file_func zread_file;
55 write_file_func zwrite_file;
56 tell_file_func ztell_file;
57 seek_file_func zseek_file;
58 close_file_func zclose_file;
59 testerror_file_func zerror_file;
65 void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
67 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
68 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
69 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
70 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
71 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
72 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))