lzfse 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d93afc84507f8ee93fad095b695bc31972ba11ed7f725456dfcb1c413b447593
4
- data.tar.gz: 11656c01ec0f25b234f46027a008137d2e123ab40a6a6ab0b1b76f35b1a266a3
3
+ metadata.gz: ff1773f7dddc06082a69743dd898239a90150afef7140579a7150eab13cc75e1
4
+ data.tar.gz: 85facae0c9fe3bd2435321003f4fa0ad3e8a721d1ef15b47bc657d2652dec9db
5
5
  SHA512:
6
- metadata.gz: 1789e65d35e76c2dfcb16fe43b0221b21d5f9963902b0f584d0e43a3a85b3c48a3156892b7740ceeff32dc1e30e66a818b05b2e8eabb9a24076f6d151de0baea
7
- data.tar.gz: 690dd69829f2566699b992ea417ad31e06547f606e09f90eb9ae8db001a9d75b123d9b819af61f49e736549cc1e958966f22a9adcba1bd335c7268883e432efb
6
+ metadata.gz: 7b0aa15793c36237f48a6821d7aabb46e3a5c7f30237234f6d035eea276e4b1f8bfb44205ef632426106f1b0685579e190a758ad777ae93013aa908a10d5ce84
7
+ data.tar.gz: ef8e50a5d21f5b733389466fe8a0eb846659e7d298b5de671f06f0f4e7441a2795480a9a35ab7ef0d6b764f7ebd6bcc762efdaa62b6d57d77c988adeaf6e1a7f
data/ext/lzfse/ext.c CHANGED
@@ -43,43 +43,22 @@ static VALUE mLZFSE_lzfse_decode_intern(VALUE self, VALUE input) {
43
43
  // from there.
44
44
  size_t output_len = input_len * 2;
45
45
  uint8_t *output_buf = malloc(output_len);
46
+ size_t bytes_written = 0;
46
47
 
47
- // NOTE(ww): The public `lzfse_decode_buffer` API is a little bit braindead,
48
- // so we use the "internal" `lzfse_decode` API instead. This requires
49
- // us to set the decoder state up for ourselves.
50
- void *scratch_buffer = malloc(lzfse_decode_scratch_size() + 1);
51
- lzfse_decoder_state *state = (lzfse_decoder_state *)scratch_buffer;
52
-
53
- // NOTE(ww): It would be nice if there was an allocate-on-demand API, but
54
- // there isn't. So we do things the bad way.
55
48
  do {
56
- // We have to update each of these fields with every try, to avoid
57
- // mixing-and-matching decompression states between attempts.
58
- memset(state, 0x00, sizeof(lzfse_decoder_state));
59
- state->src = input_buf;
60
- state->src_begin = input_buf;
61
- state->src_end = input_buf + input_len;
62
- state->dst = output_buf;
63
- state->dst_begin = output_buf;
64
- state->dst_end = output_buf + output_len;
65
-
66
- int status = lzfse_decode(state);
67
- if (status == LZFSE_STATUS_OK) {
49
+ bytes_written = lzfse_decode_buffer(output_buf, output_len, input_buf, input_len, NULL);
50
+
51
+ if (bytes_written < output_len) {
52
+ // Successful decode.
68
53
  break;
69
- } else if (status == LZFSE_STATUS_DST_FULL) {
70
- // Try again. There is almost certainly a better way of doing this
71
- // that involves preserving the decoder state and reusing the partially
72
- // decoded buffer, but this suffices for now.
54
+ } else {
55
+ // Try again with a bigger buffer.
73
56
  output_len *= 2;
74
57
  output_buf = realloc(output_buf, output_len);
75
- } else {
76
- rb_raise(cDecodeError, "internal error while decoding (%d)", status);
77
58
  }
78
59
  } while (true);
79
60
 
80
- free(scratch_buffer);
81
-
82
- VALUE output_str = rb_str_new((char *)output_buf, state->dst - output_buf);
61
+ VALUE output_str = rb_str_new((char *)output_buf, bytes_written);
83
62
  free(output_buf);
84
63
 
85
64
  return output_str;
data/lib/lzfse/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LZFSE
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
metadata CHANGED
@@ -1,72 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lzfse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Woodruff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-02 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: minitest
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake-compiler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rubocop
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: yard
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- description: Ruby bindings for Apple's LZFSE (+ LZVN)
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ lzfse is a Ruby gem containing bindings for Apple's LZFSE and LZVN
15
+ compression algorithms. It binds Apple's reference implementation
16
+ and exposes compression and decompression APIs for both LZFSE and
17
+ LZVN.
70
18
  email: william@yossarian.net
71
19
  executables: []
72
20
  extensions:
@@ -97,13 +45,11 @@ files:
97
45
  - lib/lzfse.rb
98
46
  - lib/lzfse/exceptions.rb
99
47
  - lib/lzfse/version.rb
100
- - vendor/bundle/ruby/2.7.0/gems/rainbow-3.0.0/LICENSE
101
- - vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/LICENSE
102
- - vendor/bundle/ruby/2.7.0/gems/yard-0.9.26/LICENSE
103
48
  homepage: https://github.com/woodruffw/lzfse.rb
104
49
  licenses:
105
50
  - MIT
106
- metadata: {}
51
+ metadata:
52
+ rubygems_mfa_required: 'true'
107
53
  post_install_message:
108
54
  rdoc_options: []
109
55
  require_paths:
@@ -112,14 +58,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
58
  requirements:
113
59
  - - ">="
114
60
  - !ruby/object:Gem::Version
115
- version: '2.7'
61
+ version: '3.0'
116
62
  required_rubygems_version: !ruby/object:Gem::Requirement
117
63
  requirements:
118
64
  - - ">="
119
65
  - !ruby/object:Gem::Version
120
66
  version: '0'
121
67
  requirements: []
122
- rubygems_version: 3.1.4
68
+ rubygems_version: 3.3.5
123
69
  signing_key:
124
70
  specification_version: 4
125
71
  summary: Ruby bindings for Apple's LZFSE (+ LZVN)
@@ -1,20 +0,0 @@
1
- Copyright (c) Marcin Kulik
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,22 +0,0 @@
1
- Copyright (c) 2010, 2012-2015, Ammar Ali
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
@@ -1,22 +0,0 @@
1
- Copyright (c) 2007-2018 Loren Segal
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.