ruby-lzws 1.1.0 → 1.1.5

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: '08551ca534634f131621d9bea42ec6d06bf7b1be6f3f7f3cb33bd11f9744ec1a'
4
- data.tar.gz: db0b8c35c381df919bb9b21b9064abd4d88bdc28a82cdead9365f97c4e698b96
3
+ metadata.gz: a57fe20aab5886c14c0891ae6d61992532bb93a39a3ac3bac615d274666b9cee
4
+ data.tar.gz: '09fe72cfbf5aa061849efcbb3b73148dcb4481ccf9284544cbb74c2ee20de88d'
5
5
  SHA512:
6
- metadata.gz: 0063ee032bf5b6cac9d7e16e696e235c18acec9a6ae48a66c5516906ca290b1c30fb6a0867d371b7b2404706a7523130e00e3b7bb17c1484017a0862a0c7c03f
7
- data.tar.gz: eb1905eb2a128c716ffec1693b5be4ce94fb52894ea60adcb446ae03cc3263d8b51b62092e7e164085e875dac752a328b110c68bfdcfc631356d294ec3c50bd6
6
+ metadata.gz: 0c54fcae56fd3316e5a5ef3a84d381bc9a0c878c4f37a3b012a01cda98de8a8580809cfe03b81614260ba2518833aa691db6180a49862d0f41954f391ca8b1f2
7
+ data.tar.gz: 640e27b7c541376b0c816158749dda2b7f40926c0b773d48255135be98261f3110ed75711b7ee648d1ea1f316aaf4a951068d89eebc672b45e75013f993d4320
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # Ruby bindings for lzws library
2
2
 
3
- [![Travis build status](https://travis-ci.org/andrew-aladev/ruby-lzws.svg?branch=master)](https://travis-ci.org/andrew-aladev/ruby-lzws)
4
- [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/andrew-aladev/ruby-lzws?branch=master&svg=true)](https://ci.appveyor.com/project/andrew-aladev/ruby-lzws/branch/master)
3
+ | Travis | AppVeyor | Cirrus | Circle | Codecov |
4
+ | :---: | :---: | :---: | :---: | :---: |
5
+ | [![Travis test status](https://travis-ci.com/andrew-aladev/ruby-lzws.svg?branch=master)](https://travis-ci.com/andrew-aladev/ruby-lzws) | [![AppVeyor test status](https://ci.appveyor.com/api/projects/status/github/andrew-aladev/ruby-lzws?branch=master&svg=true)](https://ci.appveyor.com/project/andrew-aladev/ruby-lzws/branch/master) | [![Cirrus test status](https://api.cirrus-ci.com/github/andrew-aladev/ruby-lzws.svg?branch=master)](https://cirrus-ci.com/github/andrew-aladev/ruby-lzws) | [![Circle test status](https://circleci.com/gh/andrew-aladev/ruby-lzws/tree/master.svg?style=shield)](https://circleci.com/gh/andrew-aladev/ruby-lzws/tree/master) | [![Codecov](https://codecov.io/gh/andrew-aladev/ruby-lzws/branch/master/graph/badge.svg)](https://codecov.io/gh/andrew-aladev/ruby-lzws) |
5
6
 
6
7
  See [lzws library](https://github.com/andrew-aladev/lzws).
7
8
 
8
9
  ## Installation
9
10
 
10
- Please install lzws library first.
11
+ Please install lzws library first, use latest 1.3.0+ version.
11
12
 
12
13
  ```sh
13
14
  gem install ruby-lzws
@@ -35,6 +36,27 @@ LZWS::File.decompress "file.txt.Z", "file.txt"
35
36
 
36
37
  LZWS::Stream::Writer.open("file.txt.Z") { |writer| writer << "TOBEORNOTTOBEORTOBEORNOT" }
37
38
  puts LZWS::Stream::Reader.open("file.txt.Z") { |reader| reader.read }
39
+
40
+ writer = LZWS::Stream::Writer.new output_socket
41
+ begin
42
+ bytes_written = writer.write_nonblock "TOBEORNOTTOBEORTOBEORNOT"
43
+ # handle "bytes_written"
44
+ rescue IO::WaitWritable
45
+ # handle wait
46
+ ensure
47
+ writer.close
48
+ end
49
+
50
+ reader = LZWS::Stream::Reader.new input_socket
51
+ begin
52
+ puts reader.read_nonblock(512)
53
+ rescue IO::WaitReadable
54
+ # handle wait
55
+ rescue ::EOFError
56
+ # handle eof
57
+ ensure
58
+ reader.close
59
+ end
38
60
  ```
39
61
 
40
62
  You can create and read `tar.Z` archives with `minitar` for example.
@@ -81,7 +103,7 @@ Values: 0, 2 - infinity, default value: 0.
81
103
  :max_code_bit_length
82
104
  ```
83
105
 
84
- Values: 9 - 16, default value: 16.
106
+ Values: `LZWS::Option::LOWEST_MAX_CODE_BIT_LENGTH` - `LZWS::Option::BIGGEST_MAX_CODE_BIT_LENGTH`, default value: `LZWS::Option::BIGGEST_MAX_CODE_BIT_LENGTH`.
85
107
 
86
108
  ```
87
109
  :block_mode
@@ -185,7 +207,7 @@ File maintains both source and destination buffers, it accepts both `source_buff
185
207
 
186
208
  ## Stream::Writer
187
209
 
188
- Its behaviour is similar to builtin [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.6.1/libdoc/zlib/rdoc/Zlib/GzipWriter.html).
210
+ Its behaviour is similar to builtin [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html).
189
211
 
190
212
  Writer maintains destination buffer only, so it accepts `destination_buffer_length` option only.
191
213
 
@@ -219,7 +241,7 @@ Set another encodings, `nil` is just for compatibility with `IO`.
219
241
  #tell
220
242
  ```
221
243
 
222
- See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
244
+ See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
223
245
 
224
246
  ```
225
247
  #write(*objects)
@@ -229,7 +251,7 @@ See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
229
251
  #closed?
230
252
  ```
231
253
 
232
- See [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.6.1/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
254
+ See [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
233
255
 
234
256
  ```
235
257
  #write_nonblock(object, *options)
@@ -251,11 +273,11 @@ Behaviour is the same as `IO#write_nonblock` method.
251
273
  #puts(*objects)
252
274
  ```
253
275
 
254
- Typical helpers, see [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.6.1/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
276
+ Typical helpers, see [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
255
277
 
256
278
  ## Stream::Reader
257
279
 
258
- Its behaviour is similar to builtin [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.6.1/libdoc/zlib/rdoc/Zlib/GzipReader.html).
280
+ Its behaviour is similar to builtin [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html).
259
281
 
260
282
  Reader maintains both source and destination buffers, it accepts both `source_buffer_length` and `destination_buffer_length` options.
261
283
 
@@ -290,7 +312,7 @@ Set another encodings.
290
312
  #tell
291
313
  ```
292
314
 
293
- See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
315
+ See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
294
316
 
295
317
  ```
296
318
  #read(bytes_to_read = nil, out_buffer = nil)
@@ -300,14 +322,14 @@ See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
300
322
  #closed?
301
323
  ```
302
324
 
303
- See [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.6.1/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
325
+ See [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
304
326
 
305
327
  ```
306
328
  #readpartial(bytes_to_read = nil, out_buffer = nil)
307
329
  #read_nonblock(bytes_to_read, out_buffer = nil, *options)
308
330
  ```
309
331
 
310
- See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
332
+ See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
311
333
 
312
334
  ```
313
335
  #getbyte
@@ -330,7 +352,15 @@ See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
330
352
  #ungetline(line)
331
353
  ```
332
354
 
333
- Typical helpers, see [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.6.1/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
355
+ Typical helpers, see [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
356
+
357
+ ## CI
358
+
359
+ See universal test script [scripts/ci_test.sh](scripts/ci_test.sh) for CI.
360
+ Please visit [scripts/test-images](scripts/test-images).
361
+ You can run this test script using many native and cross images.
362
+
363
+ Cirrus CI uses `x86_64-pc-linux-gnu` image, Circle CI - `x86_64-gentoo-linux-musl` image.
334
364
 
335
365
  ## License
336
366
 
@@ -3,51 +3,57 @@
3
3
 
4
4
  require "mkmf"
5
5
 
6
- def require_header(name)
6
+ def require_header(name, types = [])
7
7
  abort "Can't find #{name} header" unless find_header name
8
+
9
+ types.each do |type|
10
+ abort "Can't find #{type} type in #{name} header" unless find_type type, nil, name
11
+ end
8
12
  end
9
13
 
10
14
  require_header "lzws/buffer.h"
15
+ require_header "lzws/common.h", %w[lzws_result_t]
11
16
  require_header "lzws/compressor/common.h"
12
17
  require_header "lzws/compressor/main.h"
13
- require_header "lzws/compressor/state.h"
18
+ require_header "lzws/compressor/state.h", %w[lzws_compressor_state_t]
14
19
  require_header "lzws/decompressor/common.h"
15
20
  require_header "lzws/decompressor/main.h"
16
- require_header "lzws/decompressor/state.h"
21
+ require_header "lzws/decompressor/state.h", %w[lzws_decompressor_state_t]
17
22
  require_header "lzws/file.h"
18
23
 
19
24
  def require_library(name, functions)
20
25
  functions.each do |function|
21
- abort "Can't find #{name} library and #{function} function" unless find_library name, function
26
+ abort "Can't find #{function} function in #{name} library" unless find_library name, function
22
27
  end
23
28
  end
24
29
 
25
- functions = %w[
26
- lzws_create_source_buffer_for_compressor
27
- lzws_create_destination_buffer_for_compressor
28
- lzws_create_source_buffer_for_decompressor
29
- lzws_create_destination_buffer_for_decompressor
30
-
31
- lzws_compressor_get_initial_state
32
- lzws_compressor_free_state
33
- lzws_compress
34
- lzws_compressor_finish
30
+ require_library(
31
+ "lzws",
32
+ %w[
33
+ lzws_create_source_buffer_for_compressor
34
+ lzws_create_destination_buffer_for_compressor
35
+ lzws_create_source_buffer_for_decompressor
36
+ lzws_create_destination_buffer_for_decompressor
35
37
 
36
- lzws_decompressor_get_initial_state
37
- lzws_decompressor_free_state
38
- lzws_decompress
38
+ lzws_compressor_get_initial_state
39
+ lzws_compressor_free_state
40
+ lzws_compress
41
+ lzws_compressor_finish
39
42
 
40
- lzws_compress_file
41
- lzws_decompress_file
42
- ]
43
- .freeze
43
+ lzws_decompressor_get_initial_state
44
+ lzws_decompressor_free_state
45
+ lzws_decompress
44
46
 
45
- require_library "lzws", functions
47
+ lzws_compress_file
48
+ lzws_decompress_file
49
+ ]
50
+ )
46
51
 
47
52
  extension_name = "lzws_ext".freeze
48
53
  dir_config extension_name
49
54
 
50
- sources = %w[
55
+ # rubocop:disable Style/GlobalVars
56
+ $srcs = %w[
51
57
  stream/compressor
52
58
  stream/decompressor
53
59
  buffer
@@ -57,14 +63,16 @@ sources = %w[
57
63
  option
58
64
  string
59
65
  ]
66
+ .map { |name| "src/#{extension_name}/#{name}.c" }
60
67
  .freeze
61
68
 
62
- # rubocop:disable Style/GlobalVars
63
- $srcs = sources
64
- .map { |name| "src/#{extension_name}/#{name}.c" }
65
- .freeze
69
+ if ENV["CI"] || ENV["COVERAGE"]
70
+ $CFLAGS << " --coverage"
71
+ $LDFLAGS << " --coverage"
72
+ end
66
73
 
67
74
  $CFLAGS << " -Wno-declaration-after-statement"
75
+
68
76
  $VPATH << "$(srcdir)/#{extension_name}:$(srcdir)/#{extension_name}/stream"
69
77
  # rubocop:enable Style/GlobalVars
70
78
 
@@ -7,12 +7,24 @@
7
7
 
8
8
  #include "ruby.h"
9
9
 
10
+ VALUE lzws_ext_create_string_buffer(VALUE length)
11
+ {
12
+ return rb_str_new(NULL, NUM2SIZET(length));
13
+ }
14
+
15
+ VALUE lzws_ext_resize_string_buffer(VALUE args)
16
+ {
17
+ VALUE buffer = rb_ary_entry(args, 0);
18
+ VALUE length = rb_ary_entry(args, 1);
19
+ return rb_str_resize(buffer, NUM2SIZET(length));
20
+ }
21
+
10
22
  void lzws_ext_buffer_exports(VALUE root_module)
11
23
  {
12
- VALUE option = rb_define_module_under(root_module, "Buffer");
24
+ VALUE module = rb_define_module_under(root_module, "Buffer");
13
25
 
14
- rb_define_const(option, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR", UINT2NUM(LZWS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR));
15
- rb_define_const(option, "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR", UINT2NUM(LZWS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR));
16
- rb_define_const(option, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR", UINT2NUM(LZWS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR));
17
- rb_define_const(option, "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR", UINT2NUM(LZWS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR));
26
+ rb_define_const(module, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR", SIZET2NUM(LZWS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR));
27
+ rb_define_const(module, "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR", SIZET2NUM(LZWS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR));
28
+ rb_define_const(module, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR", SIZET2NUM(LZWS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR));
29
+ rb_define_const(module, "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR", SIZET2NUM(LZWS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR));
18
30
  }
@@ -6,6 +6,18 @@
6
6
 
7
7
  #include "ruby.h"
8
8
 
9
+ VALUE lzws_ext_create_string_buffer(VALUE length);
10
+
11
+ #define LZWS_EXT_CREATE_STRING_BUFFER(buffer, length, exception) \
12
+ VALUE buffer = rb_protect(lzws_ext_create_string_buffer, SIZET2NUM(length), &exception);
13
+
14
+ VALUE lzws_ext_resize_string_buffer(VALUE args);
15
+
16
+ #define LZWS_EXT_RESIZE_STRING_BUFFER(buffer, length, exception) \
17
+ VALUE args = rb_ary_new_from_args(2, buffer, SIZET2NUM(length)); \
18
+ buffer = rb_protect(lzws_ext_resize_string_buffer, args, &exception); \
19
+ RB_GC_GUARD(args);
20
+
9
21
  void lzws_ext_buffer_exports(VALUE root_module);
10
22
 
11
23
  #endif // LZWS_EXT_BUFFER_H
@@ -10,4 +10,7 @@
10
10
 
11
11
  typedef uint_fast8_t lzws_ext_result_t;
12
12
 
13
+ typedef uint8_t lzws_ext_byte_t;
14
+ typedef uint_fast8_t lzws_ext_byte_fast_t;
15
+
13
16
  #endif // LZWS_EXT_COMMON_H
@@ -3,7 +3,6 @@
3
3
 
4
4
  #include "lzws_ext/error.h"
5
5
 
6
- #include "lzws_ext/common.h"
7
6
  #include "ruby.h"
8
7
 
9
8
  static inline NORETURN(void raise(const char* name, const char* description))
@@ -13,9 +12,9 @@ static inline NORETURN(void raise(const char* name, const char* description))
13
12
  rb_raise(error, "%s", description);
14
13
  }
15
14
 
16
- void lzws_ext_raise_error(lzws_ext_result_t result)
15
+ void lzws_ext_raise_error(lzws_ext_result_t ext_result)
17
16
  {
18
- switch (result) {
17
+ switch (ext_result) {
19
18
  case LZWS_EXT_ERROR_ALLOCATE_FAILED:
20
19
  raise("AllocateError", "allocate error");
21
20
  case LZWS_EXT_ERROR_VALIDATE_FAILED:
@@ -25,6 +25,6 @@ enum {
25
25
  LZWS_EXT_ERROR_UNEXPECTED
26
26
  };
27
27
 
28
- NORETURN(void lzws_ext_raise_error(lzws_ext_result_t result));
28
+ NORETURN(void lzws_ext_raise_error(lzws_ext_result_t ext_result));
29
29
 
30
30
  #endif // LZWS_EXT_ERROR_H
@@ -3,9 +3,9 @@
3
3
 
4
4
  #include "ruby/io.h"
5
5
 
6
+ #include <lzws/common.h>
6
7
  #include <lzws/file.h>
7
8
 
8
- #include "lzws_ext/common.h"
9
9
  #include "lzws_ext/error.h"
10
10
  #include "lzws_ext/io.h"
11
11
  #include "lzws_ext/macro.h"
@@ -63,8 +63,7 @@ VALUE lzws_ext_compress_io(VALUE LZWS_EXT_UNUSED(self), VALUE source, VALUE dest
63
63
  without_magic_header, max_code_bit_length, block_mode, msb, unaligned_bit_groups, quiet);
64
64
 
65
65
  if (result != 0) {
66
- lzws_ext_result_t ext_result = get_file_error(result);
67
- lzws_ext_raise_error(ext_result);
66
+ lzws_ext_raise_error(get_file_error(result));
68
67
  }
69
68
 
70
69
  // Ruby itself won't flush stdio file before closing fd, flush is required.
@@ -88,8 +87,7 @@ VALUE lzws_ext_decompress_io(VALUE LZWS_EXT_UNUSED(self), VALUE source, VALUE de
88
87
  without_magic_header, msb, unaligned_bit_groups, quiet);
89
88
 
90
89
  if (result != 0) {
91
- lzws_ext_result_t ext_result = get_file_error(result);
92
- lzws_ext_raise_error(ext_result);
90
+ lzws_ext_raise_error(get_file_error(result));
93
91
  }
94
92
 
95
93
  // Ruby itself won't flush stdio file before closing fd, flush is required.
@@ -2,7 +2,6 @@
2
2
  // Copyright (c) 2019 AUTHORS, MIT License.
3
3
 
4
4
  #include "lzws_ext/buffer.h"
5
- #include "lzws_ext/common.h"
6
5
  #include "lzws_ext/io.h"
7
6
  #include "lzws_ext/stream/compressor.h"
8
7
  #include "lzws_ext/stream/decompressor.h"
@@ -3,8 +3,6 @@
3
3
 
4
4
  #include "lzws_ext/option.h"
5
5
 
6
- #include <stdbool.h>
7
-
8
6
  #include "lzws_ext/error.h"
9
7
  #include "ruby.h"
10
8
 
@@ -25,7 +23,7 @@ bool lzws_ext_get_bool_option_value(VALUE options, const char* name)
25
23
  return raw_type == T_TRUE;
26
24
  }
27
25
 
28
- unsigned long lzws_ext_get_fixnum_option_value(VALUE options, const char* name)
26
+ unsigned int lzws_ext_get_uint_option_value(VALUE options, const char* name)
29
27
  {
30
28
  VALUE raw_value = get_raw_option_value(options, name);
31
29
 
@@ -33,3 +31,12 @@ unsigned long lzws_ext_get_fixnum_option_value(VALUE options, const char* name)
33
31
 
34
32
  return NUM2UINT(raw_value);
35
33
  }
34
+
35
+ size_t lzws_ext_get_size_option_value(VALUE options, const char* name)
36
+ {
37
+ VALUE raw_value = get_raw_option_value(options, name);
38
+
39
+ Check_Type(raw_value, T_FIXNUM);
40
+
41
+ return NUM2SIZET(raw_value);
42
+ }
@@ -5,24 +5,30 @@
5
5
  #define LZWS_EXT_OPTIONS_H
6
6
 
7
7
  #include <stdbool.h>
8
+ #include <stdlib.h>
8
9
 
10
+ #include "lzws_ext/common.h"
9
11
  #include "ruby.h"
10
12
 
11
- bool lzws_ext_get_bool_option_value(VALUE options, const char* name);
12
- unsigned long lzws_ext_get_fixnum_option_value(VALUE options, const char* name);
13
+ bool lzws_ext_get_bool_option_value(VALUE options, const char* name);
14
+ unsigned int lzws_ext_get_uint_option_value(VALUE options, const char* name);
15
+ size_t lzws_ext_get_size_option_value(VALUE options, const char* name);
13
16
 
14
17
  #define LZWS_EXT_GET_BOOL_OPTION(options, name) \
15
18
  bool name = lzws_ext_get_bool_option_value(options, #name);
16
19
 
17
- #define LZWS_EXT_GET_FIXNUM_OPTION(options, type, name) \
18
- type name = lzws_ext_get_fixnum_option_value(options, #name);
20
+ #define LZWS_EXT_GET_UINT_OPTION(options, type, name) \
21
+ type name = lzws_ext_get_uint_option_value(options, #name);
19
22
 
20
- #define LZWS_EXT_GET_COMPRESSOR_OPTIONS(options) \
21
- LZWS_EXT_GET_BOOL_OPTION(options, without_magic_header); \
22
- LZWS_EXT_GET_FIXNUM_OPTION(options, uint_fast8_t, max_code_bit_length); \
23
- LZWS_EXT_GET_BOOL_OPTION(options, block_mode); \
24
- LZWS_EXT_GET_BOOL_OPTION(options, msb); \
25
- LZWS_EXT_GET_BOOL_OPTION(options, unaligned_bit_groups); \
23
+ #define LZWS_EXT_GET_SIZE_OPTION(options, name) \
24
+ size_t name = lzws_ext_get_size_option_value(options, #name);
25
+
26
+ #define LZWS_EXT_GET_COMPRESSOR_OPTIONS(options) \
27
+ LZWS_EXT_GET_BOOL_OPTION(options, without_magic_header); \
28
+ LZWS_EXT_GET_UINT_OPTION(options, lzws_ext_byte_fast_t, max_code_bit_length); \
29
+ LZWS_EXT_GET_BOOL_OPTION(options, block_mode); \
30
+ LZWS_EXT_GET_BOOL_OPTION(options, msb); \
31
+ LZWS_EXT_GET_BOOL_OPTION(options, unaligned_bit_groups); \
26
32
  LZWS_EXT_GET_BOOL_OPTION(options, quiet);
27
33
 
28
34
  #define LZWS_EXT_GET_DECOMPRESSOR_OPTIONS(options) \
@@ -32,6 +38,6 @@ unsigned long lzws_ext_get_fixnum_option_value(VALUE options, const char* name);
32
38
  LZWS_EXT_GET_BOOL_OPTION(options, quiet);
33
39
 
34
40
  #define LZWS_EXT_GET_BUFFER_LENGTH_OPTION(options, name) \
35
- LZWS_EXT_GET_FIXNUM_OPTION(options, size_t, name);
41
+ LZWS_EXT_GET_SIZE_OPTION(options, name);
36
42
 
37
43
  #endif // LZWS_EXT_OPTIONS_H