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