annotate src/zlib-1.2.7/contrib/minizip/ioapi.h @ 23:619f715526df sv_v2.1

Update Vamp plugin SDK to 2.5
author Chris Cannam
date Thu, 09 May 2013 10:52:46 +0100
parents e13257ea84a4
children
rev   line source
Chris@4 1 /* ioapi.h -- IO base function header for compress/uncompress .zip
Chris@4 2 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
Chris@4 3
Chris@4 4 Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Chris@4 5
Chris@4 6 Modifications for Zip64 support
Chris@4 7 Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
Chris@4 8
Chris@4 9 For more info read MiniZip_info.txt
Chris@4 10
Chris@4 11 Changes
Chris@4 12
Chris@4 13 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)
Chris@4 14 Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
Chris@4 15 More if/def section may be needed to support other platforms
Chris@4 16 Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
Chris@4 17 (but you should use iowin32.c for windows instead)
Chris@4 18
Chris@4 19 */
Chris@4 20
Chris@4 21 #ifndef _ZLIBIOAPI64_H
Chris@4 22 #define _ZLIBIOAPI64_H
Chris@4 23
Chris@4 24 #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
Chris@4 25
Chris@4 26 // Linux needs this to support file operation on files larger then 4+GB
Chris@4 27 // But might need better if/def to select just the platforms that needs them.
Chris@4 28
Chris@4 29 #ifndef __USE_FILE_OFFSET64
Chris@4 30 #define __USE_FILE_OFFSET64
Chris@4 31 #endif
Chris@4 32 #ifndef __USE_LARGEFILE64
Chris@4 33 #define __USE_LARGEFILE64
Chris@4 34 #endif
Chris@4 35 #ifndef _LARGEFILE64_SOURCE
Chris@4 36 #define _LARGEFILE64_SOURCE
Chris@4 37 #endif
Chris@4 38 #ifndef _FILE_OFFSET_BIT
Chris@4 39 #define _FILE_OFFSET_BIT 64
Chris@4 40 #endif
Chris@4 41
Chris@4 42 #endif
Chris@4 43
Chris@4 44 #include <stdio.h>
Chris@4 45 #include <stdlib.h>
Chris@4 46 #include "zlib.h"
Chris@4 47
Chris@4 48 #if defined(USE_FILE32API)
Chris@4 49 #define fopen64 fopen
Chris@4 50 #define ftello64 ftell
Chris@4 51 #define fseeko64 fseek
Chris@4 52 #else
Chris@4 53 #ifdef __FreeBSD__
Chris@4 54 #define fopen64 fopen
Chris@4 55 #define ftello64 ftello
Chris@4 56 #define fseeko64 fseeko
Chris@4 57 #endif
Chris@4 58 #ifdef _MSC_VER
Chris@4 59 #define fopen64 fopen
Chris@4 60 #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
Chris@4 61 #define ftello64 _ftelli64
Chris@4 62 #define fseeko64 _fseeki64
Chris@4 63 #else // old MSC
Chris@4 64 #define ftello64 ftell
Chris@4 65 #define fseeko64 fseek
Chris@4 66 #endif
Chris@4 67 #endif
Chris@4 68 #endif
Chris@4 69
Chris@4 70 /*
Chris@4 71 #ifndef ZPOS64_T
Chris@4 72 #ifdef _WIN32
Chris@4 73 #define ZPOS64_T fpos_t
Chris@4 74 #else
Chris@4 75 #include <stdint.h>
Chris@4 76 #define ZPOS64_T uint64_t
Chris@4 77 #endif
Chris@4 78 #endif
Chris@4 79 */
Chris@4 80
Chris@4 81 #ifdef HAVE_MINIZIP64_CONF_H
Chris@4 82 #include "mz64conf.h"
Chris@4 83 #endif
Chris@4 84
Chris@4 85 /* a type choosen by DEFINE */
Chris@4 86 #ifdef HAVE_64BIT_INT_CUSTOM
Chris@4 87 typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
Chris@4 88 #else
Chris@4 89 #ifdef HAS_STDINT_H
Chris@4 90 #include "stdint.h"
Chris@4 91 typedef uint64_t ZPOS64_T;
Chris@4 92 #else
Chris@4 93
Chris@4 94 /* Maximum unsigned 32-bit value used as placeholder for zip64 */
Chris@4 95 #define MAXU32 0xffffffff
Chris@4 96
Chris@4 97 #if defined(_MSC_VER) || defined(__BORLANDC__)
Chris@4 98 typedef unsigned __int64 ZPOS64_T;
Chris@4 99 #else
Chris@4 100 typedef unsigned long long int ZPOS64_T;
Chris@4 101 #endif
Chris@4 102 #endif
Chris@4 103 #endif
Chris@4 104
Chris@4 105
Chris@4 106
Chris@4 107 #ifdef __cplusplus
Chris@4 108 extern "C" {
Chris@4 109 #endif
Chris@4 110
Chris@4 111
Chris@4 112 #define ZLIB_FILEFUNC_SEEK_CUR (1)
Chris@4 113 #define ZLIB_FILEFUNC_SEEK_END (2)
Chris@4 114 #define ZLIB_FILEFUNC_SEEK_SET (0)
Chris@4 115
Chris@4 116 #define ZLIB_FILEFUNC_MODE_READ (1)
Chris@4 117 #define ZLIB_FILEFUNC_MODE_WRITE (2)
Chris@4 118 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
Chris@4 119
Chris@4 120 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
Chris@4 121 #define ZLIB_FILEFUNC_MODE_CREATE (8)
Chris@4 122
Chris@4 123
Chris@4 124 #ifndef ZCALLBACK
Chris@4 125 #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
Chris@4 126 #define ZCALLBACK CALLBACK
Chris@4 127 #else
Chris@4 128 #define ZCALLBACK
Chris@4 129 #endif
Chris@4 130 #endif
Chris@4 131
Chris@4 132
Chris@4 133
Chris@4 134
Chris@4 135 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
Chris@4 136 typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
Chris@4 137 typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
Chris@4 138 typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
Chris@4 139 typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
Chris@4 140
Chris@4 141 typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
Chris@4 142 typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
Chris@4 143
Chris@4 144
Chris@4 145 /* here is the "old" 32 bits structure structure */
Chris@4 146 typedef struct zlib_filefunc_def_s
Chris@4 147 {
Chris@4 148 open_file_func zopen_file;
Chris@4 149 read_file_func zread_file;
Chris@4 150 write_file_func zwrite_file;
Chris@4 151 tell_file_func ztell_file;
Chris@4 152 seek_file_func zseek_file;
Chris@4 153 close_file_func zclose_file;
Chris@4 154 testerror_file_func zerror_file;
Chris@4 155 voidpf opaque;
Chris@4 156 } zlib_filefunc_def;
Chris@4 157
Chris@4 158 typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
Chris@4 159 typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
Chris@4 160 typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
Chris@4 161
Chris@4 162 typedef struct zlib_filefunc64_def_s
Chris@4 163 {
Chris@4 164 open64_file_func zopen64_file;
Chris@4 165 read_file_func zread_file;
Chris@4 166 write_file_func zwrite_file;
Chris@4 167 tell64_file_func ztell64_file;
Chris@4 168 seek64_file_func zseek64_file;
Chris@4 169 close_file_func zclose_file;
Chris@4 170 testerror_file_func zerror_file;
Chris@4 171 voidpf opaque;
Chris@4 172 } zlib_filefunc64_def;
Chris@4 173
Chris@4 174 void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
Chris@4 175 void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
Chris@4 176
Chris@4 177 /* now internal definition, only for zip.c and unzip.h */
Chris@4 178 typedef struct zlib_filefunc64_32_def_s
Chris@4 179 {
Chris@4 180 zlib_filefunc64_def zfile_func64;
Chris@4 181 open_file_func zopen32_file;
Chris@4 182 tell_file_func ztell32_file;
Chris@4 183 seek_file_func zseek32_file;
Chris@4 184 } zlib_filefunc64_32_def;
Chris@4 185
Chris@4 186
Chris@4 187 #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
Chris@4 188 #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
Chris@4 189 //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
Chris@4 190 //#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
Chris@4 191 #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
Chris@4 192 #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
Chris@4 193
Chris@4 194 voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
Chris@4 195 long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
Chris@4 196 ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
Chris@4 197
Chris@4 198 void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
Chris@4 199
Chris@4 200 #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
Chris@4 201 #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
Chris@4 202 #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
Chris@4 203
Chris@4 204 #ifdef __cplusplus
Chris@4 205 }
Chris@4 206 #endif
Chris@4 207
Chris@4 208 #endif