chd 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +30 -0
- data/chd.gemspec +29 -0
- data/ext/chd.c +1008 -0
- data/ext/extconf.rb +60 -0
- data/lib/chd/cd.rb +272 -0
- data/lib/chd/metadata.rb +196 -0
- data/lib/chd/version.rb +4 -0
- data/lib/chd.rb +21 -0
- data/libchdr/CMakeLists.txt +104 -0
- data/libchdr/LICENSE.txt +24 -0
- data/libchdr/README.md +7 -0
- data/libchdr/deps/lzma-19.00/CMakeLists.txt +33 -0
- data/libchdr/deps/lzma-19.00/LICENSE +3 -0
- data/libchdr/deps/lzma-19.00/include/7zTypes.h +375 -0
- data/libchdr/deps/lzma-19.00/include/Alloc.h +51 -0
- data/libchdr/deps/lzma-19.00/include/Bra.h +64 -0
- data/libchdr/deps/lzma-19.00/include/Compiler.h +33 -0
- data/libchdr/deps/lzma-19.00/include/CpuArch.h +336 -0
- data/libchdr/deps/lzma-19.00/include/Delta.h +19 -0
- data/libchdr/deps/lzma-19.00/include/LzFind.h +121 -0
- data/libchdr/deps/lzma-19.00/include/LzHash.h +57 -0
- data/libchdr/deps/lzma-19.00/include/Lzma86.h +111 -0
- data/libchdr/deps/lzma-19.00/include/LzmaDec.h +234 -0
- data/libchdr/deps/lzma-19.00/include/LzmaEnc.h +76 -0
- data/libchdr/deps/lzma-19.00/include/LzmaLib.h +131 -0
- data/libchdr/deps/lzma-19.00/include/Precomp.h +10 -0
- data/libchdr/deps/lzma-19.00/include/Sort.h +18 -0
- data/libchdr/deps/lzma-19.00/lzma-history.txt +446 -0
- data/libchdr/deps/lzma-19.00/lzma.txt +328 -0
- data/libchdr/deps/lzma-19.00/lzma.vcxproj +543 -0
- data/libchdr/deps/lzma-19.00/lzma.vcxproj.filters +17 -0
- data/libchdr/deps/lzma-19.00/src/Alloc.c +455 -0
- data/libchdr/deps/lzma-19.00/src/Bra86.c +82 -0
- data/libchdr/deps/lzma-19.00/src/BraIA64.c +53 -0
- data/libchdr/deps/lzma-19.00/src/CpuArch.c +218 -0
- data/libchdr/deps/lzma-19.00/src/Delta.c +64 -0
- data/libchdr/deps/lzma-19.00/src/LzFind.c +1127 -0
- data/libchdr/deps/lzma-19.00/src/Lzma86Dec.c +54 -0
- data/libchdr/deps/lzma-19.00/src/LzmaDec.c +1185 -0
- data/libchdr/deps/lzma-19.00/src/LzmaEnc.c +1330 -0
- data/libchdr/deps/lzma-19.00/src/Sort.c +141 -0
- data/libchdr/deps/zlib-1.2.11/CMakeLists.txt +29 -0
- data/libchdr/deps/zlib-1.2.11/ChangeLog +1515 -0
- data/libchdr/deps/zlib-1.2.11/FAQ +368 -0
- data/libchdr/deps/zlib-1.2.11/INDEX +68 -0
- data/libchdr/deps/zlib-1.2.11/Makefile +5 -0
- data/libchdr/deps/zlib-1.2.11/Makefile.in +410 -0
- data/libchdr/deps/zlib-1.2.11/README +115 -0
- data/libchdr/deps/zlib-1.2.11/adler32.c +186 -0
- data/libchdr/deps/zlib-1.2.11/compress.c +86 -0
- data/libchdr/deps/zlib-1.2.11/configure +921 -0
- data/libchdr/deps/zlib-1.2.11/crc32.c +442 -0
- data/libchdr/deps/zlib-1.2.11/crc32.h +441 -0
- data/libchdr/deps/zlib-1.2.11/deflate.c +2163 -0
- data/libchdr/deps/zlib-1.2.11/deflate.h +349 -0
- data/libchdr/deps/zlib-1.2.11/doc/algorithm.txt +209 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1950.txt +619 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1951.txt +955 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1952.txt +675 -0
- data/libchdr/deps/zlib-1.2.11/doc/txtvsbin.txt +107 -0
- data/libchdr/deps/zlib-1.2.11/gzclose.c +25 -0
- data/libchdr/deps/zlib-1.2.11/gzguts.h +218 -0
- data/libchdr/deps/zlib-1.2.11/gzlib.c +637 -0
- data/libchdr/deps/zlib-1.2.11/gzread.c +654 -0
- data/libchdr/deps/zlib-1.2.11/gzwrite.c +665 -0
- data/libchdr/deps/zlib-1.2.11/infback.c +640 -0
- data/libchdr/deps/zlib-1.2.11/inffast.c +323 -0
- data/libchdr/deps/zlib-1.2.11/inffast.h +11 -0
- data/libchdr/deps/zlib-1.2.11/inffixed.h +94 -0
- data/libchdr/deps/zlib-1.2.11/inflate.c +1561 -0
- data/libchdr/deps/zlib-1.2.11/inflate.h +125 -0
- data/libchdr/deps/zlib-1.2.11/inftrees.c +304 -0
- data/libchdr/deps/zlib-1.2.11/inftrees.h +62 -0
- data/libchdr/deps/zlib-1.2.11/make_vms.com +867 -0
- data/libchdr/deps/zlib-1.2.11/treebuild.xml +116 -0
- data/libchdr/deps/zlib-1.2.11/trees.c +1203 -0
- data/libchdr/deps/zlib-1.2.11/trees.h +128 -0
- data/libchdr/deps/zlib-1.2.11/uncompr.c +93 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h +534 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h.cmakein +536 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h.in +534 -0
- data/libchdr/deps/zlib-1.2.11/zlib.3 +149 -0
- data/libchdr/deps/zlib-1.2.11/zlib.3.pdf +0 -0
- data/libchdr/deps/zlib-1.2.11/zlib.h +1912 -0
- data/libchdr/deps/zlib-1.2.11/zlib.map +94 -0
- data/libchdr/deps/zlib-1.2.11/zlib.pc.cmakein +13 -0
- data/libchdr/deps/zlib-1.2.11/zlib.pc.in +13 -0
- data/libchdr/deps/zlib-1.2.11/zlib2ansi +152 -0
- data/libchdr/deps/zlib-1.2.11/zutil.c +325 -0
- data/libchdr/deps/zlib-1.2.11/zutil.h +271 -0
- data/libchdr/include/dr_libs/dr_flac.h +12280 -0
- data/libchdr/include/libchdr/bitstream.h +43 -0
- data/libchdr/include/libchdr/cdrom.h +110 -0
- data/libchdr/include/libchdr/chd.h +427 -0
- data/libchdr/include/libchdr/chdconfig.h +10 -0
- data/libchdr/include/libchdr/coretypes.h +60 -0
- data/libchdr/include/libchdr/flac.h +50 -0
- data/libchdr/include/libchdr/huffman.h +90 -0
- data/libchdr/pkg-config.pc.in +10 -0
- data/libchdr/src/libchdr_bitstream.c +125 -0
- data/libchdr/src/libchdr_cdrom.c +415 -0
- data/libchdr/src/libchdr_chd.c +2744 -0
- data/libchdr/src/libchdr_flac.c +302 -0
- data/libchdr/src/libchdr_huffman.c +545 -0
- data/libchdr/src/link.T +5 -0
- data/libchdr/tests/CMakeLists.txt +2 -0
- data/libchdr/tests/benchmark.c +52 -0
- metadata +183 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
/* compress.c -- compress a memory buffer
|
2
|
+
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
|
3
|
+
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
|
+
*/
|
5
|
+
|
6
|
+
/* @(#) $Id$ */
|
7
|
+
|
8
|
+
#define ZLIB_INTERNAL
|
9
|
+
#include "zlib.h"
|
10
|
+
|
11
|
+
/* ===========================================================================
|
12
|
+
Compresses the source buffer into the destination buffer. The level
|
13
|
+
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
14
|
+
length of the source buffer. Upon entry, destLen is the total size of the
|
15
|
+
destination buffer, which must be at least 0.1% larger than sourceLen plus
|
16
|
+
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
|
17
|
+
|
18
|
+
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
19
|
+
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
20
|
+
Z_STREAM_ERROR if the level parameter is invalid.
|
21
|
+
*/
|
22
|
+
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
|
23
|
+
Bytef *dest;
|
24
|
+
uLongf *destLen;
|
25
|
+
const Bytef *source;
|
26
|
+
uLong sourceLen;
|
27
|
+
int level;
|
28
|
+
{
|
29
|
+
z_stream stream;
|
30
|
+
int err;
|
31
|
+
const uInt max = (uInt)-1;
|
32
|
+
uLong left;
|
33
|
+
|
34
|
+
left = *destLen;
|
35
|
+
*destLen = 0;
|
36
|
+
|
37
|
+
stream.zalloc = (alloc_func)0;
|
38
|
+
stream.zfree = (free_func)0;
|
39
|
+
stream.opaque = (voidpf)0;
|
40
|
+
|
41
|
+
err = deflateInit(&stream, level);
|
42
|
+
if (err != Z_OK) return err;
|
43
|
+
|
44
|
+
stream.next_out = dest;
|
45
|
+
stream.avail_out = 0;
|
46
|
+
stream.next_in = (z_const Bytef *)source;
|
47
|
+
stream.avail_in = 0;
|
48
|
+
|
49
|
+
do {
|
50
|
+
if (stream.avail_out == 0) {
|
51
|
+
stream.avail_out = left > (uLong)max ? max : (uInt)left;
|
52
|
+
left -= stream.avail_out;
|
53
|
+
}
|
54
|
+
if (stream.avail_in == 0) {
|
55
|
+
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
|
56
|
+
sourceLen -= stream.avail_in;
|
57
|
+
}
|
58
|
+
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
|
59
|
+
} while (err == Z_OK);
|
60
|
+
|
61
|
+
*destLen = stream.total_out;
|
62
|
+
deflateEnd(&stream);
|
63
|
+
return err == Z_STREAM_END ? Z_OK : err;
|
64
|
+
}
|
65
|
+
|
66
|
+
/* ===========================================================================
|
67
|
+
*/
|
68
|
+
int ZEXPORT compress (dest, destLen, source, sourceLen)
|
69
|
+
Bytef *dest;
|
70
|
+
uLongf *destLen;
|
71
|
+
const Bytef *source;
|
72
|
+
uLong sourceLen;
|
73
|
+
{
|
74
|
+
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
75
|
+
}
|
76
|
+
|
77
|
+
/* ===========================================================================
|
78
|
+
If the default memLevel or windowBits for deflateInit() is changed, then
|
79
|
+
this function needs to be updated.
|
80
|
+
*/
|
81
|
+
uLong ZEXPORT compressBound (sourceLen)
|
82
|
+
uLong sourceLen;
|
83
|
+
{
|
84
|
+
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
85
|
+
(sourceLen >> 25) + 13;
|
86
|
+
}
|