libarchive-static 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/ext/Makefile +6 -0
  2. data/ext/extconf.rb +61 -0
  3. data/ext/libarchive-0.1.1/COPYING.libarchive +60 -0
  4. data/ext/libarchive-0.1.1/LICENSE.libbzip2 +42 -0
  5. data/ext/libarchive-0.1.1/README.txt +143 -0
  6. data/ext/libarchive-0.1.1/ext/Makefile.in +0 -0
  7. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +31 -0
  8. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.h +6 -0
  9. data/ext/libarchive-0.1.1/ext/archive_read_support_format.c +32 -0
  10. data/ext/libarchive-0.1.1/ext/archive_read_support_format.h +6 -0
  11. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +29 -0
  12. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.h +6 -0
  13. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +32 -0
  14. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.h +6 -0
  15. data/ext/libarchive-0.1.1/ext/config.h.in +22 -0
  16. data/ext/libarchive-0.1.1/ext/configure +3904 -0
  17. data/ext/libarchive-0.1.1/ext/configure.in +11 -0
  18. data/ext/libarchive-0.1.1/ext/depend +19 -0
  19. data/ext/libarchive-0.1.1/ext/extconf.rb +6 -0
  20. data/ext/libarchive-0.1.1/ext/install-sh +250 -0
  21. data/ext/libarchive-0.1.1/ext/libarchive.c +89 -0
  22. data/ext/libarchive-0.1.1/ext/libarchive_archive.c +84 -0
  23. data/ext/libarchive-0.1.1/ext/libarchive_entry.c +1015 -0
  24. data/ext/libarchive-0.1.1/ext/libarchive_internal.h +155 -0
  25. data/ext/libarchive-0.1.1/ext/libarchive_reader.c +328 -0
  26. data/ext/libarchive-0.1.1/ext/libarchive_win32.h +52 -0
  27. data/ext/libarchive-0.1.1/ext/libarchive_writer.c +246 -0
  28. data/ext/libarchive-0.1.1/libarchive.c +1762 -0
  29. data/ext/libarchive-2.8.4/Makefile.in +7076 -0
  30. data/ext/libarchive-2.8.4/build/autoconf/check_stdcall_func.m4 +51 -0
  31. data/ext/libarchive-2.8.4/build/autoconf/compile +143 -0
  32. data/ext/libarchive-2.8.4/build/autoconf/config.guess +1502 -0
  33. data/ext/libarchive-2.8.4/build/autoconf/config.sub +1708 -0
  34. data/ext/libarchive-2.8.4/build/autoconf/depcomp +630 -0
  35. data/ext/libarchive-2.8.4/build/autoconf/install-sh +291 -0
  36. data/ext/libarchive-2.8.4/build/autoconf/la_uid_t.m4 +20 -0
  37. data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +8406 -0
  38. data/ext/libarchive-2.8.4/build/autoconf/missing +376 -0
  39. data/ext/libarchive-2.8.4/build/pkgconfig/libarchive.pc.in +10 -0
  40. data/ext/libarchive-2.8.4/config.h.in +772 -0
  41. data/ext/libarchive-2.8.4/configure +17916 -0
  42. data/ext/libarchive-2.8.4/libarchive/archive.h +741 -0
  43. data/ext/libarchive-2.8.4/libarchive/archive_check_magic.c +134 -0
  44. data/ext/libarchive-2.8.4/libarchive/archive_crc32.h +66 -0
  45. data/ext/libarchive-2.8.4/libarchive/archive_endian.h +162 -0
  46. data/ext/libarchive-2.8.4/libarchive/archive_entry.c +2202 -0
  47. data/ext/libarchive-2.8.4/libarchive/archive_entry.h +524 -0
  48. data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_bhfi.c +74 -0
  49. data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_stat.c +77 -0
  50. data/ext/libarchive-2.8.4/libarchive/archive_entry_link_resolver.c +405 -0
  51. data/ext/libarchive-2.8.4/libarchive/archive_entry_private.h +184 -0
  52. data/ext/libarchive-2.8.4/libarchive/archive_entry_stat.c +118 -0
  53. data/ext/libarchive-2.8.4/libarchive/archive_entry_strmode.c +87 -0
  54. data/ext/libarchive-2.8.4/libarchive/archive_entry_xattr.c +158 -0
  55. data/ext/libarchive-2.8.4/libarchive/archive_hash.h +281 -0
  56. data/ext/libarchive-2.8.4/libarchive/archive_platform.h +165 -0
  57. data/ext/libarchive-2.8.4/libarchive/archive_private.h +124 -0
  58. data/ext/libarchive-2.8.4/libarchive/archive_read.c +1249 -0
  59. data/ext/libarchive-2.8.4/libarchive/archive_read_data_into_fd.c +93 -0
  60. data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +198 -0
  61. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +570 -0
  62. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_private.h +62 -0
  63. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_set_standard_lookup.c +303 -0
  64. data/ext/libarchive-2.8.4/libarchive/archive_read_extract.c +182 -0
  65. data/ext/libarchive-2.8.4/libarchive/archive_read_open_fd.c +190 -0
  66. data/ext/libarchive-2.8.4/libarchive/archive_read_open_file.c +165 -0
  67. data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +272 -0
  68. data/ext/libarchive-2.8.4/libarchive/archive_read_open_memory.c +156 -0
  69. data/ext/libarchive-2.8.4/libarchive/archive_read_private.h +199 -0
  70. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_all.c +60 -0
  71. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c +353 -0
  72. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c +444 -0
  73. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c +465 -0
  74. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_none.c +40 -0
  75. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_program.c +459 -0
  76. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c +287 -0
  77. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c +627 -0
  78. data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c +708 -0
  79. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_all.c +43 -0
  80. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_ar.c +584 -0
  81. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +777 -0
  82. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_empty.c +93 -0
  83. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_iso9660.c +2830 -0
  84. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +1304 -0
  85. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_raw.c +185 -0
  86. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_tar.c +2418 -0
  87. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_xar.c +3151 -0
  88. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +903 -0
  89. data/ext/libarchive-2.8.4/libarchive/archive_string.c +453 -0
  90. data/ext/libarchive-2.8.4/libarchive/archive_string.h +148 -0
  91. data/ext/libarchive-2.8.4/libarchive/archive_string_sprintf.c +164 -0
  92. data/ext/libarchive-2.8.4/libarchive/archive_util.c +391 -0
  93. data/ext/libarchive-2.8.4/libarchive/archive_virtual.c +94 -0
  94. data/ext/libarchive-2.8.4/libarchive/archive_windows.c +1236 -0
  95. data/ext/libarchive-2.8.4/libarchive/archive_windows.h +347 -0
  96. data/ext/libarchive-2.8.4/libarchive/archive_write.c +466 -0
  97. data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +2628 -0
  98. data/ext/libarchive-2.8.4/libarchive/archive_write_disk_private.h +38 -0
  99. data/ext/libarchive-2.8.4/libarchive/archive_write_disk_set_standard_lookup.c +262 -0
  100. data/ext/libarchive-2.8.4/libarchive/archive_write_open_fd.c +141 -0
  101. data/ext/libarchive-2.8.4/libarchive/archive_write_open_file.c +105 -0
  102. data/ext/libarchive-2.8.4/libarchive/archive_write_open_filename.c +162 -0
  103. data/ext/libarchive-2.8.4/libarchive/archive_write_open_memory.c +126 -0
  104. data/ext/libarchive-2.8.4/libarchive/archive_write_private.h +122 -0
  105. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +408 -0
  106. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c +492 -0
  107. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +477 -0
  108. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +257 -0
  109. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +347 -0
  110. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +438 -0
  111. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format.c +72 -0
  112. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ar.c +550 -0
  113. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_by_name.c +76 -0
  114. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +344 -0
  115. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +295 -0
  116. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +1050 -0
  117. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_pax.c +1386 -0
  118. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_shar.c +626 -0
  119. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ustar.c +587 -0
  120. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +667 -0
  121. data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +154 -0
  122. data/ext/libarchive-2.8.4/libarchive/filter_fork.c +161 -0
  123. data/ext/libarchive-2.8.4/libarchive/filter_fork.h +41 -0
  124. data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +113 -0
  125. data/ext/libarchive-static-makefile +80 -0
  126. data/ext/libarchive-static-wrapper-makefile +22 -0
  127. data/ext/zlib-1.2.5/Makefile.in +257 -0
  128. data/ext/zlib-1.2.5/adler32.c +169 -0
  129. data/ext/zlib-1.2.5/compress.c +80 -0
  130. data/ext/zlib-1.2.5/configure +596 -0
  131. data/ext/zlib-1.2.5/crc32.c +442 -0
  132. data/ext/zlib-1.2.5/crc32.h +441 -0
  133. data/ext/zlib-1.2.5/deflate.c +1834 -0
  134. data/ext/zlib-1.2.5/deflate.h +342 -0
  135. data/ext/zlib-1.2.5/example.c +565 -0
  136. data/ext/zlib-1.2.5/gzclose.c +25 -0
  137. data/ext/zlib-1.2.5/gzguts.h +132 -0
  138. data/ext/zlib-1.2.5/gzlib.c +537 -0
  139. data/ext/zlib-1.2.5/gzread.c +653 -0
  140. data/ext/zlib-1.2.5/gzwrite.c +531 -0
  141. data/ext/zlib-1.2.5/infback.c +632 -0
  142. data/ext/zlib-1.2.5/inffast.c +340 -0
  143. data/ext/zlib-1.2.5/inffast.h +11 -0
  144. data/ext/zlib-1.2.5/inffixed.h +94 -0
  145. data/ext/zlib-1.2.5/inflate.c +1480 -0
  146. data/ext/zlib-1.2.5/inflate.h +122 -0
  147. data/ext/zlib-1.2.5/inftrees.c +330 -0
  148. data/ext/zlib-1.2.5/inftrees.h +62 -0
  149. data/ext/zlib-1.2.5/minigzip.c +440 -0
  150. data/ext/zlib-1.2.5/trees.c +1244 -0
  151. data/ext/zlib-1.2.5/trees.h +128 -0
  152. data/ext/zlib-1.2.5/uncompr.c +59 -0
  153. data/ext/zlib-1.2.5/zconf.h +428 -0
  154. data/ext/zlib-1.2.5/zlib.h +1613 -0
  155. data/ext/zlib-1.2.5/zutil.c +318 -0
  156. data/ext/zlib-1.2.5/zutil.h +274 -0
  157. metadata +211 -0
@@ -0,0 +1,318 @@
1
+ /* zutil.c -- target dependent utility functions for the compression library
2
+ * Copyright (C) 1995-2005, 2010 Jean-loup Gailly.
3
+ * For conditions of distribution and use, see copyright notice in zlib.h
4
+ */
5
+
6
+ /* @(#) $Id$ */
7
+
8
+ #include "zutil.h"
9
+
10
+ #ifndef NO_DUMMY_DECL
11
+ struct internal_state {int dummy;}; /* for buggy compilers */
12
+ #endif
13
+
14
+ const char * const z_errmsg[10] = {
15
+ "need dictionary", /* Z_NEED_DICT 2 */
16
+ "stream end", /* Z_STREAM_END 1 */
17
+ "", /* Z_OK 0 */
18
+ "file error", /* Z_ERRNO (-1) */
19
+ "stream error", /* Z_STREAM_ERROR (-2) */
20
+ "data error", /* Z_DATA_ERROR (-3) */
21
+ "insufficient memory", /* Z_MEM_ERROR (-4) */
22
+ "buffer error", /* Z_BUF_ERROR (-5) */
23
+ "incompatible version",/* Z_VERSION_ERROR (-6) */
24
+ ""};
25
+
26
+
27
+ const char * ZEXPORT zlibVersion()
28
+ {
29
+ return ZLIB_VERSION;
30
+ }
31
+
32
+ uLong ZEXPORT zlibCompileFlags()
33
+ {
34
+ uLong flags;
35
+
36
+ flags = 0;
37
+ switch ((int)(sizeof(uInt))) {
38
+ case 2: break;
39
+ case 4: flags += 1; break;
40
+ case 8: flags += 2; break;
41
+ default: flags += 3;
42
+ }
43
+ switch ((int)(sizeof(uLong))) {
44
+ case 2: break;
45
+ case 4: flags += 1 << 2; break;
46
+ case 8: flags += 2 << 2; break;
47
+ default: flags += 3 << 2;
48
+ }
49
+ switch ((int)(sizeof(voidpf))) {
50
+ case 2: break;
51
+ case 4: flags += 1 << 4; break;
52
+ case 8: flags += 2 << 4; break;
53
+ default: flags += 3 << 4;
54
+ }
55
+ switch ((int)(sizeof(z_off_t))) {
56
+ case 2: break;
57
+ case 4: flags += 1 << 6; break;
58
+ case 8: flags += 2 << 6; break;
59
+ default: flags += 3 << 6;
60
+ }
61
+ #ifdef DEBUG
62
+ flags += 1 << 8;
63
+ #endif
64
+ #if defined(ASMV) || defined(ASMINF)
65
+ flags += 1 << 9;
66
+ #endif
67
+ #ifdef ZLIB_WINAPI
68
+ flags += 1 << 10;
69
+ #endif
70
+ #ifdef BUILDFIXED
71
+ flags += 1 << 12;
72
+ #endif
73
+ #ifdef DYNAMIC_CRC_TABLE
74
+ flags += 1 << 13;
75
+ #endif
76
+ #ifdef NO_GZCOMPRESS
77
+ flags += 1L << 16;
78
+ #endif
79
+ #ifdef NO_GZIP
80
+ flags += 1L << 17;
81
+ #endif
82
+ #ifdef PKZIP_BUG_WORKAROUND
83
+ flags += 1L << 20;
84
+ #endif
85
+ #ifdef FASTEST
86
+ flags += 1L << 21;
87
+ #endif
88
+ #ifdef STDC
89
+ # ifdef NO_vsnprintf
90
+ flags += 1L << 25;
91
+ # ifdef HAS_vsprintf_void
92
+ flags += 1L << 26;
93
+ # endif
94
+ # else
95
+ # ifdef HAS_vsnprintf_void
96
+ flags += 1L << 26;
97
+ # endif
98
+ # endif
99
+ #else
100
+ flags += 1L << 24;
101
+ # ifdef NO_snprintf
102
+ flags += 1L << 25;
103
+ # ifdef HAS_sprintf_void
104
+ flags += 1L << 26;
105
+ # endif
106
+ # else
107
+ # ifdef HAS_snprintf_void
108
+ flags += 1L << 26;
109
+ # endif
110
+ # endif
111
+ #endif
112
+ return flags;
113
+ }
114
+
115
+ #ifdef DEBUG
116
+
117
+ # ifndef verbose
118
+ # define verbose 0
119
+ # endif
120
+ int ZLIB_INTERNAL z_verbose = verbose;
121
+
122
+ void ZLIB_INTERNAL z_error (m)
123
+ char *m;
124
+ {
125
+ fprintf(stderr, "%s\n", m);
126
+ exit(1);
127
+ }
128
+ #endif
129
+
130
+ /* exported to allow conversion of error code to string for compress() and
131
+ * uncompress()
132
+ */
133
+ const char * ZEXPORT zError(err)
134
+ int err;
135
+ {
136
+ return ERR_MSG(err);
137
+ }
138
+
139
+ #if defined(_WIN32_WCE)
140
+ /* The Microsoft C Run-Time Library for Windows CE doesn't have
141
+ * errno. We define it as a global variable to simplify porting.
142
+ * Its value is always 0 and should not be used.
143
+ */
144
+ int errno = 0;
145
+ #endif
146
+
147
+ #ifndef HAVE_MEMCPY
148
+
149
+ void ZLIB_INTERNAL zmemcpy(dest, source, len)
150
+ Bytef* dest;
151
+ const Bytef* source;
152
+ uInt len;
153
+ {
154
+ if (len == 0) return;
155
+ do {
156
+ *dest++ = *source++; /* ??? to be unrolled */
157
+ } while (--len != 0);
158
+ }
159
+
160
+ int ZLIB_INTERNAL zmemcmp(s1, s2, len)
161
+ const Bytef* s1;
162
+ const Bytef* s2;
163
+ uInt len;
164
+ {
165
+ uInt j;
166
+
167
+ for (j = 0; j < len; j++) {
168
+ if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
169
+ }
170
+ return 0;
171
+ }
172
+
173
+ void ZLIB_INTERNAL zmemzero(dest, len)
174
+ Bytef* dest;
175
+ uInt len;
176
+ {
177
+ if (len == 0) return;
178
+ do {
179
+ *dest++ = 0; /* ??? to be unrolled */
180
+ } while (--len != 0);
181
+ }
182
+ #endif
183
+
184
+
185
+ #ifdef SYS16BIT
186
+
187
+ #ifdef __TURBOC__
188
+ /* Turbo C in 16-bit mode */
189
+
190
+ # define MY_ZCALLOC
191
+
192
+ /* Turbo C malloc() does not allow dynamic allocation of 64K bytes
193
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
194
+ * must fix the pointer. Warning: the pointer must be put back to its
195
+ * original form in order to free it, use zcfree().
196
+ */
197
+
198
+ #define MAX_PTR 10
199
+ /* 10*64K = 640K */
200
+
201
+ local int next_ptr = 0;
202
+
203
+ typedef struct ptr_table_s {
204
+ voidpf org_ptr;
205
+ voidpf new_ptr;
206
+ } ptr_table;
207
+
208
+ local ptr_table table[MAX_PTR];
209
+ /* This table is used to remember the original form of pointers
210
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
211
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
212
+ * protected from concurrent access. This hack doesn't work anyway on
213
+ * a protected system like OS/2. Use Microsoft C instead.
214
+ */
215
+
216
+ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
217
+ {
218
+ voidpf buf = opaque; /* just to make some compilers happy */
219
+ ulg bsize = (ulg)items*size;
220
+
221
+ /* If we allocate less than 65520 bytes, we assume that farmalloc
222
+ * will return a usable pointer which doesn't have to be normalized.
223
+ */
224
+ if (bsize < 65520L) {
225
+ buf = farmalloc(bsize);
226
+ if (*(ush*)&buf != 0) return buf;
227
+ } else {
228
+ buf = farmalloc(bsize + 16L);
229
+ }
230
+ if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
231
+ table[next_ptr].org_ptr = buf;
232
+
233
+ /* Normalize the pointer to seg:0 */
234
+ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
235
+ *(ush*)&buf = 0;
236
+ table[next_ptr++].new_ptr = buf;
237
+ return buf;
238
+ }
239
+
240
+ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
241
+ {
242
+ int n;
243
+ if (*(ush*)&ptr != 0) { /* object < 64K */
244
+ farfree(ptr);
245
+ return;
246
+ }
247
+ /* Find the original pointer */
248
+ for (n = 0; n < next_ptr; n++) {
249
+ if (ptr != table[n].new_ptr) continue;
250
+
251
+ farfree(table[n].org_ptr);
252
+ while (++n < next_ptr) {
253
+ table[n-1] = table[n];
254
+ }
255
+ next_ptr--;
256
+ return;
257
+ }
258
+ ptr = opaque; /* just to make some compilers happy */
259
+ Assert(0, "zcfree: ptr not found");
260
+ }
261
+
262
+ #endif /* __TURBOC__ */
263
+
264
+
265
+ #ifdef M_I86
266
+ /* Microsoft C in 16-bit mode */
267
+
268
+ # define MY_ZCALLOC
269
+
270
+ #if (!defined(_MSC_VER) || (_MSC_VER <= 600))
271
+ # define _halloc halloc
272
+ # define _hfree hfree
273
+ #endif
274
+
275
+ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
276
+ {
277
+ if (opaque) opaque = 0; /* to make compiler happy */
278
+ return _halloc((long)items, size);
279
+ }
280
+
281
+ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
282
+ {
283
+ if (opaque) opaque = 0; /* to make compiler happy */
284
+ _hfree(ptr);
285
+ }
286
+
287
+ #endif /* M_I86 */
288
+
289
+ #endif /* SYS16BIT */
290
+
291
+
292
+ #ifndef MY_ZCALLOC /* Any system without a special alloc function */
293
+
294
+ #ifndef STDC
295
+ extern voidp malloc OF((uInt size));
296
+ extern voidp calloc OF((uInt items, uInt size));
297
+ extern void free OF((voidpf ptr));
298
+ #endif
299
+
300
+ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
301
+ voidpf opaque;
302
+ unsigned items;
303
+ unsigned size;
304
+ {
305
+ if (opaque) items += size - size; /* make compiler happy */
306
+ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
307
+ (voidpf)calloc(items, size);
308
+ }
309
+
310
+ void ZLIB_INTERNAL zcfree (opaque, ptr)
311
+ voidpf opaque;
312
+ voidpf ptr;
313
+ {
314
+ free(ptr);
315
+ if (opaque) return; /* make compiler happy */
316
+ }
317
+
318
+ #endif /* MY_ZCALLOC */
@@ -0,0 +1,274 @@
1
+ /* zutil.h -- internal interface and configuration of the compression library
2
+ * Copyright (C) 1995-2010 Jean-loup Gailly.
3
+ * For conditions of distribution and use, see copyright notice in zlib.h
4
+ */
5
+
6
+ /* WARNING: this file should *not* be used by applications. It is
7
+ part of the implementation of the compression library and is
8
+ subject to change. Applications should only use zlib.h.
9
+ */
10
+
11
+ /* @(#) $Id$ */
12
+
13
+ #ifndef ZUTIL_H
14
+ #define ZUTIL_H
15
+
16
+ #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
17
+ # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
18
+ #else
19
+ # define ZLIB_INTERNAL
20
+ #endif
21
+
22
+ #include "zlib.h"
23
+
24
+ #ifdef STDC
25
+ # if !(defined(_WIN32_WCE) && defined(_MSC_VER))
26
+ # include <stddef.h>
27
+ # endif
28
+ # include <string.h>
29
+ # include <stdlib.h>
30
+ #endif
31
+
32
+ #ifndef local
33
+ # define local static
34
+ #endif
35
+ /* compile with -Dlocal if your debugger can't find static symbols */
36
+
37
+ typedef unsigned char uch;
38
+ typedef uch FAR uchf;
39
+ typedef unsigned short ush;
40
+ typedef ush FAR ushf;
41
+ typedef unsigned long ulg;
42
+
43
+ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
44
+ /* (size given to avoid silly warnings with Visual C++) */
45
+
46
+ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
47
+
48
+ #define ERR_RETURN(strm,err) \
49
+ return (strm->msg = (char*)ERR_MSG(err), (err))
50
+ /* To be used only when the state is known to be valid */
51
+
52
+ /* common constants */
53
+
54
+ #ifndef DEF_WBITS
55
+ # define DEF_WBITS MAX_WBITS
56
+ #endif
57
+ /* default windowBits for decompression. MAX_WBITS is for compression only */
58
+
59
+ #if MAX_MEM_LEVEL >= 8
60
+ # define DEF_MEM_LEVEL 8
61
+ #else
62
+ # define DEF_MEM_LEVEL MAX_MEM_LEVEL
63
+ #endif
64
+ /* default memLevel */
65
+
66
+ #define STORED_BLOCK 0
67
+ #define STATIC_TREES 1
68
+ #define DYN_TREES 2
69
+ /* The three kinds of block type */
70
+
71
+ #define MIN_MATCH 3
72
+ #define MAX_MATCH 258
73
+ /* The minimum and maximum match lengths */
74
+
75
+ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
76
+
77
+ /* target dependencies */
78
+
79
+ #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
80
+ # define OS_CODE 0x00
81
+ # if defined(__TURBOC__) || defined(__BORLANDC__)
82
+ # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
83
+ /* Allow compilation with ANSI keywords only enabled */
84
+ void _Cdecl farfree( void *block );
85
+ void *_Cdecl farmalloc( unsigned long nbytes );
86
+ # else
87
+ # include <alloc.h>
88
+ # endif
89
+ # else /* MSC or DJGPP */
90
+ # include <malloc.h>
91
+ # endif
92
+ #endif
93
+
94
+ #ifdef AMIGA
95
+ # define OS_CODE 0x01
96
+ #endif
97
+
98
+ #if defined(VAXC) || defined(VMS)
99
+ # define OS_CODE 0x02
100
+ # define F_OPEN(name, mode) \
101
+ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
102
+ #endif
103
+
104
+ #if defined(ATARI) || defined(atarist)
105
+ # define OS_CODE 0x05
106
+ #endif
107
+
108
+ #ifdef OS2
109
+ # define OS_CODE 0x06
110
+ # ifdef M_I86
111
+ # include <malloc.h>
112
+ # endif
113
+ #endif
114
+
115
+ #if defined(MACOS) || defined(TARGET_OS_MAC)
116
+ # define OS_CODE 0x07
117
+ # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
118
+ # include <unix.h> /* for fdopen */
119
+ # else
120
+ # ifndef fdopen
121
+ # define fdopen(fd,mode) NULL /* No fdopen() */
122
+ # endif
123
+ # endif
124
+ #endif
125
+
126
+ #ifdef TOPS20
127
+ # define OS_CODE 0x0a
128
+ #endif
129
+
130
+ #ifdef WIN32
131
+ # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
132
+ # define OS_CODE 0x0b
133
+ # endif
134
+ #endif
135
+
136
+ #ifdef __50SERIES /* Prime/PRIMOS */
137
+ # define OS_CODE 0x0f
138
+ #endif
139
+
140
+ #if defined(_BEOS_) || defined(RISCOS)
141
+ # define fdopen(fd,mode) NULL /* No fdopen() */
142
+ #endif
143
+
144
+ #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
145
+ # if defined(_WIN32_WCE)
146
+ # define fdopen(fd,mode) NULL /* No fdopen() */
147
+ # ifndef _PTRDIFF_T_DEFINED
148
+ typedef int ptrdiff_t;
149
+ # define _PTRDIFF_T_DEFINED
150
+ # endif
151
+ # else
152
+ # define fdopen(fd,type) _fdopen(fd,type)
153
+ # endif
154
+ #endif
155
+
156
+ #if defined(__BORLANDC__)
157
+ #pragma warn -8004
158
+ #pragma warn -8008
159
+ #pragma warn -8066
160
+ #endif
161
+
162
+ /* provide prototypes for these when building zlib without LFS */
163
+ #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
164
+ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
165
+ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
166
+ #endif
167
+
168
+ /* common defaults */
169
+
170
+ #ifndef OS_CODE
171
+ # define OS_CODE 0x03 /* assume Unix */
172
+ #endif
173
+
174
+ #ifndef F_OPEN
175
+ # define F_OPEN(name, mode) fopen((name), (mode))
176
+ #endif
177
+
178
+ /* functions */
179
+
180
+ #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
181
+ # ifndef HAVE_VSNPRINTF
182
+ # define HAVE_VSNPRINTF
183
+ # endif
184
+ #endif
185
+ #if defined(__CYGWIN__)
186
+ # ifndef HAVE_VSNPRINTF
187
+ # define HAVE_VSNPRINTF
188
+ # endif
189
+ #endif
190
+ #ifndef HAVE_VSNPRINTF
191
+ # ifdef MSDOS
192
+ /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
193
+ but for now we just assume it doesn't. */
194
+ # define NO_vsnprintf
195
+ # endif
196
+ # ifdef __TURBOC__
197
+ # define NO_vsnprintf
198
+ # endif
199
+ # ifdef WIN32
200
+ /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
201
+ # if !defined(vsnprintf) && !defined(NO_vsnprintf)
202
+ # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
203
+ # define vsnprintf _vsnprintf
204
+ # endif
205
+ # endif
206
+ # endif
207
+ # ifdef __SASC
208
+ # define NO_vsnprintf
209
+ # endif
210
+ #endif
211
+ #ifdef VMS
212
+ # define NO_vsnprintf
213
+ #endif
214
+
215
+ #if defined(pyr)
216
+ # define NO_MEMCPY
217
+ #endif
218
+ #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
219
+ /* Use our own functions for small and medium model with MSC <= 5.0.
220
+ * You may have to use the same strategy for Borland C (untested).
221
+ * The __SC__ check is for Symantec.
222
+ */
223
+ # define NO_MEMCPY
224
+ #endif
225
+ #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
226
+ # define HAVE_MEMCPY
227
+ #endif
228
+ #ifdef HAVE_MEMCPY
229
+ # ifdef SMALL_MEDIUM /* MSDOS small or medium model */
230
+ # define zmemcpy _fmemcpy
231
+ # define zmemcmp _fmemcmp
232
+ # define zmemzero(dest, len) _fmemset(dest, 0, len)
233
+ # else
234
+ # define zmemcpy memcpy
235
+ # define zmemcmp memcmp
236
+ # define zmemzero(dest, len) memset(dest, 0, len)
237
+ # endif
238
+ #else
239
+ void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
240
+ int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
241
+ void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
242
+ #endif
243
+
244
+ /* Diagnostic functions */
245
+ #ifdef DEBUG
246
+ # include <stdio.h>
247
+ extern int ZLIB_INTERNAL z_verbose;
248
+ extern void ZLIB_INTERNAL z_error OF((char *m));
249
+ # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
250
+ # define Trace(x) {if (z_verbose>=0) fprintf x ;}
251
+ # define Tracev(x) {if (z_verbose>0) fprintf x ;}
252
+ # define Tracevv(x) {if (z_verbose>1) fprintf x ;}
253
+ # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
254
+ # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
255
+ #else
256
+ # define Assert(cond,msg)
257
+ # define Trace(x)
258
+ # define Tracev(x)
259
+ # define Tracevv(x)
260
+ # define Tracec(c,x)
261
+ # define Tracecv(c,x)
262
+ #endif
263
+
264
+
265
+ voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
266
+ unsigned size));
267
+ void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
268
+
269
+ #define ZALLOC(strm, items, size) \
270
+ (*((strm)->zalloc))((strm)->opaque, (items), (size))
271
+ #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
272
+ #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
273
+
274
+ #endif /* ZUTIL_H */