xlsxwriter 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +40 -0
  3. data/ext/xlsxwriter/chart.c +105 -0
  4. data/ext/xlsxwriter/chart.h +27 -0
  5. data/ext/xlsxwriter/extconf.rb +14 -0
  6. data/ext/xlsxwriter/format.c +67 -0
  7. data/ext/xlsxwriter/format.h +9 -0
  8. data/ext/xlsxwriter/libxlsxwriter/LICENSE.txt +89 -0
  9. data/ext/xlsxwriter/libxlsxwriter/Makefile +141 -0
  10. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +23 -0
  11. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +79 -0
  12. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +1093 -0
  13. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +336 -0
  14. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
  15. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +51 -0
  16. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
  17. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
  18. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
  19. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
  20. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
  21. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
  22. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
  23. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
  24. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
  25. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +215 -0
  26. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
  27. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
  28. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
  29. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
  30. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
  31. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +751 -0
  32. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
  33. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
  34. data/ext/xlsxwriter/libxlsxwriter/lib/.gitignore +0 -0
  35. data/ext/xlsxwriter/libxlsxwriter/src/Makefile +125 -0
  36. data/ext/xlsxwriter/libxlsxwriter/src/app.c +439 -0
  37. data/ext/xlsxwriter/libxlsxwriter/src/chart.c +3420 -0
  38. data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +341 -0
  39. data/ext/xlsxwriter/libxlsxwriter/src/core.c +293 -0
  40. data/ext/xlsxwriter/libxlsxwriter/src/custom.c +224 -0
  41. data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +746 -0
  42. data/ext/xlsxwriter/libxlsxwriter/src/format.c +728 -0
  43. data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +223 -0
  44. data/ext/xlsxwriter/libxlsxwriter/src/packager.c +877 -0
  45. data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +242 -0
  46. data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +264 -0
  47. data/ext/xlsxwriter/libxlsxwriter/src/styles.c +1086 -0
  48. data/ext/xlsxwriter/libxlsxwriter/src/theme.c +348 -0
  49. data/ext/xlsxwriter/libxlsxwriter/src/utility.c +512 -0
  50. data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +1895 -0
  51. data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +4992 -0
  52. data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +355 -0
  53. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/Makefile +44 -0
  54. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/crypt.h +131 -0
  55. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
  56. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/ioapi.h +209 -0
  57. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
  58. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
  59. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
  60. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/minizip.c +520 -0
  61. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/mztools.c +291 -0
  62. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/mztools.h +37 -0
  63. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
  64. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/unzip.h +437 -0
  65. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/zip.c +2007 -0
  66. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/zip.h +367 -0
  67. data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
  68. data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
  69. data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
  70. data/ext/xlsxwriter/workbook.c +257 -0
  71. data/ext/xlsxwriter/workbook.h +42 -0
  72. data/ext/xlsxwriter/workbook_properties.c +103 -0
  73. data/ext/xlsxwriter/workbook_properties.h +10 -0
  74. data/ext/xlsxwriter/worksheet.c +1064 -0
  75. data/ext/xlsxwriter/worksheet.h +74 -0
  76. data/ext/xlsxwriter/xlsxwriter.c +239 -0
  77. data/lib/xlsxwriter.rb +6 -0
  78. data/lib/xlsxwriter/version.rb +3 -0
  79. data/lib/xlsxwriter/worksheet.rb +72 -0
  80. data/test/run-test.rb +11 -0
  81. data/test/support/xlsx_comparable.rb +109 -0
  82. data/test/test-array-formula.rb +33 -0
  83. data/test/test-autofilter.rb +70 -0
  84. data/test/test-chart-area.rb +25 -0
  85. data/test/test-data.rb +65 -0
  86. data/test/test-default-row.rb +25 -0
  87. data/test/test-defined-name.rb +46 -0
  88. data/test/test-escapes.rb +33 -0
  89. data/test/test-fit-to-pages.rb +21 -0
  90. data/test/test-formatting.rb +137 -0
  91. data/test/test-gridlines.rb +15 -0
  92. data/test/test-hyperlink.rb +67 -0
  93. data/test/test-image.rb +84 -0
  94. data/test/test-merge-range.rb +18 -0
  95. data/test/test-misc.rb +29 -0
  96. data/test/test-optimize.rb +32 -0
  97. data/test/test-page-breaks.rb +13 -0
  98. data/test/test-page-setup.rb +28 -0
  99. data/test/test-panes.rb +45 -0
  100. data/test/test-print-area.rb +19 -0
  101. data/test/test-print-options.rb +61 -0
  102. data/test/test-print-scale.rb +12 -0
  103. data/test/test-properties.rb +51 -0
  104. data/test/test-protect.rb +27 -0
  105. data/test/test-repeat.rb +23 -0
  106. data/test/test-row-col-format.rb +35 -0
  107. data/test/test-set-selection.rb +13 -0
  108. data/test/test-set-start-page.rb +13 -0
  109. data/test/test-simple.rb +62 -0
  110. data/test/test-types.rb +17 -0
  111. data/test/xlsx-func-testcase.rb +36 -0
  112. metadata +228 -0
@@ -0,0 +1,247 @@
1
+ /* ioapi.h -- IO base function header for compress/uncompress .zip
2
+ part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
3
+
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
+ For more info read MiniZip_info.txt
10
+
11
+ */
12
+
13
+ #if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
14
+ #define _CRT_SECURE_NO_WARNINGS
15
+ #endif
16
+
17
+ #if defined(__APPLE__) || defined(IOAPI_NO_64)
18
+ // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
19
+ #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
20
+ #define FTELLO_FUNC(stream) ftello(stream)
21
+ #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
22
+ #else
23
+ #define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
24
+ #define FTELLO_FUNC(stream) ftello64(stream)
25
+ #define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
26
+ #endif
27
+
28
+
29
+ #include "ioapi.h"
30
+
31
+ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
32
+ {
33
+ if (pfilefunc->zfile_func64.zopen64_file != NULL)
34
+ return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
35
+ else
36
+ {
37
+ return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
38
+ }
39
+ }
40
+
41
+ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
42
+ {
43
+ if (pfilefunc->zfile_func64.zseek64_file != NULL)
44
+ return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
45
+ else
46
+ {
47
+ uLong offsetTruncated = (uLong)offset;
48
+ if (offsetTruncated != offset)
49
+ return -1;
50
+ else
51
+ return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
52
+ }
53
+ }
54
+
55
+ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
56
+ {
57
+ if (pfilefunc->zfile_func64.zseek64_file != NULL)
58
+ return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
59
+ else
60
+ {
61
+ uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
62
+ if ((tell_uLong) == MAXU32)
63
+ return (ZPOS64_T)-1;
64
+ else
65
+ return tell_uLong;
66
+ }
67
+ }
68
+
69
+ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
70
+ {
71
+ p_filefunc64_32->zfile_func64.zopen64_file = NULL;
72
+ p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
73
+ p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
74
+ p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
75
+ p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
76
+ p_filefunc64_32->zfile_func64.ztell64_file = NULL;
77
+ p_filefunc64_32->zfile_func64.zseek64_file = NULL;
78
+ p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
79
+ p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
80
+ p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
81
+ p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
82
+ p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
83
+ }
84
+
85
+
86
+
87
+ static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
88
+ static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
89
+ static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
90
+ static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
91
+ static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
92
+ static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
93
+ static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
94
+
95
+ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
96
+ {
97
+ FILE* file = NULL;
98
+ const char* mode_fopen = NULL;
99
+ if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
100
+ mode_fopen = "rb";
101
+ else
102
+ if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
103
+ mode_fopen = "r+b";
104
+ else
105
+ if (mode & ZLIB_FILEFUNC_MODE_CREATE)
106
+ mode_fopen = "wb";
107
+
108
+ if ((filename!=NULL) && (mode_fopen != NULL))
109
+ file = fopen(filename, mode_fopen);
110
+ return file;
111
+ }
112
+
113
+ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
114
+ {
115
+ FILE* file = NULL;
116
+ const char* mode_fopen = NULL;
117
+ if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
118
+ mode_fopen = "rb";
119
+ else
120
+ if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
121
+ mode_fopen = "r+b";
122
+ else
123
+ if (mode & ZLIB_FILEFUNC_MODE_CREATE)
124
+ mode_fopen = "wb";
125
+
126
+ if ((filename!=NULL) && (mode_fopen != NULL))
127
+ file = FOPEN_FUNC((const char*)filename, mode_fopen);
128
+ return file;
129
+ }
130
+
131
+
132
+ static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
133
+ {
134
+ uLong ret;
135
+ ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
136
+ return ret;
137
+ }
138
+
139
+ static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
140
+ {
141
+ uLong ret;
142
+ ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
143
+ return ret;
144
+ }
145
+
146
+ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
147
+ {
148
+ long ret;
149
+ ret = ftell((FILE *)stream);
150
+ return ret;
151
+ }
152
+
153
+
154
+ static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
155
+ {
156
+ ZPOS64_T ret;
157
+ ret = FTELLO_FUNC((FILE *)stream);
158
+ return ret;
159
+ }
160
+
161
+ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
162
+ {
163
+ int fseek_origin=0;
164
+ long ret;
165
+ switch (origin)
166
+ {
167
+ case ZLIB_FILEFUNC_SEEK_CUR :
168
+ fseek_origin = SEEK_CUR;
169
+ break;
170
+ case ZLIB_FILEFUNC_SEEK_END :
171
+ fseek_origin = SEEK_END;
172
+ break;
173
+ case ZLIB_FILEFUNC_SEEK_SET :
174
+ fseek_origin = SEEK_SET;
175
+ break;
176
+ default: return -1;
177
+ }
178
+ ret = 0;
179
+ if (fseek((FILE *)stream, offset, fseek_origin) != 0)
180
+ ret = -1;
181
+ return ret;
182
+ }
183
+
184
+ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
185
+ {
186
+ int fseek_origin=0;
187
+ long ret;
188
+ switch (origin)
189
+ {
190
+ case ZLIB_FILEFUNC_SEEK_CUR :
191
+ fseek_origin = SEEK_CUR;
192
+ break;
193
+ case ZLIB_FILEFUNC_SEEK_END :
194
+ fseek_origin = SEEK_END;
195
+ break;
196
+ case ZLIB_FILEFUNC_SEEK_SET :
197
+ fseek_origin = SEEK_SET;
198
+ break;
199
+ default: return -1;
200
+ }
201
+ ret = 0;
202
+
203
+ if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
204
+ ret = -1;
205
+
206
+ return ret;
207
+ }
208
+
209
+
210
+ static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
211
+ {
212
+ int ret;
213
+ ret = fclose((FILE *)stream);
214
+ return ret;
215
+ }
216
+
217
+ static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
218
+ {
219
+ int ret;
220
+ ret = ferror((FILE *)stream);
221
+ return ret;
222
+ }
223
+
224
+ void fill_fopen_filefunc (pzlib_filefunc_def)
225
+ zlib_filefunc_def* pzlib_filefunc_def;
226
+ {
227
+ pzlib_filefunc_def->zopen_file = fopen_file_func;
228
+ pzlib_filefunc_def->zread_file = fread_file_func;
229
+ pzlib_filefunc_def->zwrite_file = fwrite_file_func;
230
+ pzlib_filefunc_def->ztell_file = ftell_file_func;
231
+ pzlib_filefunc_def->zseek_file = fseek_file_func;
232
+ pzlib_filefunc_def->zclose_file = fclose_file_func;
233
+ pzlib_filefunc_def->zerror_file = ferror_file_func;
234
+ pzlib_filefunc_def->opaque = NULL;
235
+ }
236
+
237
+ void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
238
+ {
239
+ pzlib_filefunc_def->zopen64_file = fopen64_file_func;
240
+ pzlib_filefunc_def->zread_file = fread_file_func;
241
+ pzlib_filefunc_def->zwrite_file = fwrite_file_func;
242
+ pzlib_filefunc_def->ztell64_file = ftell64_file_func;
243
+ pzlib_filefunc_def->zseek64_file = fseek64_file_func;
244
+ pzlib_filefunc_def->zclose_file = fclose_file_func;
245
+ pzlib_filefunc_def->zerror_file = ferror_file_func;
246
+ pzlib_filefunc_def->opaque = NULL;
247
+ }
@@ -0,0 +1,209 @@
1
+ /* ioapi.h -- IO base function header for compress/uncompress .zip
2
+ part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
3
+
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
+ For more info read MiniZip_info.txt
10
+
11
+ Changes
12
+
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)
14
+ Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
15
+ More if/def section may be needed to support other platforms
16
+ Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
17
+ (but you should use iowin32.c for windows instead)
18
+
19
+ */
20
+
21
+ #ifndef _ZLIBIOAPI64_H
22
+ #define _ZLIBIOAPI64_H
23
+
24
+ #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
25
+
26
+ // Linux needs this to support file operation on files larger then 4+GB
27
+ // But might need better if/def to select just the platforms that needs them.
28
+
29
+ #ifndef __USE_FILE_OFFSET64
30
+ #define __USE_FILE_OFFSET64
31
+ #endif
32
+ #ifndef __USE_LARGEFILE64
33
+ #define __USE_LARGEFILE64
34
+ #endif
35
+ #ifndef _LARGEFILE64_SOURCE
36
+ #define _LARGEFILE64_SOURCE
37
+ #endif
38
+ #ifndef _FILE_OFFSET_BIT
39
+ #define _FILE_OFFSET_BIT 64
40
+ #endif
41
+
42
+ #endif
43
+
44
+ #include <stdio.h>
45
+ #include <stdlib.h>
46
+ #include "zlib.h"
47
+
48
+ #if defined(USE_FILE32API)
49
+ #define fopen64 fopen
50
+ #define ftello64 ftell
51
+ #define fseeko64 fseek
52
+ #else
53
+ #if defined(__FreeBSD__) || defined(__OpenBSD__)
54
+ #define fopen64 fopen
55
+ #define ftello64 ftello
56
+ #define fseeko64 fseeko
57
+ #endif
58
+ #ifdef _MSC_VER
59
+ #define fopen64 fopen
60
+ #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
61
+ #define ftello64 _ftelli64
62
+ #define fseeko64 _fseeki64
63
+ #else // old MSC
64
+ #define ftello64 ftell
65
+ #define fseeko64 fseek
66
+ #endif
67
+ #endif
68
+ #endif
69
+
70
+ /*
71
+ #ifndef ZPOS64_T
72
+ #ifdef _WIN32
73
+ #define ZPOS64_T fpos_t
74
+ #else
75
+ #include <stdint.h>
76
+ #define ZPOS64_T uint64_t
77
+ #endif
78
+ #endif
79
+ */
80
+
81
+ #ifdef HAVE_MINIZIP64_CONF_H
82
+ #include "mz64conf.h"
83
+ #endif
84
+
85
+ /* a type choosen by DEFINE */
86
+ #ifdef HAVE_64BIT_INT_CUSTOM
87
+ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
88
+ #else
89
+ #ifdef HAS_STDINT_H
90
+ #include "stdint.h"
91
+ typedef uint64_t ZPOS64_T;
92
+ #else
93
+
94
+ /* Maximum unsigned 32-bit value used as placeholder for zip64 */
95
+ #define MAXU32 0xffffffff
96
+
97
+ #if defined(_MSC_VER) || defined(__BORLANDC__)
98
+ typedef unsigned __int64 ZPOS64_T;
99
+ #else
100
+ typedef unsigned long long int ZPOS64_T;
101
+ #endif
102
+ #endif
103
+ #endif
104
+
105
+
106
+
107
+ #ifdef __cplusplus
108
+ extern "C" {
109
+ #endif
110
+
111
+
112
+ #define ZLIB_FILEFUNC_SEEK_CUR (1)
113
+ #define ZLIB_FILEFUNC_SEEK_END (2)
114
+ #define ZLIB_FILEFUNC_SEEK_SET (0)
115
+
116
+ #define ZLIB_FILEFUNC_MODE_READ (1)
117
+ #define ZLIB_FILEFUNC_MODE_WRITE (2)
118
+ #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
119
+
120
+ #define ZLIB_FILEFUNC_MODE_EXISTING (4)
121
+ #define ZLIB_FILEFUNC_MODE_CREATE (8)
122
+
123
+
124
+ #ifndef ZCALLBACK
125
+ #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
126
+ #define ZCALLBACK CALLBACK
127
+ #else
128
+ #define ZCALLBACK
129
+ #endif
130
+ #endif
131
+
132
+ #ifndef OF
133
+ #define OF(args) args
134
+ #endif
135
+
136
+ typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
137
+ typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
138
+ typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
139
+ typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
140
+ typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
141
+
142
+ typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
143
+ typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
144
+
145
+
146
+ /* here is the "old" 32 bits structure structure */
147
+ typedef struct zlib_filefunc_def_s
148
+ {
149
+ open_file_func zopen_file;
150
+ read_file_func zread_file;
151
+ write_file_func zwrite_file;
152
+ tell_file_func ztell_file;
153
+ seek_file_func zseek_file;
154
+ close_file_func zclose_file;
155
+ testerror_file_func zerror_file;
156
+ voidpf opaque;
157
+ } zlib_filefunc_def;
158
+
159
+ typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
160
+ typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
161
+ typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
162
+
163
+ typedef struct zlib_filefunc64_def_s
164
+ {
165
+ open64_file_func zopen64_file;
166
+ read_file_func zread_file;
167
+ write_file_func zwrite_file;
168
+ tell64_file_func ztell64_file;
169
+ seek64_file_func zseek64_file;
170
+ close_file_func zclose_file;
171
+ testerror_file_func zerror_file;
172
+ voidpf opaque;
173
+ } zlib_filefunc64_def;
174
+
175
+ void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
176
+ void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
177
+
178
+ /* now internal definition, only for zip.c and unzip.h */
179
+ typedef struct zlib_filefunc64_32_def_s
180
+ {
181
+ zlib_filefunc64_def zfile_func64;
182
+ open_file_func zopen32_file;
183
+ tell_file_func ztell32_file;
184
+ seek_file_func zseek32_file;
185
+ } zlib_filefunc64_32_def;
186
+
187
+
188
+ #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
189
+ #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
190
+ /* #define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) */
191
+ /* #define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) */
192
+ #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
193
+ #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
194
+
195
+ voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
196
+ long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
197
+ ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
198
+
199
+ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
200
+
201
+ #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
202
+ #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
203
+ #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
204
+
205
+ #ifdef __cplusplus
206
+ }
207
+ #endif
208
+
209
+ #endif