ioapi.h
Go to the documentation of this file.
00001 /* ioapi.h -- IO base function header for compress/uncompress .zip
00002    part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
00003 
00004          Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
00005 
00006          Modifications for Zip64 support
00007          Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
00008 
00009          For more info read MiniZip_info.txt
00010 
00011          Changes
00012 
00013     Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)
00014     Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
00015                More if/def section may be needed to support other platforms
00016     Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
00017                           (but you should use iowin32.c for windows instead)
00018 
00019 */
00020 
00021 #ifndef _ZLIBIOAPI64_H
00022 #define _ZLIBIOAPI64_H
00023 
00024 #if (!defined(_WIN32)) && (!defined(WIN32))
00025 
00026   // Linux needs this to support file operation on files larger then 4+GB
00027   // But might need better if/def to select just the platforms that needs them.
00028 
00029         #ifndef __USE_FILE_OFFSET64
00030                 #define __USE_FILE_OFFSET64
00031         #endif
00032         #ifndef __USE_LARGEFILE64
00033                 #define __USE_LARGEFILE64
00034         #endif
00035         #ifndef _LARGEFILE64_SOURCE
00036                 #define _LARGEFILE64_SOURCE
00037         #endif
00038         #ifndef _FILE_OFFSET_BIT
00039                 #define _FILE_OFFSET_BIT 64
00040         #endif
00041 #endif
00042 
00043 #include <stdio.h>
00044 #include <stdlib.h>
00045 #include "zlib.h"
00046 
00047 #if defined(USE_FILE32API)
00048 #define fopen64 fopen
00049 #define ftello64 ftell
00050 #define fseeko64 fseek
00051 #else
00052 #ifdef _MSC_VER
00053  #define fopen64 fopen
00054  #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
00055   #define ftello64 _ftelli64
00056   #define fseeko64 _fseeki64
00057  #else // old MSC
00058   #define ftello64 ftell
00059   #define fseeko64 fseek
00060  #endif
00061 #endif
00062 #endif
00063 
00064 /*
00065 #ifndef ZPOS64_T
00066   #ifdef _WIN32
00067                 #define ZPOS64_T fpos_t
00068   #else
00069     #include <stdint.h>
00070     #define ZPOS64_T uint64_t
00071   #endif
00072 #endif
00073 */
00074 
00075 #ifdef HAVE_MINIZIP64_CONF_H
00076 #include "mz64conf.h"
00077 #endif
00078 
00079 /* a type choosen by DEFINE */
00080 #ifdef HAVE_64BIT_INT_CUSTOM
00081 typedef  64BIT_INT_CUSTOM_TYPE ZPOS64_T;
00082 #else
00083 #ifdef HAS_STDINT_H
00084 #include "stdint.h"
00085 typedef uint64_t ZPOS64_T;
00086 #else
00087 
00088 
00089 #if defined(_MSC_VER) || defined(__BORLANDC__)
00090 typedef unsigned __int64 ZPOS64_T;
00091 #else
00092 typedef unsigned long long int ZPOS64_T;
00093 #endif
00094 #endif
00095 #endif
00096 
00097 
00098 
00099 #ifdef __cplusplus
00100 extern "C" {
00101 #endif
00102 
00103 
00104 #define ZLIB_FILEFUNC_SEEK_CUR (1)
00105 #define ZLIB_FILEFUNC_SEEK_END (2)
00106 #define ZLIB_FILEFUNC_SEEK_SET (0)
00107 
00108 #define ZLIB_FILEFUNC_MODE_READ      (1)
00109 #define ZLIB_FILEFUNC_MODE_WRITE     (2)
00110 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
00111 
00112 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
00113 #define ZLIB_FILEFUNC_MODE_CREATE   (8)
00114 
00115 
00116 #ifndef ZCALLBACK
00117  #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
00118    #define ZCALLBACK CALLBACK
00119  #else
00120    #define ZCALLBACK
00121  #endif
00122 #endif
00123 
00124 
00125 
00126 
00127 typedef voidpf   (ZCALLBACK *open_file_func)      OF((voidpf opaque, const char* filename, int mode));
00128 typedef uLong    (ZCALLBACK *read_file_func)      OF((voidpf opaque, voidpf stream, void* buf, uLong size));
00129 typedef uLong    (ZCALLBACK *write_file_func)     OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
00130 typedef int      (ZCALLBACK *close_file_func)     OF((voidpf opaque, voidpf stream));
00131 typedef int      (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
00132 
00133 typedef long     (ZCALLBACK *tell_file_func)      OF((voidpf opaque, voidpf stream));
00134 typedef long     (ZCALLBACK *seek_file_func)      OF((voidpf opaque, voidpf stream, uLong offset, int origin));
00135 
00136 
00137 /* here is the "old" 32 bits structure structure */
00138 typedef struct zlib_filefunc_def_s
00139 {
00140     open_file_func      zopen_file;
00141     read_file_func      zread_file;
00142     write_file_func     zwrite_file;
00143     tell_file_func      ztell_file;
00144     seek_file_func      zseek_file;
00145     close_file_func     zclose_file;
00146     testerror_file_func zerror_file;
00147     voidpf              opaque;
00148 } zlib_filefunc_def;
00149 
00150 typedef ZPOS64_T (ZCALLBACK *tell64_file_func)    OF((voidpf opaque, voidpf stream));
00151 typedef long     (ZCALLBACK *seek64_file_func)    OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
00152 typedef voidpf   (ZCALLBACK *open64_file_func)    OF((voidpf opaque, const void* filename, int mode));
00153 
00154 typedef struct zlib_filefunc64_def_s
00155 {
00156     open64_file_func    zopen64_file;
00157     read_file_func      zread_file;
00158     write_file_func     zwrite_file;
00159     tell64_file_func    ztell64_file;
00160     seek64_file_func    zseek64_file;
00161     close_file_func     zclose_file;
00162     testerror_file_func zerror_file;
00163     voidpf              opaque;
00164 } zlib_filefunc64_def;
00165 
00166 void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
00167 void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
00168 
00169 /* now internal definition, only for zip.c and unzip.h */
00170 typedef struct zlib_filefunc64_32_def_s
00171 {
00172     zlib_filefunc64_def zfile_func64;
00173     open_file_func      zopen32_file;
00174     tell_file_func      ztell32_file;
00175     seek_file_func      zseek32_file;
00176 } zlib_filefunc64_32_def;
00177 
00178 
00179 #define ZREAD64(filefunc,filestream,buf,size)     ((*((filefunc).zfile_func64.zread_file))   ((filefunc).zfile_func64.opaque,filestream,buf,size))
00180 #define ZWRITE64(filefunc,filestream,buf,size)    ((*((filefunc).zfile_func64.zwrite_file))  ((filefunc).zfile_func64.opaque,filestream,buf,size))
00181 //#define ZTELL64(filefunc,filestream)            ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
00182 //#define ZSEEK64(filefunc,filestream,pos,mode)   ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
00183 #define ZCLOSE64(filefunc,filestream)             ((*((filefunc).zfile_func64.zclose_file))  ((filefunc).zfile_func64.opaque,filestream))
00184 #define ZERROR64(filefunc,filestream)             ((*((filefunc).zfile_func64.zerror_file))  ((filefunc).zfile_func64.opaque,filestream))
00185 
00186 voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
00187 long    call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
00188 ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
00189 
00190 void    fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
00191 
00192 #define ZOPEN64(filefunc,filename,mode)         (call_zopen64((&(filefunc)),(filename),(mode)))
00193 #define ZTELL64(filefunc,filestream)            (call_ztell64((&(filefunc)),(filestream)))
00194 #define ZSEEK64(filefunc,filestream,pos,mode)   (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
00195 
00196 #ifdef __cplusplus
00197 }
00198 #endif
00199 
00200 #endif


re_object_recorder
Author(s): Andreas Koch
autogenerated on Sun Jan 5 2014 11:39:12