00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _ZLIBIOAPI_H
00011 #define _ZLIBIOAPI_H
00012
00013
00014 #define ZLIB_FILEFUNC_SEEK_CUR (1)
00015 #define ZLIB_FILEFUNC_SEEK_END (2)
00016 #define ZLIB_FILEFUNC_SEEK_SET (0)
00017
00018 #define ZLIB_FILEFUNC_MODE_READ (1)
00019 #define ZLIB_FILEFUNC_MODE_WRITE (2)
00020 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
00021
00022 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
00023 #define ZLIB_FILEFUNC_MODE_CREATE (8)
00024
00025
00026 #ifndef ZCALLBACK
00027
00028 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
00029 #define ZCALLBACK CALLBACK
00030 #else
00031 #define ZCALLBACK
00032 #endif
00033 #endif
00034
00035 namespace PentZip {
00036
00037 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
00038 typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
00039 typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
00040 typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
00041 typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
00042 typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
00043 typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
00044
00045 typedef struct zlib_filefunc_def_s
00046 {
00047 open_file_func zopen_file;
00048 read_file_func zread_file;
00049 write_file_func zwrite_file;
00050 tell_file_func ztell_file;
00051 seek_file_func zseek_file;
00052 close_file_func zclose_file;
00053 testerror_file_func zerror_file;
00054 voidpf opaque;
00055 } zlib_filefunc_def;
00056
00057
00058
00059 void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
00060
00061 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
00062 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
00063 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
00064 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
00065 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
00066 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
00067
00068
00069 }
00070
00071 #endif
00072