extzstd 0.0.3.CONCEPT-x86-mingw32 → 0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.ja +5 -0
- data/LICENSE +6 -6
- data/README.md +35 -22
- data/contrib/zstd/LICENSE +13 -9
- data/contrib/zstd/README.md +37 -44
- data/contrib/zstd/common/entropy_common.c +33 -39
- data/contrib/zstd/common/error_private.c +43 -0
- data/contrib/zstd/common/error_private.h +11 -60
- data/contrib/zstd/common/fse.h +11 -5
- data/contrib/zstd/common/fse_decompress.c +14 -16
- data/contrib/zstd/common/huf.h +1 -1
- data/contrib/zstd/common/mem.h +36 -43
- data/contrib/zstd/common/xxhash.c +31 -18
- data/contrib/zstd/common/xxhash.h +71 -35
- data/contrib/zstd/common/zbuff.h +29 -35
- data/contrib/zstd/common/zstd_common.c +24 -32
- data/contrib/zstd/common/zstd_errors.h +60 -0
- data/contrib/zstd/common/zstd_internal.h +109 -80
- data/contrib/zstd/compress/fse_compress.c +9 -6
- data/contrib/zstd/compress/huf_compress.c +30 -74
- data/contrib/zstd/compress/zbuff_compress.c +43 -51
- data/contrib/zstd/compress/zstd_compress.c +953 -763
- data/contrib/zstd/compress/zstd_opt.h +115 -261
- data/contrib/zstd/decompress/huf_decompress.c +29 -40
- data/contrib/zstd/decompress/zbuff_decompress.c +36 -78
- data/contrib/zstd/decompress/zstd_decompress.c +976 -496
- data/contrib/zstd/dictBuilder/divsufsort.h +5 -5
- data/contrib/zstd/dictBuilder/zdict.c +194 -229
- data/contrib/zstd/dictBuilder/zdict.h +66 -68
- data/contrib/zstd/legacy/zstd_legacy.h +168 -49
- data/contrib/zstd/legacy/zstd_v01.c +95 -178
- data/contrib/zstd/legacy/zstd_v01.h +12 -32
- data/contrib/zstd/legacy/zstd_v02.c +48 -274
- data/contrib/zstd/legacy/zstd_v02.h +12 -32
- data/contrib/zstd/legacy/zstd_v03.c +48 -274
- data/contrib/zstd/legacy/zstd_v03.h +12 -32
- data/contrib/zstd/legacy/zstd_v04.c +63 -320
- data/contrib/zstd/legacy/zstd_v04.h +13 -33
- data/contrib/zstd/legacy/zstd_v05.c +80 -345
- data/contrib/zstd/legacy/zstd_v05.h +9 -31
- data/contrib/zstd/legacy/zstd_v06.c +48 -458
- data/contrib/zstd/legacy/zstd_v06.h +41 -67
- data/contrib/zstd/legacy/zstd_v07.c +4544 -0
- data/contrib/zstd/legacy/zstd_v07.h +173 -0
- data/contrib/zstd/zstd.h +640 -0
- data/ext/extconf.rb +7 -3
- data/ext/extzstd.c +263 -106
- data/ext/extzstd.h +8 -6
- data/ext/extzstd_nogvls.h +0 -117
- data/ext/extzstd_stream.c +347 -0
- data/ext/zstd_common.c +8 -0
- data/ext/zstd_compress.c +6 -0
- data/ext/zstd_decompress.c +5 -0
- data/ext/zstd_dictbuilder.c +5 -0
- data/ext/zstd_legacy_v07.c +1 -0
- data/gemstub.rb +18 -16
- data/lib/2.1/extzstd.so +0 -0
- data/lib/2.2/extzstd.so +0 -0
- data/lib/2.3/extzstd.so +0 -0
- data/lib/extzstd/version.rb +1 -1
- data/lib/extzstd.rb +77 -43
- data/test/test_basic.rb +11 -6
- metadata +23 -11
- data/contrib/zstd/common/error_public.h +0 -77
- data/contrib/zstd/common/zstd.h +0 -475
- data/ext/extzstd_buffered.c +0 -265
- data/ext/zstd_amalgam.c +0 -18
- data/lib/2.0/extzstd.so +0 -0
data/lib/extzstd.rb
CHANGED
@@ -14,32 +14,46 @@ require "stringio"
|
|
14
14
|
module Zstd
|
15
15
|
#
|
16
16
|
# call-seq:
|
17
|
-
# encode(src_string, level = nil,
|
18
|
-
# encode(src_string,
|
19
|
-
# encode(outport, level = nil,
|
20
|
-
# encode(outport, level = nil,
|
21
|
-
# encode(outport,
|
22
|
-
# encode(outport,
|
17
|
+
# encode(src_string, level = nil, opts = {}) -> zstd string
|
18
|
+
# encode(src_string, encode_params, opts = {}) -> zstd string
|
19
|
+
# encode(outport, level = nil, opts = {}) -> zstd encoder
|
20
|
+
# encode(outport, level = nil, opts = {}) { |encoder| ... } -> yield returned value
|
21
|
+
# encode(outport, encode_params, opts = {}) -> zstd encoder
|
22
|
+
# encode(outport, encode_params, opts = {}) { |encoder| ... } -> yield returned value
|
23
23
|
#
|
24
|
-
|
24
|
+
# [src_string (string)]
|
25
|
+
# [outport (io liked object)]
|
26
|
+
# [level = nil (integer or nil)]
|
27
|
+
# [encode_params (instance of Zstd::Parameters)]
|
28
|
+
# [opts dict: nil (string or nil)]
|
29
|
+
def self.encode(src, params = nil, dict: nil, &block)
|
25
30
|
if src.kind_of?(String)
|
26
|
-
|
27
|
-
return Encoder.open(dest, *args) { |e| e.write src; dest }
|
31
|
+
return ContextLess.encode(src, Aux::EMPTY_BUFFER.dup, nil, dict, params)
|
28
32
|
end
|
29
33
|
|
30
|
-
Encoder.open(src,
|
34
|
+
Encoder.open(src, params, dict, &block)
|
31
35
|
end
|
32
36
|
|
33
37
|
#
|
34
38
|
# call-seq:
|
35
|
-
# decode(zstd_string, maxsize = nil, dict
|
36
|
-
# decode(zstd_stream,
|
37
|
-
# decode(zstd_stream,
|
39
|
+
# decode(zstd_string, maxsize = nil, dict: nil) -> string
|
40
|
+
# decode(zstd_stream, dict: nil) -> zstd decoder
|
41
|
+
# decode(zstd_stream, dict: nil) { |decoder| ... } -> yield returned value
|
38
42
|
#
|
39
|
-
def self.decode(src,
|
43
|
+
def self.decode(src, *args, dict: nil, &block)
|
40
44
|
if src.kind_of?(String)
|
41
|
-
|
42
|
-
|
45
|
+
case args.size
|
46
|
+
when 0
|
47
|
+
return ContextLess.decode(src, Aux::EMPTY_BUFFER.dup, nil, dict)
|
48
|
+
when 1
|
49
|
+
Decoder.open(src, dict) { |d| return d.read(args[0].to_i) }
|
50
|
+
else
|
51
|
+
raise ArgumentError, "wrong argument number (given #{args.size}, expect 1 or 2)"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
unless args.empty?
|
56
|
+
raise ArgumentError, "wrong argument number (given #{args.size}, expect 1)"
|
43
57
|
end
|
44
58
|
|
45
59
|
Decoder.open(src, dict, &block)
|
@@ -49,7 +63,7 @@ module Zstd
|
|
49
63
|
#
|
50
64
|
# call-seq:
|
51
65
|
# open(outport, level = nil, dict = nil) -> zstd encoder
|
52
|
-
# open(outport,
|
66
|
+
# open(outport, encode_params, dict = nil) { |encoder| ... } -> yield returned value
|
53
67
|
#
|
54
68
|
def self.open(outport, *args)
|
55
69
|
e = new(outport, *args)
|
@@ -66,12 +80,12 @@ module Zstd
|
|
66
80
|
#
|
67
81
|
# call-seq:
|
68
82
|
# initialize(outport, level = nil, dict = nil)
|
69
|
-
# initialize(outport,
|
83
|
+
# initialize(outport, encode_params, dict = nil)
|
70
84
|
#
|
71
85
|
# +outport+ need has +.<<+ method.
|
72
86
|
#
|
73
87
|
def initialize(outport, params = nil, dict = nil)
|
74
|
-
encoder =
|
88
|
+
encoder = StreamEncoder.new(params, dict)
|
75
89
|
super encoder, outport, "".force_encoding(Encoding::BINARY), [true]
|
76
90
|
end
|
77
91
|
|
@@ -83,7 +97,7 @@ module Zstd
|
|
83
97
|
|
84
98
|
def close
|
85
99
|
return nil if eof?
|
86
|
-
encoder.end(destbuf,
|
100
|
+
encoder.end(destbuf, StreamEncoder::OUTSIZE)
|
87
101
|
outport << destbuf
|
88
102
|
status[0] = false
|
89
103
|
nil
|
@@ -94,9 +108,9 @@ module Zstd
|
|
94
108
|
|
95
109
|
off = 0
|
96
110
|
rest = buf.bytesize
|
97
|
-
outsize =
|
111
|
+
outsize = StreamEncoder::OUTSIZE
|
98
112
|
while off && off < rest
|
99
|
-
off = encoder.
|
113
|
+
off = encoder.update(buf, off, destbuf, outsize)
|
100
114
|
outport << destbuf
|
101
115
|
end
|
102
116
|
|
@@ -109,14 +123,16 @@ module Zstd
|
|
109
123
|
raise IOError, "closed stream" if eof?
|
110
124
|
|
111
125
|
off = 0
|
112
|
-
encoder.flush(destbuf,
|
126
|
+
encoder.flush(destbuf, StreamEncoder::OUTSIZE)
|
113
127
|
outport << destbuf
|
114
128
|
|
115
129
|
self
|
116
130
|
end
|
117
131
|
end
|
118
132
|
|
119
|
-
class Decoder
|
133
|
+
class Decoder
|
134
|
+
attr_reader :decoder, :inport, :readbuf, :destbuf, :status, :pos
|
135
|
+
|
120
136
|
STATUS_CLOSED = nil
|
121
137
|
STATUS_READY = 0
|
122
138
|
STATUS_INPORT_EOF = 1
|
@@ -145,15 +161,19 @@ module Zstd
|
|
145
161
|
|
146
162
|
def initialize(inport, dict = nil)
|
147
163
|
raise Error, "require .read method - <%s:0x%08x>" % [inport.class, inport.object_id << 1] unless inport.respond_to?(:read)
|
148
|
-
|
164
|
+
@decoder = StreamDecoder.new(dict)
|
165
|
+
@inport = inport
|
166
|
+
@readbuf = StringIO.new(Aux::EMPTY_BUFFER.dup)
|
167
|
+
@destbuf = StringIO.new(Aux::EMPTY_BUFFER.dup)
|
168
|
+
@status = STATUS_READY
|
169
|
+
@pos = 0
|
149
170
|
end
|
150
171
|
|
151
172
|
def close
|
152
|
-
decoder.reset
|
153
173
|
inport.close rescue nil if inport.respond_to?(:close)
|
154
|
-
readbuf.
|
155
|
-
|
156
|
-
|
174
|
+
readbuf.truncate 0
|
175
|
+
destbuf.truncate 0
|
176
|
+
@status = STATUS_CLOSED
|
157
177
|
nil
|
158
178
|
end
|
159
179
|
|
@@ -165,11 +185,11 @@ module Zstd
|
|
165
185
|
|
166
186
|
def read(size = nil, dest = Aux::EMPTY_BUFFER.dup)
|
167
187
|
dest ||= Aux::EMPTY_BUFFER.dup
|
188
|
+
size &&= size.to_i
|
168
189
|
Aux.change_binary(dest) do
|
169
190
|
#dest.clear
|
170
|
-
dest[0 .. -1] = Aux::EMPTY_BUFFER # keep allocated heap
|
171
|
-
|
172
|
-
return dest if size == 0
|
191
|
+
dest[0 .. -1] = Aux::EMPTY_BUFFER unless dest.empty? # keep allocated heap
|
192
|
+
return dest unless !size || size > 0
|
173
193
|
|
174
194
|
d = Aux::EMPTY_BUFFER.dup
|
175
195
|
until size && size <= 0
|
@@ -187,33 +207,45 @@ module Zstd
|
|
187
207
|
if dest.empty?
|
188
208
|
nil
|
189
209
|
else
|
210
|
+
@pos += dest.bytesize
|
190
211
|
dest
|
191
212
|
end
|
192
213
|
end
|
193
214
|
|
194
215
|
private
|
195
216
|
def fetch
|
196
|
-
return nil if eof?
|
217
|
+
return nil if eof?
|
218
|
+
|
219
|
+
destbuf.rewind
|
220
|
+
destbuf.truncate 0
|
197
221
|
|
198
222
|
while true
|
199
|
-
if readbuf.eof?
|
200
|
-
readbuf.string[0 .. -1] = Aux::EMPTY_BUFFER
|
223
|
+
if readbuf.eof? && status != STATUS_INPORT_EOF
|
201
224
|
readbuf.rewind
|
202
|
-
unless inport.read
|
203
|
-
|
204
|
-
return nil
|
225
|
+
unless inport.read StreamDecoder::INSIZE, readbuf.string
|
226
|
+
@status = STATUS_INPORT_EOF
|
205
227
|
end
|
206
228
|
end
|
207
229
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
230
|
+
begin
|
231
|
+
off = decoder.update readbuf.string, readbuf.pos, destbuf.string, StreamDecoder::OUTSIZE
|
232
|
+
readbuf.pos = off if off
|
233
|
+
return self if destbuf.size > 0
|
234
|
+
break if readbuf.eof? && status == STATUS_INPORT_EOF
|
235
|
+
rescue Zstd::InitMissingError
|
236
|
+
break if readbuf.eof? && status == STATUS_INPORT_EOF
|
237
|
+
raise
|
238
|
+
end
|
212
239
|
end
|
240
|
+
|
241
|
+
# when readbuf.eof? && status == STATUS_INPORT_EOF
|
242
|
+
|
243
|
+
@status = nil
|
244
|
+
nil
|
213
245
|
end
|
214
246
|
end
|
215
247
|
|
216
|
-
class
|
248
|
+
class Parameters
|
217
249
|
def inspect
|
218
250
|
"#<#{self.class} windowlog=#{windowlog}, chainlog=#{chainlog}, " \
|
219
251
|
"hashlog=#{hashlog}, searchlog=#{searchlog}, " \
|
@@ -233,6 +265,8 @@ module Zstd
|
|
233
265
|
q.breakable " "
|
234
266
|
q.text "searchlength=#{searchlength},"
|
235
267
|
q.breakable " "
|
268
|
+
q.text "targetlength=#{targetlength},"
|
269
|
+
q.breakable " "
|
236
270
|
q.text "strategy=#{strategy}>"
|
237
271
|
end
|
238
272
|
end
|
data/test/test_basic.rb
CHANGED
@@ -18,24 +18,29 @@ class TestZstd < Test::Unit::TestCase
|
|
18
18
|
|
19
19
|
def test_huge
|
20
20
|
src = "ABCDEFGabcdefg" * 10000000
|
21
|
-
|
21
|
+
resrc = Zstd.decode(Zstd.encode(src))
|
22
|
+
assert_equal(src.bytesize, resrc.bytesize)
|
23
|
+
assert_equal(Digest::MD5.hexdigest(src), Digest::MD5.hexdigest(resrc))
|
22
24
|
end
|
23
25
|
|
24
26
|
def test_huge_stream
|
25
27
|
src = "abcdefghijklmnopqrstuvwxyz" * 1000
|
28
|
+
size_a = 0
|
26
29
|
md5a = Digest::MD5.new
|
27
30
|
d = StringIO.new("")
|
28
|
-
Zstd.encode(d) { |z| 1000.times { z << src; md5a.update src } }
|
31
|
+
Zstd.encode(d) { |z| 1000.times { z << src; size_a += src.bytesize; md5a.update src } }
|
29
32
|
d.pos = 0
|
33
|
+
size_b = 0
|
30
34
|
md5b = Digest::MD5.new
|
31
|
-
Zstd.decode(d) { |z| buf = ""; while z.read(654321, buf); md5b.update buf; end }
|
35
|
+
Zstd.decode(d) { |z| buf = ""; while z.read(654321, buf); size_b += buf.bytesize; md5b.update buf; end }
|
36
|
+
assert_equal size_a, size_b
|
32
37
|
assert_equal(md5a.hexdigest, md5b.hexdigest)
|
33
38
|
end
|
34
39
|
|
35
40
|
def test_dictionary
|
36
|
-
dictsrc = "
|
37
|
-
dict = Zstd.
|
41
|
+
dictsrc = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-" * 5
|
42
|
+
dict = Zstd::Dictionary.train_from_buffer(dictsrc, 10000)
|
38
43
|
src = "ABCDEFGabcdefg" * 50
|
39
|
-
assert_equal(src, Zstd.decode(Zstd.encode(src,
|
44
|
+
assert_equal(src, Zstd.decode(Zstd.encode(src, dict: dict), src.bytesize, dict: dict))
|
40
45
|
end
|
41
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.1'
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- dearblue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -31,24 +31,30 @@ email: dearblue@users.osdn.me
|
|
31
31
|
executables: []
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files:
|
34
|
+
- HISTORY.ja
|
34
35
|
- LICENSE
|
35
36
|
- README.md
|
36
37
|
- contrib/zstd/LICENSE
|
37
38
|
- contrib/zstd/README.md
|
38
39
|
- ext/extzstd.c
|
39
40
|
- ext/extzstd.h
|
40
|
-
- ext/extzstd_buffered.c
|
41
41
|
- ext/extzstd_nogvls.h
|
42
|
-
- ext/
|
42
|
+
- ext/extzstd_stream.c
|
43
|
+
- ext/zstd_common.c
|
44
|
+
- ext/zstd_compress.c
|
45
|
+
- ext/zstd_decompress.c
|
46
|
+
- ext/zstd_dictbuilder.c
|
43
47
|
- ext/zstd_legacy_v01.c
|
44
48
|
- ext/zstd_legacy_v02.c
|
45
49
|
- ext/zstd_legacy_v03.c
|
46
50
|
- ext/zstd_legacy_v04.c
|
47
51
|
- ext/zstd_legacy_v05.c
|
48
52
|
- ext/zstd_legacy_v06.c
|
53
|
+
- ext/zstd_legacy_v07.c
|
49
54
|
- lib/extzstd.rb
|
50
55
|
- lib/extzstd/version.rb
|
51
56
|
files:
|
57
|
+
- HISTORY.ja
|
52
58
|
- LICENSE
|
53
59
|
- README.md
|
54
60
|
- Rakefile
|
@@ -56,8 +62,8 @@ files:
|
|
56
62
|
- contrib/zstd/README.md
|
57
63
|
- contrib/zstd/common/bitstream.h
|
58
64
|
- contrib/zstd/common/entropy_common.c
|
65
|
+
- contrib/zstd/common/error_private.c
|
59
66
|
- contrib/zstd/common/error_private.h
|
60
|
-
- contrib/zstd/common/error_public.h
|
61
67
|
- contrib/zstd/common/fse.h
|
62
68
|
- contrib/zstd/common/fse_decompress.c
|
63
69
|
- contrib/zstd/common/huf.h
|
@@ -65,8 +71,8 @@ files:
|
|
65
71
|
- contrib/zstd/common/xxhash.c
|
66
72
|
- contrib/zstd/common/xxhash.h
|
67
73
|
- contrib/zstd/common/zbuff.h
|
68
|
-
- contrib/zstd/common/zstd.h
|
69
74
|
- contrib/zstd/common/zstd_common.c
|
75
|
+
- contrib/zstd/common/zstd_errors.h
|
70
76
|
- contrib/zstd/common/zstd_internal.h
|
71
77
|
- contrib/zstd/compress/fse_compress.c
|
72
78
|
- contrib/zstd/compress/huf_compress.c
|
@@ -93,20 +99,26 @@ files:
|
|
93
99
|
- contrib/zstd/legacy/zstd_v05.h
|
94
100
|
- contrib/zstd/legacy/zstd_v06.c
|
95
101
|
- contrib/zstd/legacy/zstd_v06.h
|
102
|
+
- contrib/zstd/legacy/zstd_v07.c
|
103
|
+
- contrib/zstd/legacy/zstd_v07.h
|
104
|
+
- contrib/zstd/zstd.h
|
96
105
|
- ext/extconf.rb
|
97
106
|
- ext/extzstd.c
|
98
107
|
- ext/extzstd.h
|
99
|
-
- ext/extzstd_buffered.c
|
100
108
|
- ext/extzstd_nogvls.h
|
101
|
-
- ext/
|
109
|
+
- ext/extzstd_stream.c
|
110
|
+
- ext/zstd_common.c
|
111
|
+
- ext/zstd_compress.c
|
112
|
+
- ext/zstd_decompress.c
|
113
|
+
- ext/zstd_dictbuilder.c
|
102
114
|
- ext/zstd_legacy_v01.c
|
103
115
|
- ext/zstd_legacy_v02.c
|
104
116
|
- ext/zstd_legacy_v03.c
|
105
117
|
- ext/zstd_legacy_v04.c
|
106
118
|
- ext/zstd_legacy_v05.c
|
107
119
|
- ext/zstd_legacy_v06.c
|
120
|
+
- ext/zstd_legacy_v07.c
|
108
121
|
- gemstub.rb
|
109
|
-
- lib/2.0/extzstd.so
|
110
122
|
- lib/2.1/extzstd.so
|
111
123
|
- lib/2.2/extzstd.so
|
112
124
|
- lib/2.3/extzstd.so
|
@@ -132,9 +144,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
144
|
version: '2.0'
|
133
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
146
|
requirements:
|
135
|
-
- - "
|
147
|
+
- - ">="
|
136
148
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
149
|
+
version: '0'
|
138
150
|
requirements: []
|
139
151
|
rubyforge_project:
|
140
152
|
rubygems_version: 2.6.4
|
@@ -1,77 +0,0 @@
|
|
1
|
-
/* ******************************************************************
|
2
|
-
Error codes list
|
3
|
-
Copyright (C) 2016, Yann Collet
|
4
|
-
|
5
|
-
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
6
|
-
|
7
|
-
Redistribution and use in source and binary forms, with or without
|
8
|
-
modification, are permitted provided that the following conditions are
|
9
|
-
met:
|
10
|
-
|
11
|
-
* Redistributions of source code must retain the above copyright
|
12
|
-
notice, this list of conditions and the following disclaimer.
|
13
|
-
* Redistributions in binary form must reproduce the above
|
14
|
-
copyright notice, this list of conditions and the following disclaimer
|
15
|
-
in the documentation and/or other materials provided with the
|
16
|
-
distribution.
|
17
|
-
|
18
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
|
30
|
-
You can contact the author at :
|
31
|
-
- Homepage : http://www.zstd.net
|
32
|
-
****************************************************************** */
|
33
|
-
#ifndef ERROR_PUBLIC_H_MODULE
|
34
|
-
#define ERROR_PUBLIC_H_MODULE
|
35
|
-
|
36
|
-
#if defined (__cplusplus)
|
37
|
-
extern "C" {
|
38
|
-
#endif
|
39
|
-
|
40
|
-
|
41
|
-
/* ****************************************
|
42
|
-
* error codes list
|
43
|
-
******************************************/
|
44
|
-
typedef enum {
|
45
|
-
ZSTD_error_no_error,
|
46
|
-
ZSTD_error_GENERIC,
|
47
|
-
ZSTD_error_prefix_unknown,
|
48
|
-
ZSTD_error_frameParameter_unsupported,
|
49
|
-
ZSTD_error_frameParameter_unsupportedBy32bits,
|
50
|
-
ZSTD_error_compressionParameter_unsupported,
|
51
|
-
ZSTD_error_init_missing,
|
52
|
-
ZSTD_error_memory_allocation,
|
53
|
-
ZSTD_error_stage_wrong,
|
54
|
-
ZSTD_error_dstSize_tooSmall,
|
55
|
-
ZSTD_error_srcSize_wrong,
|
56
|
-
ZSTD_error_corruption_detected,
|
57
|
-
ZSTD_error_checksum_wrong,
|
58
|
-
ZSTD_error_tableLog_tooLarge,
|
59
|
-
ZSTD_error_maxSymbolValue_tooLarge,
|
60
|
-
ZSTD_error_maxSymbolValue_tooSmall,
|
61
|
-
ZSTD_error_dictionary_corrupted,
|
62
|
-
ZSTD_error_dictionary_wrong,
|
63
|
-
ZSTD_error_maxCode
|
64
|
-
} ZSTD_ErrorCode;
|
65
|
-
|
66
|
-
/*! ZSTD_getErrorCode() :
|
67
|
-
convert a `size_t` function result into a `ZSTD_ErrorCode` enum type,
|
68
|
-
which can be used to compare directly with enum list published into "error_public.h" */
|
69
|
-
ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult);
|
70
|
-
const char* ZSTD_getErrorString(ZSTD_ErrorCode code);
|
71
|
-
|
72
|
-
|
73
|
-
#if defined (__cplusplus)
|
74
|
-
}
|
75
|
-
#endif
|
76
|
-
|
77
|
-
#endif /* ERROR_PUBLIC_H_MODULE */
|