extzstd 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -14
- data/contrib/zstd/CHANGELOG +114 -56
- data/contrib/zstd/CONTRIBUTING.md +14 -0
- data/contrib/zstd/Makefile +37 -31
- data/contrib/zstd/README.md +6 -0
- data/contrib/zstd/appveyor.yml +4 -1
- data/contrib/zstd/lib/Makefile +231 -134
- data/contrib/zstd/lib/README.md +28 -0
- data/contrib/zstd/lib/common/bitstream.h +24 -15
- data/contrib/zstd/lib/common/compiler.h +116 -3
- data/contrib/zstd/lib/common/cpu.h +0 -2
- data/contrib/zstd/lib/common/debug.h +11 -18
- data/contrib/zstd/lib/common/entropy_common.c +188 -42
- data/contrib/zstd/lib/common/error_private.c +1 -0
- data/contrib/zstd/lib/common/error_private.h +1 -1
- data/contrib/zstd/lib/common/fse.h +38 -11
- data/contrib/zstd/lib/common/fse_decompress.c +123 -16
- data/contrib/zstd/lib/common/huf.h +26 -5
- data/contrib/zstd/lib/common/mem.h +66 -93
- data/contrib/zstd/lib/common/pool.c +22 -16
- data/contrib/zstd/lib/common/pool.h +1 -1
- data/contrib/zstd/lib/common/threading.c +6 -5
- data/contrib/zstd/lib/common/xxhash.c +18 -56
- data/contrib/zstd/lib/common/xxhash.h +1 -1
- data/contrib/zstd/lib/common/zstd_common.c +9 -9
- data/contrib/zstd/lib/common/zstd_deps.h +111 -0
- data/contrib/zstd/lib/common/zstd_errors.h +1 -0
- data/contrib/zstd/lib/common/zstd_internal.h +89 -58
- data/contrib/zstd/lib/compress/fse_compress.c +30 -23
- data/contrib/zstd/lib/compress/hist.c +26 -28
- data/contrib/zstd/lib/compress/hist.h +1 -1
- data/contrib/zstd/lib/compress/huf_compress.c +210 -95
- data/contrib/zstd/lib/compress/zstd_compress.c +1339 -409
- data/contrib/zstd/lib/compress/zstd_compress_internal.h +119 -41
- data/contrib/zstd/lib/compress/zstd_compress_literals.c +4 -4
- data/contrib/zstd/lib/compress/zstd_compress_sequences.c +17 -3
- data/contrib/zstd/lib/compress/zstd_compress_superblock.c +23 -19
- data/contrib/zstd/lib/compress/zstd_cwksp.h +60 -24
- data/contrib/zstd/lib/compress/zstd_double_fast.c +22 -22
- data/contrib/zstd/lib/compress/zstd_fast.c +19 -19
- data/contrib/zstd/lib/compress/zstd_lazy.c +351 -77
- data/contrib/zstd/lib/compress/zstd_lazy.h +20 -0
- data/contrib/zstd/lib/compress/zstd_ldm.c +59 -18
- data/contrib/zstd/lib/compress/zstd_ldm.h +6 -0
- data/contrib/zstd/lib/compress/zstd_opt.c +190 -45
- data/contrib/zstd/lib/compress/zstdmt_compress.c +74 -406
- data/contrib/zstd/lib/compress/zstdmt_compress.h +26 -108
- data/contrib/zstd/lib/decompress/huf_decompress.c +302 -200
- data/contrib/zstd/lib/decompress/zstd_ddict.c +8 -8
- data/contrib/zstd/lib/decompress/zstd_ddict.h +1 -1
- data/contrib/zstd/lib/decompress/zstd_decompress.c +125 -80
- data/contrib/zstd/lib/decompress/zstd_decompress_block.c +145 -37
- data/contrib/zstd/lib/decompress/zstd_decompress_block.h +5 -2
- data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +11 -10
- data/contrib/zstd/lib/dictBuilder/cover.c +29 -20
- data/contrib/zstd/lib/dictBuilder/cover.h +1 -1
- data/contrib/zstd/lib/dictBuilder/fastcover.c +20 -19
- data/contrib/zstd/lib/dictBuilder/zdict.c +15 -16
- data/contrib/zstd/lib/dictBuilder/zdict.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v01.c +5 -1
- data/contrib/zstd/lib/legacy/zstd_v02.c +5 -1
- data/contrib/zstd/lib/legacy/zstd_v03.c +5 -1
- data/contrib/zstd/lib/legacy/zstd_v04.c +6 -2
- data/contrib/zstd/lib/legacy/zstd_v05.c +5 -1
- data/contrib/zstd/lib/legacy/zstd_v06.c +5 -1
- data/contrib/zstd/lib/legacy/zstd_v07.c +5 -1
- data/contrib/zstd/lib/libzstd.pc.in +3 -3
- data/contrib/zstd/lib/zstd.h +348 -47
- data/ext/extzstd.c +6 -0
- data/ext/extzstd.h +6 -0
- data/gemstub.rb +3 -21
- data/lib/extzstd.rb +0 -2
- data/lib/extzstd/version.rb +6 -1
- data/test/test_basic.rb +0 -5
- metadata +5 -4
data/ext/extzstd.c
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
#include <zstd_errors.h>
|
4
4
|
#include <zdict.h>
|
5
5
|
|
6
|
+
#ifndef RB_EXT_RACTOR_SAFE
|
7
|
+
# define RB_EXT_RACTOR_SAFE(FEATURE) ((void)(FEATURE))
|
8
|
+
#endif
|
9
|
+
|
6
10
|
VALUE extzstd_mZstd;
|
7
11
|
|
8
12
|
static ID id_initialize;
|
@@ -613,6 +617,8 @@ init_contextless(void)
|
|
613
617
|
RBEXT_API void
|
614
618
|
Init_extzstd(void)
|
615
619
|
{
|
620
|
+
RB_EXT_RACTOR_SAFE(true);
|
621
|
+
|
616
622
|
id_initialize = rb_intern("initialize");
|
617
623
|
id_error_code = rb_intern("error_code");
|
618
624
|
|
data/ext/extzstd.h
CHANGED
@@ -7,8 +7,10 @@
|
|
7
7
|
#include <common/zstd_internal.h> /* for MIN() */
|
8
8
|
#include <zstd.h>
|
9
9
|
#include <stdarg.h>
|
10
|
+
#include <stdbool.h>
|
10
11
|
#include <ruby.h>
|
11
12
|
#include <ruby/thread.h>
|
13
|
+
#include <ruby/version.h>
|
12
14
|
|
13
15
|
#define ELEMENTOF(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
|
14
16
|
#define ENDOF(ARRAY) (ARRAY + ELEMENTOF(ARRAY))
|
@@ -226,4 +228,8 @@ aux_string_expand_pointer(VALUE str, char **ptr, size_t size)
|
|
226
228
|
*ptr = RSTRING_PTR(str);
|
227
229
|
}
|
228
230
|
|
231
|
+
#if RUBY_API_VERSION_CODE >= 30000
|
232
|
+
# define rb_obj_infect(dest, src) ((void)(dest), (void)(src))
|
233
|
+
#endif
|
234
|
+
|
229
235
|
#endif /* EXTZSTD_H */
|
data/gemstub.rb
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
|
2
|
-
unless File.read("README.md", mode: "rt") =~ verreg
|
3
|
-
raise "``version'' is not defined or bad syntax in ``README.md''"
|
4
|
-
end
|
5
|
-
|
6
|
-
version = String($1)
|
1
|
+
require_relative "lib/extzstd/version"
|
7
2
|
|
8
3
|
GEMSTUB = Gem::Specification.new do |s|
|
9
4
|
s.name = "extzstd"
|
10
|
-
s.version =
|
5
|
+
s.version = Zstd::VERSION
|
11
6
|
s.summary = "ruby bindings for Zstandard (zstd)"
|
12
7
|
s.description = <<EOS
|
13
8
|
unoficial ruby bindings for Zstandard (zstd) <https://github.com/facebook/zstd>.
|
@@ -15,25 +10,12 @@ EOS
|
|
15
10
|
s.homepage = "https://github.com/dearblue/ruby-extzstd/"
|
16
11
|
s.license = "BSD-2-Clause"
|
17
12
|
s.author = "dearblue"
|
18
|
-
s.email = "dearblue@users.
|
13
|
+
s.email = "dearblue@users.osdn.me"
|
19
14
|
|
20
15
|
s.required_ruby_version = ">= 2.0"
|
21
16
|
s.add_development_dependency "rake", ">= 12.0"
|
22
17
|
end
|
23
18
|
|
24
|
-
LIB << "lib/extzstd/version.rb"
|
25
|
-
|
26
|
-
file "lib/extzstd/version.rb" => %w(README.md) do
|
27
|
-
GEMSTUB.version = version
|
28
|
-
|
29
|
-
mkpath "lib/extzstd"
|
30
|
-
File.write "lib/extzstd/version.rb", <<-"EOS", mode: "wb"
|
31
|
-
module Zstd
|
32
|
-
VERSION = #{version.inspect}
|
33
|
-
end
|
34
|
-
EOS
|
35
|
-
end
|
36
|
-
|
37
19
|
EXTRA.concat(FileList["contrib/**/*"])
|
38
20
|
|
39
21
|
filter = %r(contrib/zstd/(?:build|contrib|doc|examples|lib/dll|programs|tests|zlibWrapper))
|
data/lib/extzstd.rb
CHANGED
data/lib/extzstd/version.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
1
|
module Zstd
|
2
|
-
|
2
|
+
verreg = /^\s*[\-\*]\s+version:\s*(\d+(?:\.\w+)+)\s*$/i
|
3
|
+
unless File.read("#{__dir__}/../../README.md", mode: "rt") =~ verreg
|
4
|
+
raise "``version'' is not defined or bad syntax in ``README.md''"
|
5
|
+
end
|
6
|
+
|
7
|
+
VERSION = String($1)
|
3
8
|
end
|
data/test/test_basic.rb
CHANGED
@@ -9,11 +9,6 @@ class TestZstd < Test::Unit::TestCase
|
|
9
9
|
src = "ABCDEFGabcdefg" * 50
|
10
10
|
assert_equal(src, Zstd.decode(Zstd.encode(src), src.bytesize))
|
11
11
|
#assert_raise(Zstd::Error) { Zstd.decode("", 1111) }
|
12
|
-
d1 = Zstd.encode(src)
|
13
|
-
assert_same(src.tainted?, Zstd.encode(src).tainted?)
|
14
|
-
src1 = src.dup
|
15
|
-
src1.taint
|
16
|
-
assert_same(src1.tainted?, Zstd.encode(src1).tainted?)
|
17
12
|
end
|
18
13
|
|
19
14
|
def test_huge
|
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.3.
|
4
|
+
version: 0.3.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: 2021-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
description: 'unoficial ruby bindings for Zstandard (zstd) <https://github.com/facebook/zstd>.
|
28
28
|
|
29
29
|
'
|
30
|
-
email: dearblue@users.
|
30
|
+
email: dearblue@users.osdn.me
|
31
31
|
executables: []
|
32
32
|
extensions:
|
33
33
|
- ext/extconf.rb
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- contrib/zstd/lib/common/xxhash.c
|
95
95
|
- contrib/zstd/lib/common/xxhash.h
|
96
96
|
- contrib/zstd/lib/common/zstd_common.c
|
97
|
+
- contrib/zstd/lib/common/zstd_deps.h
|
97
98
|
- contrib/zstd/lib/common/zstd_errors.h
|
98
99
|
- contrib/zstd/lib/common/zstd_internal.h
|
99
100
|
- contrib/zstd/lib/compress/fse_compress.c
|
@@ -202,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
203
|
- !ruby/object:Gem::Version
|
203
204
|
version: '0'
|
204
205
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
206
|
+
rubygems_version: 3.2.14
|
206
207
|
signing_key:
|
207
208
|
specification_version: 4
|
208
209
|
summary: ruby bindings for Zstandard (zstd)
|