3 /* ioapi.h -- IO base function header for compress/uncompress .zip
4 files using zlib + zip or unzip API
6 Version 1.01e, February 12th, 2005
8 Copyright (C) 1998-2005 Gilles Vollant
15 #define ZLIB_FILEFUNC_SEEK_CUR (1)
16 #define ZLIB_FILEFUNC_SEEK_END (2)
17 #define ZLIB_FILEFUNC_SEEK_SET (0)
19 #define ZLIB_FILEFUNC_MODE_READ (1)
20 #define ZLIB_FILEFUNC_MODE_WRITE (2)
21 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
23 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
24 #define ZLIB_FILEFUNC_MODE_CREATE (8)
29 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
30 #define ZCALLBACK CALLBACK
40 typedef voidpf (ZCALLBACK
*open_file_func
) OF((voidpf opaque
, const char* filename
, int mode
));
41 typedef uLong (ZCALLBACK
*read_file_func
) OF((voidpf opaque
, voidpf stream
, void* buf
, uLong size
));
42 typedef uLong (ZCALLBACK
*write_file_func
) OF((voidpf opaque
, voidpf stream
, const void* buf
, uLong size
));
43 typedef long (ZCALLBACK
*tell_file_func
) OF((voidpf opaque
, voidpf stream
));
44 typedef long (ZCALLBACK
*seek_file_func
) OF((voidpf opaque
, voidpf stream
, uLong offset
, int origin
));
45 typedef int (ZCALLBACK
*close_file_func
) OF((voidpf opaque
, voidpf stream
));
46 typedef int (ZCALLBACK
*testerror_file_func
) OF((voidpf opaque
, voidpf stream
));
48 typedef struct zlib_filefunc_def_s
50 open_file_func zopen_file
;
51 read_file_func zread_file
;
52 write_file_func zwrite_file
;
53 tell_file_func ztell_file
;
54 seek_file_func zseek_file
;
55 close_file_func zclose_file
;
56 testerror_file_func zerror_file
;
62 void fill_fopen_filefunc
OF((zlib_filefunc_def
* pzlib_filefunc_def
));
64 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
65 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
66 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
67 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
68 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
69 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))