extzstd 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.ja.md +8 -0
  3. data/README.md +1 -1
  4. data/contrib/zstd/CHANGELOG +94 -0
  5. data/contrib/zstd/CONTRIBUTING.md +351 -1
  6. data/contrib/zstd/Makefile +32 -10
  7. data/contrib/zstd/README.md +33 -10
  8. data/contrib/zstd/TESTING.md +2 -2
  9. data/contrib/zstd/appveyor.yml +42 -4
  10. data/contrib/zstd/lib/Makefile +128 -60
  11. data/contrib/zstd/lib/README.md +47 -16
  12. data/contrib/zstd/lib/common/bitstream.h +38 -39
  13. data/contrib/zstd/lib/common/compiler.h +40 -5
  14. data/contrib/zstd/lib/common/cpu.h +1 -1
  15. data/contrib/zstd/lib/common/debug.c +11 -31
  16. data/contrib/zstd/lib/common/debug.h +11 -31
  17. data/contrib/zstd/lib/common/entropy_common.c +13 -33
  18. data/contrib/zstd/lib/common/error_private.c +2 -1
  19. data/contrib/zstd/lib/common/error_private.h +6 -2
  20. data/contrib/zstd/lib/common/fse.h +12 -32
  21. data/contrib/zstd/lib/common/fse_decompress.c +12 -35
  22. data/contrib/zstd/lib/common/huf.h +15 -33
  23. data/contrib/zstd/lib/common/mem.h +75 -2
  24. data/contrib/zstd/lib/common/pool.c +8 -4
  25. data/contrib/zstd/lib/common/pool.h +2 -2
  26. data/contrib/zstd/lib/common/threading.c +50 -4
  27. data/contrib/zstd/lib/common/threading.h +36 -4
  28. data/contrib/zstd/lib/common/xxhash.c +23 -35
  29. data/contrib/zstd/lib/common/xxhash.h +11 -31
  30. data/contrib/zstd/lib/common/zstd_common.c +1 -1
  31. data/contrib/zstd/lib/common/zstd_errors.h +2 -1
  32. data/contrib/zstd/lib/common/zstd_internal.h +154 -26
  33. data/contrib/zstd/lib/compress/fse_compress.c +17 -40
  34. data/contrib/zstd/lib/compress/hist.c +15 -35
  35. data/contrib/zstd/lib/compress/hist.h +12 -32
  36. data/contrib/zstd/lib/compress/huf_compress.c +92 -92
  37. data/contrib/zstd/lib/compress/zstd_compress.c +1191 -1330
  38. data/contrib/zstd/lib/compress/zstd_compress_internal.h +317 -55
  39. data/contrib/zstd/lib/compress/zstd_compress_literals.c +158 -0
  40. data/contrib/zstd/lib/compress/zstd_compress_literals.h +29 -0
  41. data/contrib/zstd/lib/compress/zstd_compress_sequences.c +419 -0
  42. data/contrib/zstd/lib/compress/zstd_compress_sequences.h +54 -0
  43. data/contrib/zstd/lib/compress/zstd_compress_superblock.c +845 -0
  44. data/contrib/zstd/lib/compress/zstd_compress_superblock.h +32 -0
  45. data/contrib/zstd/lib/compress/zstd_cwksp.h +525 -0
  46. data/contrib/zstd/lib/compress/zstd_double_fast.c +65 -43
  47. data/contrib/zstd/lib/compress/zstd_double_fast.h +2 -2
  48. data/contrib/zstd/lib/compress/zstd_fast.c +92 -66
  49. data/contrib/zstd/lib/compress/zstd_fast.h +2 -2
  50. data/contrib/zstd/lib/compress/zstd_lazy.c +74 -42
  51. data/contrib/zstd/lib/compress/zstd_lazy.h +1 -1
  52. data/contrib/zstd/lib/compress/zstd_ldm.c +32 -10
  53. data/contrib/zstd/lib/compress/zstd_ldm.h +7 -2
  54. data/contrib/zstd/lib/compress/zstd_opt.c +81 -114
  55. data/contrib/zstd/lib/compress/zstd_opt.h +1 -1
  56. data/contrib/zstd/lib/compress/zstdmt_compress.c +95 -51
  57. data/contrib/zstd/lib/compress/zstdmt_compress.h +3 -2
  58. data/contrib/zstd/lib/decompress/huf_decompress.c +76 -60
  59. data/contrib/zstd/lib/decompress/zstd_ddict.c +12 -8
  60. data/contrib/zstd/lib/decompress/zstd_ddict.h +2 -2
  61. data/contrib/zstd/lib/decompress/zstd_decompress.c +292 -172
  62. data/contrib/zstd/lib/decompress/zstd_decompress_block.c +459 -338
  63. data/contrib/zstd/lib/decompress/zstd_decompress_block.h +3 -3
  64. data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +18 -4
  65. data/contrib/zstd/lib/deprecated/zbuff.h +9 -8
  66. data/contrib/zstd/lib/deprecated/zbuff_common.c +2 -2
  67. data/contrib/zstd/lib/deprecated/zbuff_compress.c +1 -1
  68. data/contrib/zstd/lib/deprecated/zbuff_decompress.c +1 -1
  69. data/contrib/zstd/lib/dictBuilder/cover.c +164 -54
  70. data/contrib/zstd/lib/dictBuilder/cover.h +52 -7
  71. data/contrib/zstd/lib/dictBuilder/fastcover.c +60 -43
  72. data/contrib/zstd/lib/dictBuilder/zdict.c +43 -19
  73. data/contrib/zstd/lib/dictBuilder/zdict.h +56 -28
  74. data/contrib/zstd/lib/legacy/zstd_legacy.h +8 -4
  75. data/contrib/zstd/lib/legacy/zstd_v01.c +110 -110
  76. data/contrib/zstd/lib/legacy/zstd_v01.h +1 -1
  77. data/contrib/zstd/lib/legacy/zstd_v02.c +23 -13
  78. data/contrib/zstd/lib/legacy/zstd_v02.h +1 -1
  79. data/contrib/zstd/lib/legacy/zstd_v03.c +23 -13
  80. data/contrib/zstd/lib/legacy/zstd_v03.h +1 -1
  81. data/contrib/zstd/lib/legacy/zstd_v04.c +30 -17
  82. data/contrib/zstd/lib/legacy/zstd_v04.h +1 -1
  83. data/contrib/zstd/lib/legacy/zstd_v05.c +113 -102
  84. data/contrib/zstd/lib/legacy/zstd_v05.h +2 -2
  85. data/contrib/zstd/lib/legacy/zstd_v06.c +20 -18
  86. data/contrib/zstd/lib/legacy/zstd_v06.h +1 -1
  87. data/contrib/zstd/lib/legacy/zstd_v07.c +25 -19
  88. data/contrib/zstd/lib/legacy/zstd_v07.h +1 -1
  89. data/contrib/zstd/lib/libzstd.pc.in +3 -2
  90. data/contrib/zstd/lib/zstd.h +265 -88
  91. data/ext/extzstd.h +1 -1
  92. data/ext/libzstd_conf.h +8 -0
  93. data/ext/zstd_common.c +1 -3
  94. data/ext/zstd_compress.c +3 -3
  95. data/ext/zstd_decompress.c +1 -5
  96. data/ext/zstd_dictbuilder.c +2 -3
  97. data/ext/zstd_dictbuilder_fastcover.c +1 -3
  98. data/ext/zstd_legacy_v01.c +2 -0
  99. data/ext/zstd_legacy_v02.c +2 -0
  100. data/ext/zstd_legacy_v03.c +2 -0
  101. data/ext/zstd_legacy_v04.c +2 -0
  102. data/ext/zstd_legacy_v05.c +2 -0
  103. data/ext/zstd_legacy_v06.c +2 -0
  104. data/ext/zstd_legacy_v07.c +2 -0
  105. data/lib/extzstd.rb +18 -10
  106. data/lib/extzstd/version.rb +1 -1
  107. metadata +15 -6
@@ -183,7 +183,7 @@ aux_const_dig_str_0(VALUE obj, const char *p[], const char **pp)
183
183
  # define RBEXT_IMPORT __declspec(dllimport)
184
184
  # define RBEXT_EXPORT __declspec(dllexport)
185
185
  # define RBEXT_LOCAL
186
- #elif __GNUC__ >= 4 || __clang__
186
+ #elif defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__)
187
187
  # define RBEXT_IMPORT __attribute__((visibility("default")))
188
188
  # define RBEXT_EXPORT __attribute__((visibility("default")))
189
189
  # define RBEXT_LOCAL __attribute__((visibility("hidden")))
@@ -0,0 +1,8 @@
1
+ #ifndef RUBY_ZSTD_LIBZSTD_CONF_H
2
+ #define RUBY_ZSTD_LIBZSTD_CONF_H 1
3
+
4
+ #define ZSTD_LEGACY_SUPPORT 1
5
+ #define MEM_MODULE 1
6
+ #define visibility(v) visibility("hidden")
7
+
8
+ #endif /* RUBY_ZSTD_LIBZSTD_CONF_H */
@@ -1,6 +1,4 @@
1
- #define ZSTD_LEGACY_SUPPORT 1
2
- #define MEM_MODULE 1
3
- #define visibility(v) visibility("hidden")
1
+ #include "libzstd_conf.h"
4
2
 
5
3
  #include "../contrib/zstd/lib/common/entropy_common.c"
6
4
  #include "../contrib/zstd/lib/common/error_private.c"
@@ -1,12 +1,12 @@
1
- #define ZSTD_LEGACY_SUPPORT 1
2
- #define MEM_MODULE 1
3
- #define visibility(v) visibility("hidden")
1
+ #include "libzstd_conf.h"
4
2
 
5
3
  #include "../contrib/zstd/lib/compress/fse_compress.c"
6
4
  #include "../contrib/zstd/lib/compress/huf_compress.c"
7
5
 
8
6
  #undef CHECK_F
9
7
  #include "../contrib/zstd/lib/compress/zstd_compress.c"
8
+ #include "../contrib/zstd/lib/compress/zstd_compress_literals.c"
9
+ #include "../contrib/zstd/lib/compress/zstd_compress_sequences.c"
10
10
  #include "../contrib/zstd/lib/compress/zstd_double_fast.c"
11
11
  #include "../contrib/zstd/lib/compress/zstd_fast.c"
12
12
  #include "../contrib/zstd/lib/compress/zstd_lazy.c"
@@ -1,10 +1,6 @@
1
- #define ZSTD_LEGACY_SUPPORT 1
2
- #define MEM_MODULE 1
3
- #define visibility(v) visibility("hidden")
1
+ #include "libzstd_conf.h"
4
2
 
5
3
  #include "../contrib/zstd/lib/decompress/zstd_decompress.c"
6
4
  #include "../contrib/zstd/lib/decompress/zstd_decompress_block.c"
7
-
8
- #undef CHECK_F
9
5
  #include "../contrib/zstd/lib/decompress/huf_decompress.c"
10
6
  #include "../contrib/zstd/lib/decompress/zstd_ddict.c"
@@ -1,6 +1,4 @@
1
- #define ZSTD_LEGACY_SUPPORT 1
2
- #define MEM_MODULE 1
3
- #define visibility(v) visibility("hidden")
1
+ #include "libzstd_conf.h"
4
2
 
5
3
  #include "../contrib/zstd/lib/dictBuilder/zdict.c"
6
4
  #include "../contrib/zstd/lib/dictBuilder/divsufsort.c"
@@ -8,4 +6,5 @@
8
6
  #undef DISPLAY
9
7
  #undef DISPLAYLEVEL
10
8
  #undef DISPLAYUPDATE
9
+ #define prime4bytes cover_prime4bytes
11
10
  #include "../contrib/zstd/lib/dictBuilder/cover.c"
@@ -1,5 +1,3 @@
1
- #define ZSTD_LEGACY_SUPPORT 1
2
- #define MEM_MODULE 1
3
- #define visibility(v) visibility("hidden")
1
+ #include "libzstd_conf.h"
4
2
 
5
3
  #include "../contrib/zstd/lib/dictBuilder/fastcover.c"
@@ -1 +1,3 @@
1
+ #include "libzstd_conf.h"
2
+
1
3
  #include "../contrib/zstd/lib/legacy/zstd_v01.c"
@@ -1 +1,3 @@
1
+ #include "libzstd_conf.h"
2
+
1
3
  #include "../contrib/zstd/lib/legacy/zstd_v02.c"
@@ -1 +1,3 @@
1
+ #include "libzstd_conf.h"
2
+
1
3
  #include "../contrib/zstd/lib/legacy/zstd_v03.c"
@@ -1 +1,3 @@
1
+ #include "libzstd_conf.h"
2
+
1
3
  #include "../contrib/zstd/lib/legacy/zstd_v04.c"
@@ -1 +1,3 @@
1
+ #include "libzstd_conf.h"
2
+
1
3
  #include "../contrib/zstd/lib/legacy/zstd_v05.c"
@@ -1 +1,3 @@
1
+ #include "libzstd_conf.h"
2
+
1
3
  #include "../contrib/zstd/lib/legacy/zstd_v06.c"
@@ -1 +1,3 @@
1
+ #include "libzstd_conf.h"
2
+
1
3
  #include "../contrib/zstd/lib/legacy/zstd_v07.c"
@@ -2,7 +2,7 @@
2
2
 
3
3
  ver = RUBY_VERSION.slice(/\d+\.\d+/)
4
4
  soname = File.basename(__FILE__, ".rb") << ".so"
5
- require_relative File.join(ver, soname)
5
+ require File.join(ver, soname)
6
6
 
7
7
  require_relative "extzstd/version"
8
8
 
@@ -12,13 +12,21 @@ require "stringio"
12
12
  # This is ruby bindings for zstd <https://github.com/Cyan4973/zstd> the compression library.
13
13
  #
14
14
  module Zstd
15
- module Aux
16
- EMPTY_BUFFER = "".force_encoding(Encoding::BINARY).freeze
15
+ module Internals
16
+ unless String.method_defined? :b
17
+ refine String do
18
+ def b
19
+ dup.force_encoding(Encoding::BINARY)
20
+ end
21
+ end
22
+ end
17
23
  end
18
24
 
25
+ using Internals
26
+
19
27
  refine String do
20
28
  def to_zstd(params = nil, dict: nil)
21
- ContextLess.encode(self, Aux::EMPTY_BUFFER.dup, nil, dict, params)
29
+ ContextLess.encode(self, "".b, nil, dict, params)
22
30
  end
23
31
 
24
32
  def unzstd(size = nil, dict: nil)
@@ -52,8 +60,8 @@ module Zstd
52
60
  # [level = nil (integer or nil)]
53
61
  # [encode_params (instance of Zstd::Parameters)]
54
62
  # [opts dict: nil (string or nil)]
55
- def self.encode(src, *args, &block)
56
- src.to_zstd(*args, &block)
63
+ def self.encode(src, *args, **opts, &block)
64
+ src.to_zstd(*args, **opts, &block)
57
65
  end
58
66
 
59
67
  #
@@ -62,8 +70,8 @@ module Zstd
62
70
  # decode(zstd_stream, dict: nil) -> zstd decoder
63
71
  # decode(zstd_stream, dict: nil) { |decoder| ... } -> yield returned value
64
72
  #
65
- def self.decode(src, *args, &block)
66
- src.unzstd(*args, &block)
73
+ def self.decode(src, *args, **opts, &block)
74
+ src.unzstd(*args, **opts, &block)
67
75
  end
68
76
 
69
77
  class << Zstd
@@ -94,7 +102,7 @@ module Zstd
94
102
  end
95
103
 
96
104
  def self.encode(src, params = nil, dest: nil, dict: nil)
97
- ContextLess.encode(src, dest || Aux::EMPTY_BUFFER.dup, nil, dict, params)
105
+ ContextLess.encode(src, dest || "".b, nil, dict, params)
98
106
  end
99
107
 
100
108
  class << Encoder
@@ -131,7 +139,7 @@ module Zstd
131
139
 
132
140
  def self.decode(src, dest: nil, dict: nil)
133
141
  # NOTE: ContextLess.decode は伸長時のサイズが必要なため、常に利用できるわけではない
134
- # ContextLess.decode(src, dest || Aux::EMPTY_BUFFER.dup, nil, dict)
142
+ # ContextLess.decode(src, dest || "".b, nil, dict)
135
143
 
136
144
  new(StringIO.new(src), dict).read(nil, dest)
137
145
  end
@@ -1,3 +1,3 @@
1
1
  module Zstd
2
- VERSION = "0.3"
2
+ VERSION = "0.3.1"
3
3
  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.3'
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dearblue
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-21 00:00:00.000000000 Z
11
+ date: 2020-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -43,6 +43,7 @@ extra_rdoc_files:
43
43
  - ext/extzstd.h
44
44
  - ext/extzstd_nogvls.h
45
45
  - ext/extzstd_stream.c
46
+ - ext/libzstd_conf.h
46
47
  - ext/zstd_common.c
47
48
  - ext/zstd_compress.c
48
49
  - ext/zstd_decompress.c
@@ -101,6 +102,13 @@ files:
101
102
  - contrib/zstd/lib/compress/huf_compress.c
102
103
  - contrib/zstd/lib/compress/zstd_compress.c
103
104
  - contrib/zstd/lib/compress/zstd_compress_internal.h
105
+ - contrib/zstd/lib/compress/zstd_compress_literals.c
106
+ - contrib/zstd/lib/compress/zstd_compress_literals.h
107
+ - contrib/zstd/lib/compress/zstd_compress_sequences.c
108
+ - contrib/zstd/lib/compress/zstd_compress_sequences.h
109
+ - contrib/zstd/lib/compress/zstd_compress_superblock.c
110
+ - contrib/zstd/lib/compress/zstd_compress_superblock.h
111
+ - contrib/zstd/lib/compress/zstd_cwksp.h
104
112
  - contrib/zstd/lib/compress/zstd_double_fast.c
105
113
  - contrib/zstd/lib/compress/zstd_double_fast.h
106
114
  - contrib/zstd/lib/compress/zstd_fast.c
@@ -154,6 +162,7 @@ files:
154
162
  - ext/extzstd.h
155
163
  - ext/extzstd_nogvls.h
156
164
  - ext/extzstd_stream.c
165
+ - ext/libzstd_conf.h
157
166
  - ext/zstd_common.c
158
167
  - ext/zstd_compress.c
159
168
  - ext/zstd_decompress.c
@@ -174,7 +183,7 @@ homepage: https://github.com/dearblue/ruby-extzstd/
174
183
  licenses:
175
184
  - BSD-2-Clause
176
185
  metadata: {}
177
- post_install_message:
186
+ post_install_message:
178
187
  rdoc_options:
179
188
  - "--charset"
180
189
  - UTF-8
@@ -193,8 +202,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
202
  - !ruby/object:Gem::Version
194
203
  version: '0'
195
204
  requirements: []
196
- rubygems_version: 3.0.3
197
- signing_key:
205
+ rubygems_version: 3.0.6
206
+ signing_key:
198
207
  specification_version: 4
199
208
  summary: ruby bindings for Zstandard (zstd)
200
209
  test_files: []