annotate src/zlib-1.2.8/contrib/minizip/ioapi.h @ 56:af97cad61ff0

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