ruby-zstds 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd4f85616a45bb4ea60d08e4f6e4dfa0091d5a098458e3f5c5ac81d6c9113aa3
4
- data.tar.gz: a7b1afaa038f4339b0de26e91ae86c16a942620f8f450cbc791a7330cec372cb
3
+ metadata.gz: 80ccd3c8a7210dcf3fabdfadcca8e37ce82d5fe78c7f761f5ae7c355ff746854
4
+ data.tar.gz: a4ed4e5dd4c89b7f95438c5e3033d09eb25721ab32fda8e1eac9351774ab3215
5
5
  SHA512:
6
- metadata.gz: 0e76817922415c3fa1381aca25636aef90cc1a4bb98c8c8adc998667fc5eb10e24e27f66127f6c93d341af222bbf44229ef37996ea24fa89888b5381f0e8f1fb
7
- data.tar.gz: c4aaa1527b723e6c2eec1f185b10657d50fd2e55fb0a9debf4cf993d561931b8cb60216023b0971d4739389eadcdccec011db668b943bfdc49f323e5852f409c
6
+ metadata.gz: 967b5d866cd79b139bdbca97e1fdacf9063e3bc425f441be239980dd839d123173fcad15c0830576a32fe7c0bb5166f4fd5159717a9ac7f038fe57a435859f70
7
+ data.tar.gz: 78c54fc20f8facaa556eb68438407cfa7ff96d33425a9dce73584fc26435177dda8478c729a412f00d9b28a9d860b3dec6a059a728926a587f3a83dae9fe1836
data/ext/extconf.rb CHANGED
@@ -26,6 +26,7 @@ def require_header(name, constants: [], macroses: [], types: [])
26
26
  end
27
27
 
28
28
  require_header "zdict.h"
29
+
29
30
  require_header(
30
31
  "zstd.h",
31
32
  :constants => %w[
@@ -72,6 +73,7 @@ require_header(
72
73
  "ZSTD_strategy"
73
74
  ]
74
75
  )
76
+
75
77
  require_header(
76
78
  "zstd_errors.h",
77
79
  :constants => %w[
@@ -106,11 +108,16 @@ def require_library(name, functions)
106
108
  end
107
109
  end
108
110
 
111
+ # rubocop:disable Style/GlobalVars
112
+ if find_library "zstd", "ZDICT_getDictHeaderSize"
113
+ $defs.push "-DHAVE_ZDICT_HEADER_SIZE"
114
+ end
115
+ # rubocop:enable Style/GlobalVars
116
+
109
117
  require_library(
110
118
  "zstd",
111
119
  %w[
112
120
  ZDICT_getDictID
113
- ZDICT_getDictHeaderSize
114
121
  ZDICT_isError
115
122
  ZDICT_trainFromBuffer
116
123
  ZSTD_CCtx_loadDictionary
@@ -9,7 +9,6 @@
9
9
  #include "zstds_ext/buffer.h"
10
10
  #include "zstds_ext/error.h"
11
11
  #include "zstds_ext/gvl.h"
12
- #include "zstds_ext/macro.h"
13
12
  #include "zstds_ext/option.h"
14
13
 
15
14
  // -- initialization --
@@ -153,7 +152,8 @@ VALUE zstds_ext_get_dictionary_buffer_id(VALUE ZSTDS_EXT_UNUSED(self), VALUE buf
153
152
  return UINT2NUM(id);
154
153
  }
155
154
 
156
- VALUE zstds_ext_get_dictionary_header_size(VALUE ZSTDS_EXT_UNUSED(self), VALUE buffer)
155
+ #if defined(HAVE_ZDICT_HEADER_SIZE)
156
+ VALUE zstds_ext_get_dictionary_header_size(VALUE self, VALUE buffer)
157
157
  {
158
158
  zstds_result_t result = ZDICT_getDictHeaderSize(RSTRING_PTR(buffer), RSTRING_LEN(buffer));
159
159
  if (ZDICT_isError(result)) {
@@ -163,6 +163,13 @@ VALUE zstds_ext_get_dictionary_header_size(VALUE ZSTDS_EXT_UNUSED(self), VALUE b
163
163
  return SIZET2NUM(result);
164
164
  }
165
165
 
166
+ #else
167
+ ZSTDS_EXT_NORETURN VALUE zstds_ext_get_dictionary_header_size(VALUE self, VALUE buffer)
168
+ {
169
+ zstds_ext_raise_error(ZSTDS_EXT_ERROR_NOT_IMPLEMENTED);
170
+ };
171
+ #endif
172
+
166
173
  // -- exports --
167
174
 
168
175
  void zstds_ext_dictionary_exports(VALUE root_module)
@@ -6,11 +6,19 @@
6
6
 
7
7
  #include "ruby.h"
8
8
 
9
+ #include "zstds_ext/macro.h"
10
+
9
11
  #define ZSTDS_EXT_DEFAULT_DICTIONARY_CAPACITY (1 << 17); // 128 KB
10
12
 
11
13
  VALUE zstds_ext_train_dictionary_buffer(VALUE self, VALUE samples, VALUE options);
12
14
  VALUE zstds_ext_get_dictionary_buffer_id(VALUE self, VALUE buffer);
13
15
 
16
+ #if defined(HAVE_ZDICT_HEADER_SIZE)
17
+ VALUE zstds_ext_get_dictionary_header_size(VALUE self, VALUE buffer);
18
+ #else
19
+ ZSTDS_EXT_NORETURN VALUE zstds_ext_get_dictionary_header_size(VALUE self, VALUE buffer);
20
+ #endif
21
+
14
22
  void zstds_ext_dictionary_exports(VALUE root_module);
15
23
 
16
24
  #endif // ZSTDS_EXT_DICTIONARY_H
@@ -69,6 +69,9 @@ void zstds_ext_raise_error(zstds_ext_result_t ext_result)
69
69
  case ZSTDS_EXT_ERROR_WRITE_IO:
70
70
  raise_error("WriteIOError", "failed to write IO");
71
71
 
72
+ case ZSTDS_EXT_ERROR_NOT_IMPLEMENTED:
73
+ raise_error("NotImplementedError", "not implemented error");
74
+
72
75
  default:
73
76
  // ZSTDS_EXT_ERROR_UNEXPECTED
74
77
  raise_error("UnexpectedError", "unexpected error");
@@ -26,6 +26,7 @@ enum
26
26
  ZSTDS_EXT_ERROR_READ_IO,
27
27
  ZSTDS_EXT_ERROR_WRITE_IO,
28
28
 
29
+ ZSTDS_EXT_ERROR_NOT_IMPLEMENTED,
29
30
  ZSTDS_EXT_ERROR_UNEXPECTED
30
31
  };
31
32
 
data/ext/zstds_ext/gvl.h CHANGED
@@ -4,7 +4,7 @@
4
4
  #if !defined(ZSTDS_EXT_GVL_H)
5
5
  #define ZSTDS_EXT_GVL_H
6
6
 
7
- #ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
7
+ #if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
8
8
 
9
9
  #include "ruby/thread.h"
10
10
 
@@ -10,4 +10,10 @@
10
10
  #define ZSTDS_EXT_UNUSED(x) x
11
11
  #endif
12
12
 
13
+ #if defined(__GNUC__)
14
+ #define ZSTDS_EXT_NORETURN __attribute__((__noreturn__))
15
+ #else
16
+ #define ZSTDS_EXT_NORETURN
17
+ #endif
18
+
13
19
  #endif // ZSTDS_EXT_MACRO_H
data/lib/zstds/error.rb CHANGED
@@ -18,5 +18,6 @@ module ZSTDS
18
18
  class ReadIOError < BaseError; end
19
19
  class WriteIOError < BaseError; end
20
20
 
21
- class UnexpectedError < BaseError; end
21
+ class NotImplementedError < BaseError; end
22
+ class UnexpectedError < BaseError; end
22
23
  end
data/lib/zstds/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2019 AUTHORS, MIT License.
3
3
 
4
4
  module ZSTDS
5
- VERSION = "1.2.0".freeze
5
+ VERSION = "1.2.1".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-zstds
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Aladjev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-30 00:00:00.000000000 Z
11
+ date: 2022-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.14'
61
+ version: '5.15'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.14'
68
+ version: '5.15'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ocg
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -128,42 +128,42 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.22'
131
+ version: '1.24'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.22'
138
+ version: '1.24'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop-minitest
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.15'
145
+ version: '0.17'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.15'
152
+ version: '0.17'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubocop-performance
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.11'
159
+ version: '1.13'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '1.11'
166
+ version: '1.13'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rubocop-rake
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -244,7 +244,8 @@ files:
244
244
  homepage: https://github.com/andrew-aladev/ruby-zstds
245
245
  licenses:
246
246
  - MIT
247
- metadata: {}
247
+ metadata:
248
+ rubygems_mfa_required: 'true'
248
249
  post_install_message:
249
250
  rdoc_options: []
250
251
  require_paths:
@@ -260,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
261
  - !ruby/object:Gem::Version
261
262
  version: '0'
262
263
  requirements: []
263
- rubygems_version: 3.2.22
264
+ rubygems_version: 3.3.3
264
265
  signing_key:
265
266
  specification_version: 4
266
267
  summary: Ruby bindings for zstd library.