chd 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +30 -0
  3. data/chd.gemspec +29 -0
  4. data/ext/chd.c +1008 -0
  5. data/ext/extconf.rb +60 -0
  6. data/lib/chd/cd.rb +272 -0
  7. data/lib/chd/metadata.rb +196 -0
  8. data/lib/chd/version.rb +4 -0
  9. data/lib/chd.rb +21 -0
  10. data/libchdr/CMakeLists.txt +104 -0
  11. data/libchdr/LICENSE.txt +24 -0
  12. data/libchdr/README.md +7 -0
  13. data/libchdr/deps/lzma-19.00/CMakeLists.txt +33 -0
  14. data/libchdr/deps/lzma-19.00/LICENSE +3 -0
  15. data/libchdr/deps/lzma-19.00/include/7zTypes.h +375 -0
  16. data/libchdr/deps/lzma-19.00/include/Alloc.h +51 -0
  17. data/libchdr/deps/lzma-19.00/include/Bra.h +64 -0
  18. data/libchdr/deps/lzma-19.00/include/Compiler.h +33 -0
  19. data/libchdr/deps/lzma-19.00/include/CpuArch.h +336 -0
  20. data/libchdr/deps/lzma-19.00/include/Delta.h +19 -0
  21. data/libchdr/deps/lzma-19.00/include/LzFind.h +121 -0
  22. data/libchdr/deps/lzma-19.00/include/LzHash.h +57 -0
  23. data/libchdr/deps/lzma-19.00/include/Lzma86.h +111 -0
  24. data/libchdr/deps/lzma-19.00/include/LzmaDec.h +234 -0
  25. data/libchdr/deps/lzma-19.00/include/LzmaEnc.h +76 -0
  26. data/libchdr/deps/lzma-19.00/include/LzmaLib.h +131 -0
  27. data/libchdr/deps/lzma-19.00/include/Precomp.h +10 -0
  28. data/libchdr/deps/lzma-19.00/include/Sort.h +18 -0
  29. data/libchdr/deps/lzma-19.00/lzma-history.txt +446 -0
  30. data/libchdr/deps/lzma-19.00/lzma.txt +328 -0
  31. data/libchdr/deps/lzma-19.00/lzma.vcxproj +543 -0
  32. data/libchdr/deps/lzma-19.00/lzma.vcxproj.filters +17 -0
  33. data/libchdr/deps/lzma-19.00/src/Alloc.c +455 -0
  34. data/libchdr/deps/lzma-19.00/src/Bra86.c +82 -0
  35. data/libchdr/deps/lzma-19.00/src/BraIA64.c +53 -0
  36. data/libchdr/deps/lzma-19.00/src/CpuArch.c +218 -0
  37. data/libchdr/deps/lzma-19.00/src/Delta.c +64 -0
  38. data/libchdr/deps/lzma-19.00/src/LzFind.c +1127 -0
  39. data/libchdr/deps/lzma-19.00/src/Lzma86Dec.c +54 -0
  40. data/libchdr/deps/lzma-19.00/src/LzmaDec.c +1185 -0
  41. data/libchdr/deps/lzma-19.00/src/LzmaEnc.c +1330 -0
  42. data/libchdr/deps/lzma-19.00/src/Sort.c +141 -0
  43. data/libchdr/deps/zlib-1.2.11/CMakeLists.txt +29 -0
  44. data/libchdr/deps/zlib-1.2.11/ChangeLog +1515 -0
  45. data/libchdr/deps/zlib-1.2.11/FAQ +368 -0
  46. data/libchdr/deps/zlib-1.2.11/INDEX +68 -0
  47. data/libchdr/deps/zlib-1.2.11/Makefile +5 -0
  48. data/libchdr/deps/zlib-1.2.11/Makefile.in +410 -0
  49. data/libchdr/deps/zlib-1.2.11/README +115 -0
  50. data/libchdr/deps/zlib-1.2.11/adler32.c +186 -0
  51. data/libchdr/deps/zlib-1.2.11/compress.c +86 -0
  52. data/libchdr/deps/zlib-1.2.11/configure +921 -0
  53. data/libchdr/deps/zlib-1.2.11/crc32.c +442 -0
  54. data/libchdr/deps/zlib-1.2.11/crc32.h +441 -0
  55. data/libchdr/deps/zlib-1.2.11/deflate.c +2163 -0
  56. data/libchdr/deps/zlib-1.2.11/deflate.h +349 -0
  57. data/libchdr/deps/zlib-1.2.11/doc/algorithm.txt +209 -0
  58. data/libchdr/deps/zlib-1.2.11/doc/rfc1950.txt +619 -0
  59. data/libchdr/deps/zlib-1.2.11/doc/rfc1951.txt +955 -0
  60. data/libchdr/deps/zlib-1.2.11/doc/rfc1952.txt +675 -0
  61. data/libchdr/deps/zlib-1.2.11/doc/txtvsbin.txt +107 -0
  62. data/libchdr/deps/zlib-1.2.11/gzclose.c +25 -0
  63. data/libchdr/deps/zlib-1.2.11/gzguts.h +218 -0
  64. data/libchdr/deps/zlib-1.2.11/gzlib.c +637 -0
  65. data/libchdr/deps/zlib-1.2.11/gzread.c +654 -0
  66. data/libchdr/deps/zlib-1.2.11/gzwrite.c +665 -0
  67. data/libchdr/deps/zlib-1.2.11/infback.c +640 -0
  68. data/libchdr/deps/zlib-1.2.11/inffast.c +323 -0
  69. data/libchdr/deps/zlib-1.2.11/inffast.h +11 -0
  70. data/libchdr/deps/zlib-1.2.11/inffixed.h +94 -0
  71. data/libchdr/deps/zlib-1.2.11/inflate.c +1561 -0
  72. data/libchdr/deps/zlib-1.2.11/inflate.h +125 -0
  73. data/libchdr/deps/zlib-1.2.11/inftrees.c +304 -0
  74. data/libchdr/deps/zlib-1.2.11/inftrees.h +62 -0
  75. data/libchdr/deps/zlib-1.2.11/make_vms.com +867 -0
  76. data/libchdr/deps/zlib-1.2.11/treebuild.xml +116 -0
  77. data/libchdr/deps/zlib-1.2.11/trees.c +1203 -0
  78. data/libchdr/deps/zlib-1.2.11/trees.h +128 -0
  79. data/libchdr/deps/zlib-1.2.11/uncompr.c +93 -0
  80. data/libchdr/deps/zlib-1.2.11/zconf.h +534 -0
  81. data/libchdr/deps/zlib-1.2.11/zconf.h.cmakein +536 -0
  82. data/libchdr/deps/zlib-1.2.11/zconf.h.in +534 -0
  83. data/libchdr/deps/zlib-1.2.11/zlib.3 +149 -0
  84. data/libchdr/deps/zlib-1.2.11/zlib.3.pdf +0 -0
  85. data/libchdr/deps/zlib-1.2.11/zlib.h +1912 -0
  86. data/libchdr/deps/zlib-1.2.11/zlib.map +94 -0
  87. data/libchdr/deps/zlib-1.2.11/zlib.pc.cmakein +13 -0
  88. data/libchdr/deps/zlib-1.2.11/zlib.pc.in +13 -0
  89. data/libchdr/deps/zlib-1.2.11/zlib2ansi +152 -0
  90. data/libchdr/deps/zlib-1.2.11/zutil.c +325 -0
  91. data/libchdr/deps/zlib-1.2.11/zutil.h +271 -0
  92. data/libchdr/include/dr_libs/dr_flac.h +12280 -0
  93. data/libchdr/include/libchdr/bitstream.h +43 -0
  94. data/libchdr/include/libchdr/cdrom.h +110 -0
  95. data/libchdr/include/libchdr/chd.h +427 -0
  96. data/libchdr/include/libchdr/chdconfig.h +10 -0
  97. data/libchdr/include/libchdr/coretypes.h +60 -0
  98. data/libchdr/include/libchdr/flac.h +50 -0
  99. data/libchdr/include/libchdr/huffman.h +90 -0
  100. data/libchdr/pkg-config.pc.in +10 -0
  101. data/libchdr/src/libchdr_bitstream.c +125 -0
  102. data/libchdr/src/libchdr_cdrom.c +415 -0
  103. data/libchdr/src/libchdr_chd.c +2744 -0
  104. data/libchdr/src/libchdr_flac.c +302 -0
  105. data/libchdr/src/libchdr_huffman.c +545 -0
  106. data/libchdr/src/link.T +5 -0
  107. data/libchdr/tests/CMakeLists.txt +2 -0
  108. data/libchdr/tests/benchmark.c +52 -0
  109. metadata +183 -0
@@ -0,0 +1,410 @@
1
+ # Makefile for zlib
2
+ # Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
3
+ # For conditions of distribution and use, see copyright notice in zlib.h
4
+
5
+ # To compile and test, type:
6
+ # ./configure; make test
7
+ # Normally configure builds both a static and a shared library.
8
+ # If you want to build just a static library, use: ./configure --static
9
+
10
+ # To use the asm code, type:
11
+ # cp contrib/asm?86/match.S ./match.S
12
+ # make LOC=-DASMV OBJA=match.o
13
+
14
+ # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
15
+ # make install
16
+ # To install in $HOME instead of /usr/local, use:
17
+ # make install prefix=$HOME
18
+
19
+ CC=cc
20
+
21
+ CFLAGS=-O
22
+ #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
23
+ #CFLAGS=-g -DZLIB_DEBUG
24
+ #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
25
+ # -Wstrict-prototypes -Wmissing-prototypes
26
+
27
+ SFLAGS=-O
28
+ LDFLAGS=
29
+ TEST_LDFLAGS=-L. libz.a
30
+ LDSHARED=$(CC)
31
+ CPP=$(CC) -E
32
+
33
+ STATICLIB=libz.a
34
+ SHAREDLIB=libz.so
35
+ SHAREDLIBV=libz.so.1.2.11
36
+ SHAREDLIBM=libz.so.1
37
+ LIBS=$(STATICLIB) $(SHAREDLIBV)
38
+
39
+ AR=ar
40
+ ARFLAGS=rc
41
+ RANLIB=ranlib
42
+ LDCONFIG=ldconfig
43
+ LDSHAREDLIBC=-lc
44
+ TAR=tar
45
+ SHELL=/bin/sh
46
+ EXE=
47
+
48
+ prefix = /usr/local
49
+ exec_prefix = ${prefix}
50
+ libdir = ${exec_prefix}/lib
51
+ sharedlibdir = ${libdir}
52
+ includedir = ${prefix}/include
53
+ mandir = ${prefix}/share/man
54
+ man3dir = ${mandir}/man3
55
+ pkgconfigdir = ${libdir}/pkgconfig
56
+ SRCDIR=
57
+ ZINC=
58
+ ZINCOUT=-I.
59
+
60
+ OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
61
+ OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
62
+ OBJC = $(OBJZ) $(OBJG)
63
+
64
+ PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
65
+ PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
66
+ PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
67
+
68
+ # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
69
+ OBJA =
70
+ PIC_OBJA =
71
+
72
+ OBJS = $(OBJC) $(OBJA)
73
+
74
+ PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
75
+
76
+ all: static shared
77
+
78
+ static: example$(EXE) minigzip$(EXE)
79
+
80
+ shared: examplesh$(EXE) minigzipsh$(EXE)
81
+
82
+ all64: example64$(EXE) minigzip64$(EXE)
83
+
84
+ check: test
85
+
86
+ test: all teststatic testshared
87
+
88
+ teststatic: static
89
+ @TMPST=tmpst_$$; \
90
+ if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
91
+ echo ' *** zlib test OK ***'; \
92
+ else \
93
+ echo ' *** zlib test FAILED ***'; false; \
94
+ fi; \
95
+ rm -f $$TMPST
96
+
97
+ testshared: shared
98
+ @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
99
+ LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
100
+ DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
101
+ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
102
+ TMPSH=tmpsh_$$; \
103
+ if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
104
+ echo ' *** zlib shared test OK ***'; \
105
+ else \
106
+ echo ' *** zlib shared test FAILED ***'; false; \
107
+ fi; \
108
+ rm -f $$TMPSH
109
+
110
+ test64: all64
111
+ @TMP64=tmp64_$$; \
112
+ if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
113
+ echo ' *** zlib 64-bit test OK ***'; \
114
+ else \
115
+ echo ' *** zlib 64-bit test FAILED ***'; false; \
116
+ fi; \
117
+ rm -f $$TMP64
118
+
119
+ infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
120
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
121
+
122
+ infcover: infcover.o libz.a
123
+ $(CC) $(CFLAGS) -o $@ infcover.o libz.a
124
+
125
+ cover: infcover
126
+ rm -f *.gcda
127
+ ./infcover
128
+ gcov inf*.c
129
+
130
+ libz.a: $(OBJS)
131
+ $(AR) $(ARFLAGS) $@ $(OBJS)
132
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
133
+
134
+ match.o: match.S
135
+ $(CPP) match.S > _match.s
136
+ $(CC) -c _match.s
137
+ mv _match.o match.o
138
+ rm -f _match.s
139
+
140
+ match.lo: match.S
141
+ $(CPP) match.S > _match.s
142
+ $(CC) -c -fPIC _match.s
143
+ mv _match.o match.lo
144
+ rm -f _match.s
145
+
146
+ example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
147
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
148
+
149
+ minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
150
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
151
+
152
+ example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
153
+ $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
154
+
155
+ minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
156
+ $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
157
+
158
+
159
+ adler32.o: $(SRCDIR)adler32.c
160
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
161
+
162
+ crc32.o: $(SRCDIR)crc32.c
163
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
164
+
165
+ deflate.o: $(SRCDIR)deflate.c
166
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
167
+
168
+ infback.o: $(SRCDIR)infback.c
169
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
170
+
171
+ inffast.o: $(SRCDIR)inffast.c
172
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
173
+
174
+ inflate.o: $(SRCDIR)inflate.c
175
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
176
+
177
+ inftrees.o: $(SRCDIR)inftrees.c
178
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
179
+
180
+ trees.o: $(SRCDIR)trees.c
181
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
182
+
183
+ zutil.o: $(SRCDIR)zutil.c
184
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
185
+
186
+ compress.o: $(SRCDIR)compress.c
187
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
188
+
189
+ uncompr.o: $(SRCDIR)uncompr.c
190
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
191
+
192
+ gzclose.o: $(SRCDIR)gzclose.c
193
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
194
+
195
+ gzlib.o: $(SRCDIR)gzlib.c
196
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
197
+
198
+ gzread.o: $(SRCDIR)gzread.c
199
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
200
+
201
+ gzwrite.o: $(SRCDIR)gzwrite.c
202
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
203
+
204
+
205
+ adler32.lo: $(SRCDIR)adler32.c
206
+ -@mkdir objs 2>/dev/null || test -d objs
207
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
208
+ -@mv objs/adler32.o $@
209
+
210
+ crc32.lo: $(SRCDIR)crc32.c
211
+ -@mkdir objs 2>/dev/null || test -d objs
212
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
213
+ -@mv objs/crc32.o $@
214
+
215
+ deflate.lo: $(SRCDIR)deflate.c
216
+ -@mkdir objs 2>/dev/null || test -d objs
217
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
218
+ -@mv objs/deflate.o $@
219
+
220
+ infback.lo: $(SRCDIR)infback.c
221
+ -@mkdir objs 2>/dev/null || test -d objs
222
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
223
+ -@mv objs/infback.o $@
224
+
225
+ inffast.lo: $(SRCDIR)inffast.c
226
+ -@mkdir objs 2>/dev/null || test -d objs
227
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
228
+ -@mv objs/inffast.o $@
229
+
230
+ inflate.lo: $(SRCDIR)inflate.c
231
+ -@mkdir objs 2>/dev/null || test -d objs
232
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
233
+ -@mv objs/inflate.o $@
234
+
235
+ inftrees.lo: $(SRCDIR)inftrees.c
236
+ -@mkdir objs 2>/dev/null || test -d objs
237
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
238
+ -@mv objs/inftrees.o $@
239
+
240
+ trees.lo: $(SRCDIR)trees.c
241
+ -@mkdir objs 2>/dev/null || test -d objs
242
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
243
+ -@mv objs/trees.o $@
244
+
245
+ zutil.lo: $(SRCDIR)zutil.c
246
+ -@mkdir objs 2>/dev/null || test -d objs
247
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
248
+ -@mv objs/zutil.o $@
249
+
250
+ compress.lo: $(SRCDIR)compress.c
251
+ -@mkdir objs 2>/dev/null || test -d objs
252
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
253
+ -@mv objs/compress.o $@
254
+
255
+ uncompr.lo: $(SRCDIR)uncompr.c
256
+ -@mkdir objs 2>/dev/null || test -d objs
257
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
258
+ -@mv objs/uncompr.o $@
259
+
260
+ gzclose.lo: $(SRCDIR)gzclose.c
261
+ -@mkdir objs 2>/dev/null || test -d objs
262
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
263
+ -@mv objs/gzclose.o $@
264
+
265
+ gzlib.lo: $(SRCDIR)gzlib.c
266
+ -@mkdir objs 2>/dev/null || test -d objs
267
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
268
+ -@mv objs/gzlib.o $@
269
+
270
+ gzread.lo: $(SRCDIR)gzread.c
271
+ -@mkdir objs 2>/dev/null || test -d objs
272
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
273
+ -@mv objs/gzread.o $@
274
+
275
+ gzwrite.lo: $(SRCDIR)gzwrite.c
276
+ -@mkdir objs 2>/dev/null || test -d objs
277
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
278
+ -@mv objs/gzwrite.o $@
279
+
280
+
281
+ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
282
+ $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
283
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
284
+ ln -s $@ $(SHAREDLIB)
285
+ ln -s $@ $(SHAREDLIBM)
286
+ -@rmdir objs
287
+
288
+ example$(EXE): example.o $(STATICLIB)
289
+ $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
290
+
291
+ minigzip$(EXE): minigzip.o $(STATICLIB)
292
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
293
+
294
+ examplesh$(EXE): example.o $(SHAREDLIBV)
295
+ $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
296
+
297
+ minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
298
+ $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
299
+
300
+ example64$(EXE): example64.o $(STATICLIB)
301
+ $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
302
+
303
+ minigzip64$(EXE): minigzip64.o $(STATICLIB)
304
+ $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
305
+
306
+ install-libs: $(LIBS)
307
+ -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
308
+ -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
309
+ -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
310
+ -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
311
+ -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
312
+ rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
313
+ cp $(STATICLIB) $(DESTDIR)$(libdir)
314
+ chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
315
+ -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
316
+ -@if test -n "$(SHAREDLIBV)"; then \
317
+ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
318
+ cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
319
+ echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
320
+ chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
321
+ echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
322
+ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
323
+ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
324
+ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
325
+ ($(LDCONFIG) || true) >/dev/null 2>&1; \
326
+ fi
327
+ rm -f $(DESTDIR)$(man3dir)/zlib.3
328
+ cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
329
+ chmod 644 $(DESTDIR)$(man3dir)/zlib.3
330
+ rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
331
+ cp zlib.pc $(DESTDIR)$(pkgconfigdir)
332
+ chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
333
+ # The ranlib in install is needed on NeXTSTEP which checks file times
334
+ # ldconfig is for Linux
335
+
336
+ install: install-libs
337
+ -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
338
+ rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
339
+ cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
340
+ chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
341
+
342
+ uninstall:
343
+ cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
344
+ cd $(DESTDIR)$(libdir) && rm -f libz.a; \
345
+ if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
346
+ rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
347
+ fi
348
+ cd $(DESTDIR)$(man3dir) && rm -f zlib.3
349
+ cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
350
+
351
+ docs: zlib.3.pdf
352
+
353
+ zlib.3.pdf: $(SRCDIR)zlib.3
354
+ groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
355
+
356
+ zconf.h.cmakein: $(SRCDIR)zconf.h.in
357
+ -@ TEMPFILE=zconfh_$$; \
358
+ echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
359
+ sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
360
+ touch -r $(SRCDIR)zconf.h.in $@ &&\
361
+ rm $$TEMPFILE
362
+
363
+ zconf: $(SRCDIR)zconf.h.in
364
+ cp -p $(SRCDIR)zconf.h.in zconf.h
365
+
366
+ mostlyclean: clean
367
+ clean:
368
+ rm -f *.o *.lo *~ \
369
+ example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
370
+ example64$(EXE) minigzip64$(EXE) \
371
+ infcover \
372
+ libz.* foo.gz so_locations \
373
+ _match.s maketree contrib/infback9/*.o
374
+ rm -rf objs
375
+ rm -f *.gcda *.gcno *.gcov
376
+ rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
377
+
378
+ maintainer-clean: distclean
379
+ distclean: clean zconf zconf.h.cmakein docs
380
+ rm -f Makefile zlib.pc configure.log
381
+ -@rm -f .DS_Store
382
+ @if [ -f Makefile.in ]; then \
383
+ printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
384
+ printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
385
+ touch -r $(SRCDIR)Makefile.in Makefile ; fi
386
+ @if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
387
+ @if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi
388
+
389
+ tags:
390
+ etags $(SRCDIR)*.[ch]
391
+
392
+ adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
393
+ gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
394
+ compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
395
+ crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
396
+ deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
397
+ infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
398
+ inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
399
+ inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
400
+ trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
401
+
402
+ adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
403
+ gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
404
+ compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
405
+ crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
406
+ deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
407
+ infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
408
+ inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
409
+ inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
410
+ trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
@@ -0,0 +1,115 @@
1
+ ZLIB DATA COMPRESSION LIBRARY
2
+
3
+ zlib 1.2.11 is a general purpose data compression library. All the code is
4
+ thread safe. The data format used by the zlib library is described by RFCs
5
+ (Request for Comments) 1950 to 1952 in the files
6
+ http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
7
+ rfc1952 (gzip format).
8
+
9
+ All functions of the compression library are documented in the file zlib.h
10
+ (volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
11
+ of the library is given in the file test/example.c which also tests that
12
+ the library is working correctly. Another example is given in the file
13
+ test/minigzip.c. The compression library itself is composed of all source
14
+ files in the root directory.
15
+
16
+ To compile all files and run the test program, follow the instructions given at
17
+ the top of Makefile.in. In short "./configure; make test", and if that goes
18
+ well, "make install" should work for most flavors of Unix. For Windows, use
19
+ one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
20
+ make_vms.com.
21
+
22
+ Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
23
+ <info@winimage.com> for the Windows DLL version. The zlib home page is
24
+ http://zlib.net/ . Before reporting a problem, please check this site to
25
+ verify that you have the latest version of zlib; otherwise get the latest
26
+ version and check whether the problem still exists or not.
27
+
28
+ PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
29
+
30
+ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
31
+ issue of Dr. Dobb's Journal; a copy of the article is available at
32
+ http://marknelson.us/1997/01/01/zlib-engine/ .
33
+
34
+ The changes made in version 1.2.11 are documented in the file ChangeLog.
35
+
36
+ Unsupported third party contributions are provided in directory contrib/ .
37
+
38
+ zlib is available in Java using the java.util.zip package, documented at
39
+ http://java.sun.com/developer/technicalArticles/Programming/compression/ .
40
+
41
+ A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
42
+ at CPAN (Comprehensive Perl Archive Network) sites, including
43
+ http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
44
+
45
+ A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
46
+ available in Python 1.5 and later versions, see
47
+ http://docs.python.org/library/zlib.html .
48
+
49
+ zlib is built into tcl: http://wiki.tcl.tk/4610 .
50
+
51
+ An experimental package to read and write files in .zip format, written on top
52
+ of zlib by Gilles Vollant <info@winimage.com>, is available in the
53
+ contrib/minizip directory of zlib.
54
+
55
+
56
+ Notes for some targets:
57
+
58
+ - For Windows DLL versions, please see win32/DLL_FAQ.txt
59
+
60
+ - For 64-bit Irix, deflate.c must be compiled without any optimization. With
61
+ -O, one libpng test fails. The test works in 32 bit mode (with the -n32
62
+ compiler flag). The compiler bug has been reported to SGI.
63
+
64
+ - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
65
+ when compiled with cc.
66
+
67
+ - On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
68
+ necessary to get gzprintf working correctly. This is done by configure.
69
+
70
+ - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
71
+ other compilers. Use "make test" to check your compiler.
72
+
73
+ - gzdopen is not supported on RISCOS or BEOS.
74
+
75
+ - For PalmOs, see http://palmzlib.sourceforge.net/
76
+
77
+
78
+ Acknowledgments:
79
+
80
+ The deflate format used by zlib was defined by Phil Katz. The deflate and
81
+ zlib specifications were written by L. Peter Deutsch. Thanks to all the
82
+ people who reported problems and suggested various improvements in zlib; they
83
+ are too numerous to cite here.
84
+
85
+ Copyright notice:
86
+
87
+ (C) 1995-2017 Jean-loup Gailly and Mark Adler
88
+
89
+ This software is provided 'as-is', without any express or implied
90
+ warranty. In no event will the authors be held liable for any damages
91
+ arising from the use of this software.
92
+
93
+ Permission is granted to anyone to use this software for any purpose,
94
+ including commercial applications, and to alter it and redistribute it
95
+ freely, subject to the following restrictions:
96
+
97
+ 1. The origin of this software must not be misrepresented; you must not
98
+ claim that you wrote the original software. If you use this software
99
+ in a product, an acknowledgment in the product documentation would be
100
+ appreciated but is not required.
101
+ 2. Altered source versions must be plainly marked as such, and must not be
102
+ misrepresented as being the original software.
103
+ 3. This notice may not be removed or altered from any source distribution.
104
+
105
+ Jean-loup Gailly Mark Adler
106
+ jloup@gzip.org madler@alumni.caltech.edu
107
+
108
+ If you use the zlib library in a product, we would appreciate *not* receiving
109
+ lengthy legal documents to sign. The sources are provided for free but without
110
+ warranty of any kind. The library has been entirely written by Jean-loup
111
+ Gailly and Mark Adler; it does not include third-party code.
112
+
113
+ If you redistribute modified sources, we would appreciate that you include in
114
+ the file ChangeLog history information documenting your changes. Please read
115
+ the FAQ for more information on the distribution of modified source versions.
@@ -0,0 +1,186 @@
1
+ /* adler32.c -- compute the Adler-32 checksum of a data stream
2
+ * Copyright (C) 1995-2011, 2016 Mark Adler
3
+ * For conditions of distribution and use, see copyright notice in zlib.h
4
+ */
5
+
6
+ /* @(#) $Id$ */
7
+
8
+ #include "zutil.h"
9
+
10
+ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
11
+
12
+ #define BASE 65521U /* largest prime smaller than 65536 */
13
+ #define NMAX 5552
14
+ /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
15
+
16
+ #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
17
+ #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
18
+ #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
19
+ #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
20
+ #define DO16(buf) DO8(buf,0); DO8(buf,8);
21
+
22
+ /* use NO_DIVIDE if your processor does not do division in hardware --
23
+ try it both ways to see which is faster */
24
+ #ifdef NO_DIVIDE
25
+ /* note that this assumes BASE is 65521, where 65536 % 65521 == 15
26
+ (thank you to John Reiser for pointing this out) */
27
+ # define CHOP(a) \
28
+ do { \
29
+ unsigned long tmp = a >> 16; \
30
+ a &= 0xffffUL; \
31
+ a += (tmp << 4) - tmp; \
32
+ } while (0)
33
+ # define MOD28(a) \
34
+ do { \
35
+ CHOP(a); \
36
+ if (a >= BASE) a -= BASE; \
37
+ } while (0)
38
+ # define MOD(a) \
39
+ do { \
40
+ CHOP(a); \
41
+ MOD28(a); \
42
+ } while (0)
43
+ # define MOD63(a) \
44
+ do { /* this assumes a is not negative */ \
45
+ z_off64_t tmp = a >> 32; \
46
+ a &= 0xffffffffL; \
47
+ a += (tmp << 8) - (tmp << 5) + tmp; \
48
+ tmp = a >> 16; \
49
+ a &= 0xffffL; \
50
+ a += (tmp << 4) - tmp; \
51
+ tmp = a >> 16; \
52
+ a &= 0xffffL; \
53
+ a += (tmp << 4) - tmp; \
54
+ if (a >= BASE) a -= BASE; \
55
+ } while (0)
56
+ #else
57
+ # define MOD(a) a %= BASE
58
+ # define MOD28(a) a %= BASE
59
+ # define MOD63(a) a %= BASE
60
+ #endif
61
+
62
+ /* ========================================================================= */
63
+ uLong ZEXPORT adler32_z(adler, buf, len)
64
+ uLong adler;
65
+ const Bytef *buf;
66
+ z_size_t len;
67
+ {
68
+ unsigned long sum2;
69
+ unsigned n;
70
+
71
+ /* split Adler-32 into component sums */
72
+ sum2 = (adler >> 16) & 0xffff;
73
+ adler &= 0xffff;
74
+
75
+ /* in case user likes doing a byte at a time, keep it fast */
76
+ if (len == 1) {
77
+ adler += buf[0];
78
+ if (adler >= BASE)
79
+ adler -= BASE;
80
+ sum2 += adler;
81
+ if (sum2 >= BASE)
82
+ sum2 -= BASE;
83
+ return adler | (sum2 << 16);
84
+ }
85
+
86
+ /* initial Adler-32 value (deferred check for len == 1 speed) */
87
+ if (buf == Z_NULL)
88
+ return 1L;
89
+
90
+ /* in case short lengths are provided, keep it somewhat fast */
91
+ if (len < 16) {
92
+ while (len--) {
93
+ adler += *buf++;
94
+ sum2 += adler;
95
+ }
96
+ if (adler >= BASE)
97
+ adler -= BASE;
98
+ MOD28(sum2); /* only added so many BASE's */
99
+ return adler | (sum2 << 16);
100
+ }
101
+
102
+ /* do length NMAX blocks -- requires just one modulo operation */
103
+ while (len >= NMAX) {
104
+ len -= NMAX;
105
+ n = NMAX / 16; /* NMAX is divisible by 16 */
106
+ do {
107
+ DO16(buf); /* 16 sums unrolled */
108
+ buf += 16;
109
+ } while (--n);
110
+ MOD(adler);
111
+ MOD(sum2);
112
+ }
113
+
114
+ /* do remaining bytes (less than NMAX, still just one modulo) */
115
+ if (len) { /* avoid modulos if none remaining */
116
+ while (len >= 16) {
117
+ len -= 16;
118
+ DO16(buf);
119
+ buf += 16;
120
+ }
121
+ while (len--) {
122
+ adler += *buf++;
123
+ sum2 += adler;
124
+ }
125
+ MOD(adler);
126
+ MOD(sum2);
127
+ }
128
+
129
+ /* return recombined sums */
130
+ return adler | (sum2 << 16);
131
+ }
132
+
133
+ /* ========================================================================= */
134
+ uLong ZEXPORT adler32(adler, buf, len)
135
+ uLong adler;
136
+ const Bytef *buf;
137
+ uInt len;
138
+ {
139
+ return adler32_z(adler, buf, len);
140
+ }
141
+
142
+ /* ========================================================================= */
143
+ local uLong adler32_combine_(adler1, adler2, len2)
144
+ uLong adler1;
145
+ uLong adler2;
146
+ z_off64_t len2;
147
+ {
148
+ unsigned long sum1;
149
+ unsigned long sum2;
150
+ unsigned rem;
151
+
152
+ /* for negative len, return invalid adler32 as a clue for debugging */
153
+ if (len2 < 0)
154
+ return 0xffffffffUL;
155
+
156
+ /* the derivation of this formula is left as an exercise for the reader */
157
+ MOD63(len2); /* assumes len2 >= 0 */
158
+ rem = (unsigned)len2;
159
+ sum1 = adler1 & 0xffff;
160
+ sum2 = rem * sum1;
161
+ MOD(sum2);
162
+ sum1 += (adler2 & 0xffff) + BASE - 1;
163
+ sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
164
+ if (sum1 >= BASE) sum1 -= BASE;
165
+ if (sum1 >= BASE) sum1 -= BASE;
166
+ if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
167
+ if (sum2 >= BASE) sum2 -= BASE;
168
+ return sum1 | (sum2 << 16);
169
+ }
170
+
171
+ /* ========================================================================= */
172
+ uLong ZEXPORT adler32_combine(adler1, adler2, len2)
173
+ uLong adler1;
174
+ uLong adler2;
175
+ z_off_t len2;
176
+ {
177
+ return adler32_combine_(adler1, adler2, len2);
178
+ }
179
+
180
+ uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
181
+ uLong adler1;
182
+ uLong adler2;
183
+ z_off64_t len2;
184
+ {
185
+ return adler32_combine_(adler1, adler2, len2);
186
+ }