extzstd 0.1.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/HISTORY.ja.md +18 -0
- data/README.md +15 -50
- data/contrib/zstd/CONTRIBUTING.md +1 -1
- data/contrib/zstd/COPYING +339 -0
- data/contrib/zstd/Makefile +82 -51
- data/contrib/zstd/NEWS +92 -5
- data/contrib/zstd/README.md +50 -41
- data/contrib/zstd/appveyor.yml +164 -102
- data/contrib/zstd/circle.yml +10 -22
- data/contrib/zstd/lib/BUCK +31 -10
- data/contrib/zstd/lib/Makefile +57 -31
- data/contrib/zstd/lib/README.md +68 -37
- data/contrib/zstd/lib/common/bitstream.h +130 -76
- data/contrib/zstd/lib/common/compiler.h +86 -0
- data/contrib/zstd/lib/common/error_private.c +15 -11
- data/contrib/zstd/lib/common/error_private.h +8 -8
- data/contrib/zstd/lib/common/fse.h +19 -9
- data/contrib/zstd/lib/common/fse_decompress.c +3 -22
- data/contrib/zstd/lib/common/huf.h +68 -26
- data/contrib/zstd/lib/common/mem.h +23 -35
- data/contrib/zstd/lib/common/pool.c +123 -63
- data/contrib/zstd/lib/common/pool.h +19 -10
- data/contrib/zstd/lib/common/threading.c +11 -16
- data/contrib/zstd/lib/common/threading.h +52 -33
- data/contrib/zstd/lib/common/xxhash.c +28 -22
- data/contrib/zstd/lib/common/zstd_common.c +40 -27
- data/contrib/zstd/lib/common/zstd_errors.h +43 -34
- data/contrib/zstd/lib/common/zstd_internal.h +131 -123
- data/contrib/zstd/lib/compress/fse_compress.c +17 -33
- data/contrib/zstd/lib/compress/huf_compress.c +15 -9
- data/contrib/zstd/lib/compress/zstd_compress.c +2096 -2363
- data/contrib/zstd/lib/compress/zstd_compress_internal.h +462 -0
- data/contrib/zstd/lib/compress/zstd_double_fast.c +309 -0
- data/contrib/zstd/lib/compress/zstd_double_fast.h +29 -0
- data/contrib/zstd/lib/compress/zstd_fast.c +243 -0
- data/contrib/zstd/lib/compress/zstd_fast.h +31 -0
- data/contrib/zstd/lib/compress/zstd_lazy.c +765 -0
- data/contrib/zstd/lib/compress/zstd_lazy.h +39 -0
- data/contrib/zstd/lib/compress/zstd_ldm.c +707 -0
- data/contrib/zstd/lib/compress/zstd_ldm.h +68 -0
- data/contrib/zstd/lib/compress/zstd_opt.c +785 -0
- data/contrib/zstd/lib/compress/zstd_opt.h +19 -908
- data/contrib/zstd/lib/compress/zstdmt_compress.c +737 -327
- data/contrib/zstd/lib/compress/zstdmt_compress.h +88 -26
- data/contrib/zstd/lib/decompress/huf_decompress.c +158 -50
- data/contrib/zstd/lib/decompress/zstd_decompress.c +884 -699
- data/contrib/zstd/lib/deprecated/zbuff.h +5 -4
- data/contrib/zstd/lib/deprecated/zbuff_common.c +5 -5
- data/contrib/zstd/lib/deprecated/zbuff_compress.c +6 -4
- data/contrib/zstd/lib/deprecated/zbuff_decompress.c +5 -4
- data/contrib/zstd/lib/dictBuilder/cover.c +93 -77
- data/contrib/zstd/lib/dictBuilder/zdict.c +107 -92
- data/contrib/zstd/lib/dictBuilder/zdict.h +112 -102
- data/contrib/zstd/lib/legacy/zstd_legacy.h +9 -4
- data/contrib/zstd/lib/legacy/zstd_v01.c +7 -6
- data/contrib/zstd/lib/legacy/zstd_v01.h +5 -4
- data/contrib/zstd/lib/legacy/zstd_v02.c +27 -99
- data/contrib/zstd/lib/legacy/zstd_v02.h +5 -4
- data/contrib/zstd/lib/legacy/zstd_v03.c +26 -98
- data/contrib/zstd/lib/legacy/zstd_v03.h +5 -4
- data/contrib/zstd/lib/legacy/zstd_v04.c +22 -91
- data/contrib/zstd/lib/legacy/zstd_v04.h +5 -4
- data/contrib/zstd/lib/legacy/zstd_v05.c +23 -99
- data/contrib/zstd/lib/legacy/zstd_v05.h +5 -4
- data/contrib/zstd/lib/legacy/zstd_v06.c +22 -96
- data/contrib/zstd/lib/legacy/zstd_v06.h +5 -4
- data/contrib/zstd/lib/legacy/zstd_v07.c +19 -95
- data/contrib/zstd/lib/legacy/zstd_v07.h +5 -4
- data/contrib/zstd/lib/zstd.h +895 -271
- data/ext/extconf.rb +11 -2
- data/ext/extzstd.c +45 -128
- data/ext/extzstd.h +74 -31
- data/ext/extzstd_stream.c +401 -142
- data/ext/zstd_common.c +5 -0
- data/ext/zstd_compress.c +8 -0
- data/ext/zstd_decompress.c +1 -0
- data/ext/zstd_dictbuilder.c +2 -0
- data/lib/extzstd/version.rb +1 -1
- data/lib/extzstd.rb +48 -1
- data/test/test_basic.rb +9 -1
- metadata +17 -7
- data/HISTORY.ja +0 -10
- data/contrib/zstd/LICENSE-examples +0 -11
- data/contrib/zstd/PATENTS +0 -33
data/ext/zstd_common.c
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
#define ZSTD_LEGACY_SUPPORT 1
|
2
2
|
#define MEM_MODULE 1
|
3
|
+
#define visibility(v) visibility("hidden")
|
3
4
|
|
4
5
|
#include "../contrib/zstd/lib/common/entropy_common.c"
|
5
6
|
#include "../contrib/zstd/lib/common/error_private.c"
|
6
7
|
#include "../contrib/zstd/lib/common/fse_decompress.c"
|
8
|
+
|
9
|
+
#undef CHECK_F
|
10
|
+
#include "../contrib/zstd/lib/common/pool.c"
|
11
|
+
#include "../contrib/zstd/lib/common/threading.c"
|
7
12
|
#include "../contrib/zstd/lib/common/xxhash.c"
|
8
13
|
#include "../contrib/zstd/lib/common/zstd_common.c"
|
data/ext/zstd_compress.c
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
#define ZSTD_LEGACY_SUPPORT 1
|
2
2
|
#define MEM_MODULE 1
|
3
|
+
#define visibility(v) visibility("hidden")
|
3
4
|
|
4
5
|
#include "../contrib/zstd/lib/compress/fse_compress.c"
|
5
6
|
#include "../contrib/zstd/lib/compress/huf_compress.c"
|
7
|
+
|
8
|
+
#undef CHECK_F
|
6
9
|
#include "../contrib/zstd/lib/compress/zstd_compress.c"
|
10
|
+
#include "../contrib/zstd/lib/compress/zstd_double_fast.c"
|
11
|
+
#include "../contrib/zstd/lib/compress/zstd_fast.c"
|
12
|
+
#include "../contrib/zstd/lib/compress/zstd_lazy.c"
|
13
|
+
#include "../contrib/zstd/lib/compress/zstd_ldm.c"
|
14
|
+
#include "../contrib/zstd/lib/compress/zstd_opt.c"
|
data/ext/zstd_decompress.c
CHANGED
data/ext/zstd_dictbuilder.c
CHANGED
data/lib/extzstd/version.rb
CHANGED
data/lib/extzstd.rb
CHANGED
@@ -59,6 +59,27 @@ module Zstd
|
|
59
59
|
Decoder.open(src, dict, &block)
|
60
60
|
end
|
61
61
|
|
62
|
+
StreamEncoder = Encoder
|
63
|
+
|
64
|
+
class Encoder
|
65
|
+
#
|
66
|
+
# call-seq:
|
67
|
+
# open(outport, level = nil, dict = nil) -> zstd encoder
|
68
|
+
# open(outport, encode_params, dict = nil) { |encoder| ... } -> yield returned value
|
69
|
+
#
|
70
|
+
def self.open(outport, *args)
|
71
|
+
e = new(outport, *args)
|
72
|
+
|
73
|
+
return e unless block_given?
|
74
|
+
|
75
|
+
begin
|
76
|
+
yield e
|
77
|
+
ensure
|
78
|
+
e.close rescue nil unless e.eof?
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
62
83
|
class Encoder < Struct.new(:encoder, :outport, :destbuf, :status)
|
63
84
|
#
|
64
85
|
# call-seq:
|
@@ -128,6 +149,32 @@ module Zstd
|
|
128
149
|
|
129
150
|
self
|
130
151
|
end
|
152
|
+
end if false
|
153
|
+
|
154
|
+
StreamDecoder = Decoder
|
155
|
+
|
156
|
+
class Decoder
|
157
|
+
#
|
158
|
+
# call-seq:
|
159
|
+
# open(inport, dict = nil) -> decoder
|
160
|
+
# open(inport, dict = nil) { |decoder| ... } -> yield returned value
|
161
|
+
#
|
162
|
+
# [inport]
|
163
|
+
# String instance or +read+ method haved Object.
|
164
|
+
#
|
165
|
+
def self.open(inport, dict = nil)
|
166
|
+
inport = StringIO.new(inport) if inport.kind_of?(String)
|
167
|
+
|
168
|
+
dec = new(inport, dict)
|
169
|
+
|
170
|
+
return dec unless block_given?
|
171
|
+
|
172
|
+
begin
|
173
|
+
yield(dec)
|
174
|
+
ensure
|
175
|
+
dec.close rescue nil
|
176
|
+
end
|
177
|
+
end
|
131
178
|
end
|
132
179
|
|
133
180
|
class Decoder
|
@@ -243,7 +290,7 @@ module Zstd
|
|
243
290
|
@status = nil
|
244
291
|
nil
|
245
292
|
end
|
246
|
-
end
|
293
|
+
end if false
|
247
294
|
|
248
295
|
class Parameters
|
249
296
|
def inspect
|
data/test/test_basic.rb
CHANGED
@@ -32,7 +32,15 @@ class TestZstd < Test::Unit::TestCase
|
|
32
32
|
d.pos = 0
|
33
33
|
size_b = 0
|
34
34
|
md5b = Digest::MD5.new
|
35
|
-
|
35
|
+
partial_list = [262144, 1, 262144, 262142, 524288, 524280, 99, 999, 9999, 99999, 999999, 9999999, nil]
|
36
|
+
Zstd.decode(d) do |z|
|
37
|
+
buf = ""
|
38
|
+
while z.read(s = partial_list.shift, buf)
|
39
|
+
assert_equal s, buf.bytesize if s
|
40
|
+
size_b += buf.bytesize
|
41
|
+
md5b.update buf
|
42
|
+
end
|
43
|
+
end
|
36
44
|
assert_equal size_a, size_b
|
37
45
|
assert_equal(md5a.hexdigest, md5b.hexdigest)
|
38
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extzstd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dearblue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -32,7 +32,7 @@ executables: []
|
|
32
32
|
extensions:
|
33
33
|
- ext/extconf.rb
|
34
34
|
extra_rdoc_files:
|
35
|
-
- HISTORY.ja
|
35
|
+
- HISTORY.ja.md
|
36
36
|
- LICENSE
|
37
37
|
- README.md
|
38
38
|
- contrib/zstd/LICENSE
|
@@ -56,16 +56,15 @@ extra_rdoc_files:
|
|
56
56
|
- lib/extzstd.rb
|
57
57
|
- lib/extzstd/version.rb
|
58
58
|
files:
|
59
|
-
- HISTORY.ja
|
59
|
+
- HISTORY.ja.md
|
60
60
|
- LICENSE
|
61
61
|
- README.md
|
62
62
|
- Rakefile
|
63
63
|
- contrib/zstd/CONTRIBUTING.md
|
64
|
+
- contrib/zstd/COPYING
|
64
65
|
- contrib/zstd/LICENSE
|
65
|
-
- contrib/zstd/LICENSE-examples
|
66
66
|
- contrib/zstd/Makefile
|
67
67
|
- contrib/zstd/NEWS
|
68
|
-
- contrib/zstd/PATENTS
|
69
68
|
- contrib/zstd/README.md
|
70
69
|
- contrib/zstd/TESTING.md
|
71
70
|
- contrib/zstd/appveyor.yml
|
@@ -74,6 +73,7 @@ files:
|
|
74
73
|
- contrib/zstd/lib/Makefile
|
75
74
|
- contrib/zstd/lib/README.md
|
76
75
|
- contrib/zstd/lib/common/bitstream.h
|
76
|
+
- contrib/zstd/lib/common/compiler.h
|
77
77
|
- contrib/zstd/lib/common/entropy_common.c
|
78
78
|
- contrib/zstd/lib/common/error_private.c
|
79
79
|
- contrib/zstd/lib/common/error_private.h
|
@@ -93,6 +93,16 @@ files:
|
|
93
93
|
- contrib/zstd/lib/compress/fse_compress.c
|
94
94
|
- contrib/zstd/lib/compress/huf_compress.c
|
95
95
|
- contrib/zstd/lib/compress/zstd_compress.c
|
96
|
+
- contrib/zstd/lib/compress/zstd_compress_internal.h
|
97
|
+
- contrib/zstd/lib/compress/zstd_double_fast.c
|
98
|
+
- contrib/zstd/lib/compress/zstd_double_fast.h
|
99
|
+
- contrib/zstd/lib/compress/zstd_fast.c
|
100
|
+
- contrib/zstd/lib/compress/zstd_fast.h
|
101
|
+
- contrib/zstd/lib/compress/zstd_lazy.c
|
102
|
+
- contrib/zstd/lib/compress/zstd_lazy.h
|
103
|
+
- contrib/zstd/lib/compress/zstd_ldm.c
|
104
|
+
- contrib/zstd/lib/compress/zstd_ldm.h
|
105
|
+
- contrib/zstd/lib/compress/zstd_opt.c
|
96
106
|
- contrib/zstd/lib/compress/zstd_opt.h
|
97
107
|
- contrib/zstd/lib/compress/zstdmt_compress.c
|
98
108
|
- contrib/zstd/lib/compress/zstdmt_compress.h
|
@@ -169,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
179
|
version: '0'
|
170
180
|
requirements: []
|
171
181
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.7.4
|
173
183
|
signing_key:
|
174
184
|
specification_version: 4
|
175
185
|
summary: ruby bindings for Zstandard (zstd)
|
data/HISTORY.ja
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
|
2
|
-
|
3
|
-
The examples provided by Facebook are for non-commercial testing and evaluation
|
4
|
-
purposes only. Facebook reserves all rights not expressly granted.
|
5
|
-
|
6
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
7
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
8
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
9
|
-
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
10
|
-
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
11
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/contrib/zstd/PATENTS
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
Additional Grant of Patent Rights Version 2
|
2
|
-
|
3
|
-
"Software" means the Zstandard software distributed by Facebook, Inc.
|
4
|
-
|
5
|
-
Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
|
6
|
-
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
|
7
|
-
(subject to the termination provision below) license under any Necessary
|
8
|
-
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
|
9
|
-
transfer the Software. For avoidance of doubt, no license is granted under
|
10
|
-
Facebook’s rights in any patent claims that are infringed by (i) modifications
|
11
|
-
to the Software made by you or any third party or (ii) the Software in
|
12
|
-
combination with any software or other technology.
|
13
|
-
|
14
|
-
The license granted hereunder will terminate, automatically and without notice,
|
15
|
-
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
|
16
|
-
directly or indirectly, or take a direct financial interest in, any Patent
|
17
|
-
Assertion: (i) against Facebook or any of its subsidiaries or corporate
|
18
|
-
affiliates, (ii) against any party if such Patent Assertion arises in whole or
|
19
|
-
in part from any software, technology, product or service of Facebook or any of
|
20
|
-
its subsidiaries or corporate affiliates, or (iii) against any party relating
|
21
|
-
to the Software. Notwithstanding the foregoing, if Facebook or any of its
|
22
|
-
subsidiaries or corporate affiliates files a lawsuit alleging patent
|
23
|
-
infringement against you in the first instance, and you respond by filing a
|
24
|
-
patent infringement counterclaim in that lawsuit against that party that is
|
25
|
-
unrelated to the Software, the license granted hereunder will not terminate
|
26
|
-
under section (i) of this paragraph due to such counterclaim.
|
27
|
-
|
28
|
-
A "Necessary Claim" is a claim of a patent owned by Facebook that is
|
29
|
-
necessarily infringed by the Software standing alone.
|
30
|
-
|
31
|
-
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
|
32
|
-
or contributory infringement or inducement to infringe any patent, including a
|
33
|
-
cross-claim or counterclaim.
|