GDAL
|
00001 /* Modified version by Even Rouault. : 00002 - change fill_fopen_filefunc to cpl_fill_fopen_filefunc 00003 - Add support for ZIP64 00004 00005 Copyright (C) 2007-2008 Even Rouault 00006 00007 Original licence available in port/LICENCE_minizip 00008 */ 00009 00010 /* ioapi.h -- IO base function header for compress/uncompress .zip 00011 files using zlib + zip or unzip API 00012 00013 Version 1.01e, February 12th, 2005 00014 00015 Copyright (C) 1998-2005 Gilles Vollant 00016 */ 00017 00018 #ifndef CPL_MINIZIP_IOAPI_H_INCLUDED 00019 #define CPL_MINIZIP_IOAPI_H_INCLUDED 00020 00021 #include "cpl_vsi.h" 00022 #define uLong64 vsi_l_offset 00023 00024 /* Gentoo removed OF from their copy of zconf.h (https://bugs.gentoo.org/show_bug.cgi?id=383179) */ 00025 /* but our copy of minizip needs it. */ 00026 #ifndef OF 00027 #define OF(args) args 00028 #endif 00029 00030 #define ZLIB_FILEFUNC_SEEK_CUR (1) 00031 #define ZLIB_FILEFUNC_SEEK_END (2) 00032 #define ZLIB_FILEFUNC_SEEK_SET (0) 00033 00034 #define ZLIB_FILEFUNC_MODE_READ (1) 00035 #define ZLIB_FILEFUNC_MODE_WRITE (2) 00036 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 00037 00038 #define ZLIB_FILEFUNC_MODE_EXISTING (4) 00039 #define ZLIB_FILEFUNC_MODE_CREATE (8) 00040 00041 #ifndef ZCALLBACK 00042 00043 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 00044 #define ZCALLBACK CALLBACK 00045 #else 00046 #define ZCALLBACK 00047 #endif 00048 #endif 00049 00050 #ifdef __cplusplus 00051 extern "C" { 00052 #endif 00053 00054 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 00055 typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 00056 typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 00057 typedef uLong64 (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 00058 typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong64 offset, int origin)); 00059 typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 00060 typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 00061 00062 typedef struct zlib_filefunc_def_s 00063 { 00064 open_file_func zopen_file; 00065 read_file_func zread_file; 00066 write_file_func zwrite_file; 00067 tell_file_func ztell_file; 00068 seek_file_func zseek_file; 00069 close_file_func zclose_file; 00070 testerror_file_func zerror_file; 00071 voidpf opaque; 00072 } zlib_filefunc_def; 00073 00074 00075 00076 void cpl_fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 00077 00078 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 00079 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 00080 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 00081 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 00082 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 00083 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 00084 00085 00086 #ifdef __cplusplus 00087 } 00088 #endif 00089 00090 #endif /* CPL_MINIZIP_IOAPI_H_INCLUDED */