fast_excel 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +5 -2
- data/Makefile +14 -0
- data/README.md +7 -2
- data/Rakefile +10 -0
- data/extconf.rb +0 -0
- data/fast_excel.gemspec +3 -1
- data/lib/fast_excel/binding.rb +3 -7
- data/lib/rubygems_plugin.rb +3 -0
- data/libxlsxwriter/.gitignore +49 -0
- data/libxlsxwriter/.indent.pro +125 -0
- data/libxlsxwriter/.travis.yml +25 -0
- data/libxlsxwriter/CONTRIBUTING.md +226 -0
- data/libxlsxwriter/Changes.txt +557 -0
- data/libxlsxwriter/LICENSE.txt +89 -0
- data/libxlsxwriter/Makefile +156 -0
- data/libxlsxwriter/Readme.md +78 -0
- data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +30 -0
- data/libxlsxwriter/cocoapods/libxlsxwriter.modulemap +7 -0
- data/libxlsxwriter/include/xlsxwriter/app.h +79 -0
- data/libxlsxwriter/include/xlsxwriter/chart.h +3476 -0
- data/libxlsxwriter/include/xlsxwriter/common.h +372 -0
- data/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
- data/libxlsxwriter/include/xlsxwriter/core.h +51 -0
- data/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
- data/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
- data/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
- data/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
- data/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
- data/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
- data/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
- data/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
- data/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +214 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
- data/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
- data/libxlsxwriter/include/xlsxwriter/workbook.h +757 -0
- data/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
- data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
- data/libxlsxwriter/include/xlsxwriter.h +23 -0
- data/libxlsxwriter/lib/.gitignore +0 -0
- data/libxlsxwriter/libxlsxwriter.podspec +47 -0
- data/libxlsxwriter/src/Makefile +130 -0
- data/libxlsxwriter/src/app.c +443 -0
- data/libxlsxwriter/src/chart.c +6346 -0
- data/libxlsxwriter/src/content_types.c +345 -0
- data/libxlsxwriter/src/core.c +293 -0
- data/libxlsxwriter/src/custom.c +224 -0
- data/libxlsxwriter/src/drawing.c +746 -0
- data/libxlsxwriter/src/format.c +729 -0
- data/libxlsxwriter/src/hash_table.c +223 -0
- data/libxlsxwriter/src/packager.c +948 -0
- data/libxlsxwriter/src/relationships.c +245 -0
- data/libxlsxwriter/src/shared_strings.c +266 -0
- data/libxlsxwriter/src/styles.c +1088 -0
- data/libxlsxwriter/src/theme.c +348 -0
- data/libxlsxwriter/src/utility.c +515 -0
- data/libxlsxwriter/src/workbook.c +1930 -0
- data/libxlsxwriter/src/worksheet.c +5022 -0
- data/libxlsxwriter/src/xmlwriter.c +355 -0
- data/libxlsxwriter/third_party/minizip/Makefile +44 -0
- data/libxlsxwriter/third_party/minizip/Makefile.am +45 -0
- data/libxlsxwriter/third_party/minizip/Makefile.orig +25 -0
- data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +6 -0
- data/libxlsxwriter/third_party/minizip/MiniZip64_info.txt +74 -0
- data/libxlsxwriter/third_party/minizip/README.txt +5 -0
- data/libxlsxwriter/third_party/minizip/configure.ac +32 -0
- data/libxlsxwriter/third_party/minizip/crypt.h +131 -0
- data/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
- data/libxlsxwriter/third_party/minizip/ioapi.h +208 -0
- data/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
- data/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
- data/libxlsxwriter/third_party/minizip/make_vms.com +25 -0
- data/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
- data/libxlsxwriter/third_party/minizip/miniunzip.1 +63 -0
- data/libxlsxwriter/third_party/minizip/minizip.1 +46 -0
- data/libxlsxwriter/third_party/minizip/minizip.c +520 -0
- data/libxlsxwriter/third_party/minizip/minizip.pc.in +12 -0
- data/libxlsxwriter/third_party/minizip/mztools.c +291 -0
- data/libxlsxwriter/third_party/minizip/mztools.h +37 -0
- data/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
- data/libxlsxwriter/third_party/minizip/unzip.h +437 -0
- data/libxlsxwriter/third_party/minizip/zip.c +2007 -0
- data/libxlsxwriter/third_party/minizip/zip.h +367 -0
- data/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
- data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
- data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
- data/libxlsxwriter/version.txt +1 -0
- metadata +89 -6
- data/binaries/libxlsxwriter-alpine.so +0 -0
- data/binaries/libxlsxwriter-darwin.dylib +0 -0
- data/binaries/libxlsxwriter-glibc.so +0 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
* xmlwriter - A base library for libxlsxwriter libraries.
|
|
3
|
+
*
|
|
4
|
+
* Used in conjunction with the libxlsxwriter library.
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include <stdio.h>
|
|
11
|
+
#include <string.h>
|
|
12
|
+
#include <stdlib.h>
|
|
13
|
+
#include "xlsxwriter/xmlwriter.h"
|
|
14
|
+
|
|
15
|
+
#define LXW_AMP "&"
|
|
16
|
+
#define LXW_LT "<"
|
|
17
|
+
#define LXW_GT ">"
|
|
18
|
+
#define LXW_QUOT """
|
|
19
|
+
|
|
20
|
+
/* Defines. */
|
|
21
|
+
#define LXW_MAX_ENCODED_ATTRIBUTE_LENGTH (LXW_MAX_ATTRIBUTE_LENGTH*6)
|
|
22
|
+
|
|
23
|
+
/* Forward declarations. */
|
|
24
|
+
STATIC char *_escape_attributes(struct xml_attribute *attribute);
|
|
25
|
+
|
|
26
|
+
char *lxw_escape_data(const char *data);
|
|
27
|
+
|
|
28
|
+
STATIC void _fprint_escaped_attributes(FILE * xmlfile,
|
|
29
|
+
struct xml_attribute_list *attributes);
|
|
30
|
+
|
|
31
|
+
STATIC void _fprint_escaped_data(FILE * xmlfile, const char *data);
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* Write the XML declaration.
|
|
35
|
+
*/
|
|
36
|
+
void
|
|
37
|
+
lxw_xml_declaration(FILE * xmlfile)
|
|
38
|
+
{
|
|
39
|
+
fprintf(xmlfile, "<?xml version=\"1.0\" "
|
|
40
|
+
"encoding=\"UTF-8\" standalone=\"yes\"?>\n");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Write an XML start tag with optional attributes.
|
|
45
|
+
*/
|
|
46
|
+
void
|
|
47
|
+
lxw_xml_start_tag(FILE * xmlfile,
|
|
48
|
+
const char *tag, struct xml_attribute_list *attributes)
|
|
49
|
+
{
|
|
50
|
+
fprintf(xmlfile, "<%s", tag);
|
|
51
|
+
|
|
52
|
+
_fprint_escaped_attributes(xmlfile, attributes);
|
|
53
|
+
|
|
54
|
+
fprintf(xmlfile, ">");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* Write an XML start tag with optional, unencoded, attributes.
|
|
59
|
+
* This is a minor speed optimization for elements that don't need encoding.
|
|
60
|
+
*/
|
|
61
|
+
void
|
|
62
|
+
lxw_xml_start_tag_unencoded(FILE * xmlfile,
|
|
63
|
+
const char *tag,
|
|
64
|
+
struct xml_attribute_list *attributes)
|
|
65
|
+
{
|
|
66
|
+
struct xml_attribute *attribute;
|
|
67
|
+
|
|
68
|
+
fprintf(xmlfile, "<%s", tag);
|
|
69
|
+
|
|
70
|
+
if (attributes) {
|
|
71
|
+
STAILQ_FOREACH(attribute, attributes, list_entries) {
|
|
72
|
+
fprintf(xmlfile, " %s=\"%s\"", attribute->key, attribute->value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
fprintf(xmlfile, ">");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* Write an XML end tag.
|
|
81
|
+
*/
|
|
82
|
+
void
|
|
83
|
+
lxw_xml_end_tag(FILE * xmlfile, const char *tag)
|
|
84
|
+
{
|
|
85
|
+
fprintf(xmlfile, "</%s>", tag);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
* Write an empty XML tag with optional attributes.
|
|
90
|
+
*/
|
|
91
|
+
void
|
|
92
|
+
lxw_xml_empty_tag(FILE * xmlfile,
|
|
93
|
+
const char *tag, struct xml_attribute_list *attributes)
|
|
94
|
+
{
|
|
95
|
+
fprintf(xmlfile, "<%s", tag);
|
|
96
|
+
|
|
97
|
+
_fprint_escaped_attributes(xmlfile, attributes);
|
|
98
|
+
|
|
99
|
+
fprintf(xmlfile, "/>");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* Write an XML start tag with optional, unencoded, attributes.
|
|
104
|
+
* This is a minor speed optimization for elements that don't need encoding.
|
|
105
|
+
*/
|
|
106
|
+
void
|
|
107
|
+
lxw_xml_empty_tag_unencoded(FILE * xmlfile,
|
|
108
|
+
const char *tag,
|
|
109
|
+
struct xml_attribute_list *attributes)
|
|
110
|
+
{
|
|
111
|
+
struct xml_attribute *attribute;
|
|
112
|
+
|
|
113
|
+
fprintf(xmlfile, "<%s", tag);
|
|
114
|
+
|
|
115
|
+
if (attributes) {
|
|
116
|
+
STAILQ_FOREACH(attribute, attributes, list_entries) {
|
|
117
|
+
fprintf(xmlfile, " %s=\"%s\"", attribute->key, attribute->value);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
fprintf(xmlfile, "/>");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/*
|
|
125
|
+
* Write an XML element containing data with optional attributes.
|
|
126
|
+
*/
|
|
127
|
+
void
|
|
128
|
+
lxw_xml_data_element(FILE * xmlfile,
|
|
129
|
+
const char *tag,
|
|
130
|
+
const char *data, struct xml_attribute_list *attributes)
|
|
131
|
+
{
|
|
132
|
+
fprintf(xmlfile, "<%s", tag);
|
|
133
|
+
|
|
134
|
+
_fprint_escaped_attributes(xmlfile, attributes);
|
|
135
|
+
|
|
136
|
+
fprintf(xmlfile, ">");
|
|
137
|
+
|
|
138
|
+
_fprint_escaped_data(xmlfile, data);
|
|
139
|
+
|
|
140
|
+
fprintf(xmlfile, "</%s>", tag);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/*
|
|
144
|
+
* Escape XML characters in attributes.
|
|
145
|
+
*/
|
|
146
|
+
STATIC char *
|
|
147
|
+
_escape_attributes(struct xml_attribute *attribute)
|
|
148
|
+
{
|
|
149
|
+
char *encoded = (char *) calloc(LXW_MAX_ENCODED_ATTRIBUTE_LENGTH, 1);
|
|
150
|
+
char *p_encoded = encoded;
|
|
151
|
+
char *p_attr = attribute->value;
|
|
152
|
+
|
|
153
|
+
while (*p_attr) {
|
|
154
|
+
switch (*p_attr) {
|
|
155
|
+
case '&':
|
|
156
|
+
strncat(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
|
|
157
|
+
p_encoded += sizeof(LXW_AMP) - 1;
|
|
158
|
+
break;
|
|
159
|
+
case '<':
|
|
160
|
+
strncat(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
|
|
161
|
+
p_encoded += sizeof(LXW_LT) - 1;
|
|
162
|
+
break;
|
|
163
|
+
case '>':
|
|
164
|
+
strncat(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
|
|
165
|
+
p_encoded += sizeof(LXW_GT) - 1;
|
|
166
|
+
break;
|
|
167
|
+
case '"':
|
|
168
|
+
strncat(p_encoded, LXW_QUOT, sizeof(LXW_QUOT) - 1);
|
|
169
|
+
p_encoded += sizeof(LXW_QUOT) - 1;
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
*p_encoded = *p_attr;
|
|
173
|
+
p_encoded++;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
p_attr++;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return encoded;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/*
|
|
183
|
+
* Escape XML characters in data sections of tags.
|
|
184
|
+
* Note, this is different from _escape_attributes()
|
|
185
|
+
* in that double quotes are not escaped by Excel.
|
|
186
|
+
*/
|
|
187
|
+
char *
|
|
188
|
+
lxw_escape_data(const char *data)
|
|
189
|
+
{
|
|
190
|
+
size_t encoded_len = (strlen(data) * 5 + 1);
|
|
191
|
+
|
|
192
|
+
char *encoded = (char *) calloc(encoded_len, 1);
|
|
193
|
+
char *p_encoded = encoded;
|
|
194
|
+
|
|
195
|
+
while (*data) {
|
|
196
|
+
switch (*data) {
|
|
197
|
+
case '&':
|
|
198
|
+
strncat(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
|
|
199
|
+
p_encoded += sizeof(LXW_AMP) - 1;
|
|
200
|
+
break;
|
|
201
|
+
case '<':
|
|
202
|
+
strncat(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
|
|
203
|
+
p_encoded += sizeof(LXW_LT) - 1;
|
|
204
|
+
break;
|
|
205
|
+
case '>':
|
|
206
|
+
strncat(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
|
|
207
|
+
p_encoded += sizeof(LXW_GT) - 1;
|
|
208
|
+
break;
|
|
209
|
+
default:
|
|
210
|
+
*p_encoded = *data;
|
|
211
|
+
p_encoded++;
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
data++;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return encoded;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/*
|
|
221
|
+
* Escape control characters in strings with with _xHHHH_.
|
|
222
|
+
*/
|
|
223
|
+
char *
|
|
224
|
+
lxw_escape_control_characters(const char *string)
|
|
225
|
+
{
|
|
226
|
+
size_t escape_len = sizeof("_xHHHH_") - 1;
|
|
227
|
+
size_t encoded_len = (strlen(string) * escape_len + 1);
|
|
228
|
+
|
|
229
|
+
char *encoded = (char *) calloc(encoded_len, 1);
|
|
230
|
+
char *p_encoded = encoded;
|
|
231
|
+
|
|
232
|
+
while (*string) {
|
|
233
|
+
switch (*string) {
|
|
234
|
+
case '\x01':
|
|
235
|
+
case '\x02':
|
|
236
|
+
case '\x03':
|
|
237
|
+
case '\x04':
|
|
238
|
+
case '\x05':
|
|
239
|
+
case '\x06':
|
|
240
|
+
case '\x07':
|
|
241
|
+
case '\x08':
|
|
242
|
+
case '\x0B':
|
|
243
|
+
case '\x0C':
|
|
244
|
+
case '\x0D':
|
|
245
|
+
case '\x0E':
|
|
246
|
+
case '\x0F':
|
|
247
|
+
case '\x10':
|
|
248
|
+
case '\x11':
|
|
249
|
+
case '\x12':
|
|
250
|
+
case '\x13':
|
|
251
|
+
case '\x14':
|
|
252
|
+
case '\x15':
|
|
253
|
+
case '\x16':
|
|
254
|
+
case '\x17':
|
|
255
|
+
case '\x18':
|
|
256
|
+
case '\x19':
|
|
257
|
+
case '\x1A':
|
|
258
|
+
case '\x1B':
|
|
259
|
+
case '\x1C':
|
|
260
|
+
case '\x1D':
|
|
261
|
+
case '\x1E':
|
|
262
|
+
case '\x1F':
|
|
263
|
+
lxw_snprintf(p_encoded, escape_len + 1, "_x%04X_", *string);
|
|
264
|
+
p_encoded += escape_len;
|
|
265
|
+
break;
|
|
266
|
+
default:
|
|
267
|
+
*p_encoded = *string;
|
|
268
|
+
p_encoded++;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
string++;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return encoded;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Write out escaped attributes. */
|
|
278
|
+
STATIC void
|
|
279
|
+
_fprint_escaped_attributes(FILE * xmlfile,
|
|
280
|
+
struct xml_attribute_list *attributes)
|
|
281
|
+
{
|
|
282
|
+
struct xml_attribute *attribute;
|
|
283
|
+
|
|
284
|
+
if (attributes) {
|
|
285
|
+
STAILQ_FOREACH(attribute, attributes, list_entries) {
|
|
286
|
+
fprintf(xmlfile, " %s=", attribute->key);
|
|
287
|
+
|
|
288
|
+
if (!strpbrk(attribute->value, "&<>\"")) {
|
|
289
|
+
fprintf(xmlfile, "\"%s\"", attribute->value);
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
char *encoded = _escape_attributes(attribute);
|
|
293
|
+
|
|
294
|
+
if (encoded) {
|
|
295
|
+
fprintf(xmlfile, "\"%s\"", encoded);
|
|
296
|
+
|
|
297
|
+
free(encoded);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/* Write out escaped XML data. */
|
|
305
|
+
STATIC void
|
|
306
|
+
_fprint_escaped_data(FILE * xmlfile, const char *data)
|
|
307
|
+
{
|
|
308
|
+
/* Escape the data section of the XML element. */
|
|
309
|
+
if (!strpbrk(data, "&<>")) {
|
|
310
|
+
fprintf(xmlfile, "%s", data);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
char *encoded = lxw_escape_data(data);
|
|
314
|
+
if (encoded) {
|
|
315
|
+
fprintf(xmlfile, "%s", encoded);
|
|
316
|
+
free(encoded);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* Create a new string XML attribute. */
|
|
322
|
+
struct xml_attribute *
|
|
323
|
+
lxw_new_attribute_str(const char *key, const char *value)
|
|
324
|
+
{
|
|
325
|
+
struct xml_attribute *attribute = malloc(sizeof(struct xml_attribute));
|
|
326
|
+
|
|
327
|
+
LXW_ATTRIBUTE_COPY(attribute->key, key);
|
|
328
|
+
LXW_ATTRIBUTE_COPY(attribute->value, value);
|
|
329
|
+
|
|
330
|
+
return attribute;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/* Create a new integer XML attribute. */
|
|
334
|
+
struct xml_attribute *
|
|
335
|
+
lxw_new_attribute_int(const char *key, uint32_t value)
|
|
336
|
+
{
|
|
337
|
+
struct xml_attribute *attribute = malloc(sizeof(struct xml_attribute));
|
|
338
|
+
|
|
339
|
+
LXW_ATTRIBUTE_COPY(attribute->key, key);
|
|
340
|
+
lxw_snprintf(attribute->value, LXW_MAX_ATTRIBUTE_LENGTH, "%d", value);
|
|
341
|
+
|
|
342
|
+
return attribute;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/* Create a new double XML attribute. */
|
|
346
|
+
struct xml_attribute *
|
|
347
|
+
lxw_new_attribute_dbl(const char *key, double value)
|
|
348
|
+
{
|
|
349
|
+
struct xml_attribute *attribute = malloc(sizeof(struct xml_attribute));
|
|
350
|
+
|
|
351
|
+
LXW_ATTRIBUTE_COPY(attribute->key, key);
|
|
352
|
+
lxw_snprintf(attribute->value, LXW_MAX_ATTRIBUTE_LENGTH, "%.16g", value);
|
|
353
|
+
|
|
354
|
+
return attribute;
|
|
355
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# Simplied Makefile to build the minizip objects for the libxlsxwriter library.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
# Keep the output quiet by default.
|
|
7
|
+
Q=@
|
|
8
|
+
ifdef V
|
|
9
|
+
Q=
|
|
10
|
+
endif
|
|
11
|
+
|
|
12
|
+
UNAME := $(shell uname)
|
|
13
|
+
|
|
14
|
+
# Check for MinGW/MinGW64/Cygwin environments.
|
|
15
|
+
ifneq (,$(findstring MINGW, $(UNAME)))
|
|
16
|
+
MING_LIKE = y
|
|
17
|
+
endif
|
|
18
|
+
ifneq (,$(findstring MSYS, $(UNAME)))
|
|
19
|
+
MING_LIKE = y
|
|
20
|
+
endif
|
|
21
|
+
ifneq (,$(findstring CYGWIN, $(UNAME)))
|
|
22
|
+
MING_LIKE = y
|
|
23
|
+
endif
|
|
24
|
+
|
|
25
|
+
FPIC = -fPIC
|
|
26
|
+
CFLAGS += -O3 -DNOCRYPT -DNOUNCRYPT
|
|
27
|
+
|
|
28
|
+
# Change make options on MinGW/MinGW64/Cygwin.
|
|
29
|
+
ifdef MING_LIKE
|
|
30
|
+
FPIC =
|
|
31
|
+
CC = gcc
|
|
32
|
+
CFLAGS += -DUSE_FILE32API
|
|
33
|
+
endif
|
|
34
|
+
|
|
35
|
+
all: ioapi.o zip.o ioapi.so zip.so
|
|
36
|
+
|
|
37
|
+
%.o : %.c
|
|
38
|
+
$(Q)$(CC) -c $(CFLAGS) $<
|
|
39
|
+
|
|
40
|
+
%.so : %.c
|
|
41
|
+
$(Q)$(CC) $(FPIC) -c $(CFLAGS) $< -o $@
|
|
42
|
+
|
|
43
|
+
clean:
|
|
44
|
+
$(Q)/bin/rm -f *.o *.so
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
lib_LTLIBRARIES = libminizip.la
|
|
2
|
+
|
|
3
|
+
if COND_DEMOS
|
|
4
|
+
bin_PROGRAMS = miniunzip minizip
|
|
5
|
+
endif
|
|
6
|
+
|
|
7
|
+
zlib_top_srcdir = $(top_srcdir)/../..
|
|
8
|
+
zlib_top_builddir = $(top_builddir)/../..
|
|
9
|
+
|
|
10
|
+
AM_CPPFLAGS = -I$(zlib_top_srcdir)
|
|
11
|
+
AM_LDFLAGS = -L$(zlib_top_builddir)
|
|
12
|
+
|
|
13
|
+
if WIN32
|
|
14
|
+
iowin32_src = iowin32.c
|
|
15
|
+
iowin32_h = iowin32.h
|
|
16
|
+
endif
|
|
17
|
+
|
|
18
|
+
libminizip_la_SOURCES = \
|
|
19
|
+
ioapi.c \
|
|
20
|
+
mztools.c \
|
|
21
|
+
unzip.c \
|
|
22
|
+
zip.c \
|
|
23
|
+
${iowin32_src}
|
|
24
|
+
|
|
25
|
+
libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
|
|
26
|
+
|
|
27
|
+
minizip_includedir = $(includedir)/minizip
|
|
28
|
+
minizip_include_HEADERS = \
|
|
29
|
+
crypt.h \
|
|
30
|
+
ioapi.h \
|
|
31
|
+
mztools.h \
|
|
32
|
+
unzip.h \
|
|
33
|
+
zip.h \
|
|
34
|
+
${iowin32_h}
|
|
35
|
+
|
|
36
|
+
pkgconfigdir = $(libdir)/pkgconfig
|
|
37
|
+
pkgconfig_DATA = minizip.pc
|
|
38
|
+
|
|
39
|
+
EXTRA_PROGRAMS = miniunzip minizip
|
|
40
|
+
|
|
41
|
+
miniunzip_SOURCES = miniunz.c
|
|
42
|
+
miniunzip_LDADD = libminizip.la
|
|
43
|
+
|
|
44
|
+
minizip_SOURCES = minizip.c
|
|
45
|
+
minizip_LDADD = libminizip.la -lz
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
CC=cc
|
|
2
|
+
CFLAGS=-O -I../..
|
|
3
|
+
|
|
4
|
+
UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
|
|
5
|
+
ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
|
|
6
|
+
|
|
7
|
+
.c.o:
|
|
8
|
+
$(CC) -c $(CFLAGS) $*.c
|
|
9
|
+
|
|
10
|
+
all: miniunz minizip
|
|
11
|
+
|
|
12
|
+
miniunz: $(UNZ_OBJS)
|
|
13
|
+
$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
|
|
14
|
+
|
|
15
|
+
minizip: $(ZIP_OBJS)
|
|
16
|
+
$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
|
|
17
|
+
|
|
18
|
+
test: miniunz minizip
|
|
19
|
+
./minizip test readme.txt
|
|
20
|
+
./miniunz -l test.zip
|
|
21
|
+
mv readme.txt readme.old
|
|
22
|
+
./miniunz test.zip
|
|
23
|
+
|
|
24
|
+
clean:
|
|
25
|
+
/bin/rm -f *.o *~ minizip miniunz
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson
|
|
2
|
+
|
|
3
|
+
Introduction
|
|
4
|
+
---------------------
|
|
5
|
+
MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html )
|
|
6
|
+
|
|
7
|
+
When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0.
|
|
8
|
+
All possible work was done for compatibility.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Background
|
|
12
|
+
---------------------
|
|
13
|
+
When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64
|
|
14
|
+
support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ )
|
|
15
|
+
|
|
16
|
+
That was used as a starting point. And after that ZIP64 support was added to zip.c
|
|
17
|
+
some refactoring and code cleanup was also done.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Changed from MiniZip 1.0 to MiniZip 1.1
|
|
21
|
+
---------------------------------------
|
|
22
|
+
* Added ZIP64 support for unzip ( by Even Rouault )
|
|
23
|
+
* Added ZIP64 support for zip ( by Mathias Svensson )
|
|
24
|
+
* Reverted some changed that Even Rouault did.
|
|
25
|
+
* Bunch of patches received from Gulles Vollant that he received for MiniZip from various users.
|
|
26
|
+
* Added unzip patch for BZIP Compression method (patch create by Daniel Borca)
|
|
27
|
+
* Added BZIP Compress method for zip
|
|
28
|
+
* Did some refactoring and code cleanup
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Credits
|
|
32
|
+
|
|
33
|
+
Gilles Vollant - Original MiniZip author
|
|
34
|
+
Even Rouault - ZIP64 unzip Support
|
|
35
|
+
Daniel Borca - BZip Compression method support in unzip
|
|
36
|
+
Mathias Svensson - ZIP64 zip support
|
|
37
|
+
Mathias Svensson - BZip Compression method support in zip
|
|
38
|
+
|
|
39
|
+
Resources
|
|
40
|
+
|
|
41
|
+
ZipLayout http://result42.com/projects/ZipFileLayout
|
|
42
|
+
Command line tool for Windows that shows the layout and information of the headers in a zip archive.
|
|
43
|
+
Used when debugging and validating the creation of zip files using MiniZip64
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT
|
|
47
|
+
Zip File specification
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Notes.
|
|
51
|
+
* To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined.
|
|
52
|
+
|
|
53
|
+
License
|
|
54
|
+
----------------------------------------------------------
|
|
55
|
+
Condition of use and distribution are the same than zlib :
|
|
56
|
+
|
|
57
|
+
This software is provided 'as-is', without any express or implied
|
|
58
|
+
warranty. In no event will the authors be held liable for any damages
|
|
59
|
+
arising from the use of this software.
|
|
60
|
+
|
|
61
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
62
|
+
including commercial applications, and to alter it and redistribute it
|
|
63
|
+
freely, subject to the following restrictions:
|
|
64
|
+
|
|
65
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
66
|
+
claim that you wrote the original software. If you use this software
|
|
67
|
+
in a product, an acknowledgment in the product documentation would be
|
|
68
|
+
appreciated but is not required.
|
|
69
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
70
|
+
misrepresented as being the original software.
|
|
71
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
72
|
+
|
|
73
|
+
----------------------------------------------------------
|
|
74
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# -*- Autoconf -*-
|
|
2
|
+
# Process this file with autoconf to produce a configure script.
|
|
3
|
+
|
|
4
|
+
AC_INIT([minizip], [1.2.8], [bugzilla.redhat.com])
|
|
5
|
+
AC_CONFIG_SRCDIR([minizip.c])
|
|
6
|
+
AM_INIT_AUTOMAKE([foreign])
|
|
7
|
+
LT_INIT
|
|
8
|
+
|
|
9
|
+
AC_MSG_CHECKING([whether to build example programs])
|
|
10
|
+
AC_ARG_ENABLE([demos], AC_HELP_STRING([--enable-demos], [build example programs]))
|
|
11
|
+
AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes])
|
|
12
|
+
if test "$enable_demos" = yes
|
|
13
|
+
then
|
|
14
|
+
AC_MSG_RESULT([yes])
|
|
15
|
+
else
|
|
16
|
+
AC_MSG_RESULT([no])
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
case "${host}" in
|
|
20
|
+
*-mingw* | mingw*)
|
|
21
|
+
WIN32="yes"
|
|
22
|
+
;;
|
|
23
|
+
*)
|
|
24
|
+
;;
|
|
25
|
+
esac
|
|
26
|
+
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
AC_SUBST([HAVE_UNISTD_H], [0])
|
|
30
|
+
AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], [])
|
|
31
|
+
AC_CONFIG_FILES([Makefile minizip.pc])
|
|
32
|
+
AC_OUTPUT
|