ruby-brs 1.1.2 → 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: f79255ffdaf743bde0edc13c314d1cf7f12402a9993389d6a86dea3d449b4e21
4
- data.tar.gz: 8ca40ddca9e58f2876c33bd17bc353bdb739cf79d344ff5bf3c217c52a9cd2ac
3
+ metadata.gz: f7c98f5678a0545688d9a0bb7537d2eb55507559c2f6d61855796983e4b8a763
4
+ data.tar.gz: 19bbed82c75ecf25c17a7848b97890dfad5387a3d9244b16db2447bb21425c1b
5
5
  SHA512:
6
- metadata.gz: 801a6df0e461a1df124647362c10a6af08d0e5621ef5682987d6d0615b548e3fa51d5c184afd804be33cf4da74ce0ef810f8209851f5b5efe31037ac6912f205
7
- data.tar.gz: ef62bbc6958e7de16d59eb0a56f84cc9c7ae7f88738219d642562455d7d7815df29cd94fa32da7f23dbf7065310c46e0081e3d0ce0443af8aa5d0257d1a765ba
6
+ metadata.gz: c7a82e47ac99a515794cc5e56153d10993b5b87fdb9f091dd04a685689dadcee2aec961b2cefbd1fd9531c457cd45af5d0d05af87178642b5bb545fa2f9f9246
7
+ data.tar.gz: 481e233bfd17fe958a384787b2dd0f469b9017d7005cb9c1b88bdf48cad578767c5003e52b53ce6fcda35635a57339115a6cd21f0768281626df99995ee308ee
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Ruby bindings for brotli library
2
2
 
3
- | Travis | AppVeyor | Cirrus | Circle | Codecov |
4
- | :---: | :---: | :---: | :---: | :---: |
5
- | [![Travis test status](https://travis-ci.com/andrew-aladev/ruby-brs.svg?branch=master)](https://travis-ci.com/andrew-aladev/ruby-brs) | [![AppVeyor test status](https://ci.appveyor.com/api/projects/status/github/andrew-aladev/ruby-brs?branch=master&svg=true)](https://ci.appveyor.com/project/andrew-aladev/ruby-brs/branch/master) | [![Cirrus test status](https://api.cirrus-ci.com/github/andrew-aladev/ruby-brs.svg?branch=master)](https://cirrus-ci.com/github/andrew-aladev/ruby-brs) | [![Circle test status](https://circleci.com/gh/andrew-aladev/ruby-brs/tree/master.svg?style=shield)](https://circleci.com/gh/andrew-aladev/ruby-brs/tree/master) | [![Codecov](https://codecov.io/gh/andrew-aladev/ruby-brs/branch/master/graph/badge.svg)](https://codecov.io/gh/andrew-aladev/ruby-brs) |
3
+ | AppVeyor | Circle | Github actions | Codecov | Gem |
4
+ | :------: | :----: | :------------: | :-----: | :--: |
5
+ | [![AppVeyor test status](https://ci.appveyor.com/api/projects/status/github/andrew-aladev/ruby-brs?branch=master&svg=true)](https://ci.appveyor.com/project/andrew-aladev/ruby-brs/branch/master) | [![Circle test status](https://circleci.com/gh/andrew-aladev/ruby-brs/tree/master.svg?style=shield)](https://circleci.com/gh/andrew-aladev/ruby-brs/tree/master) | [![Github Actions test status](https://github.com/andrew-aladev/ruby-brs/workflows/test/badge.svg?branch=master)](https://github.com/andrew-aladev/ruby-brs/actions) | [![Codecov](https://codecov.io/gh/andrew-aladev/ruby-brs/branch/master/graph/badge.svg)](https://codecov.io/gh/andrew-aladev/ruby-brs) | [![Gem](https://img.shields.io/gem/v/ruby-brs.svg)](https://rubygems.org/gems/ruby-brs) |
6
6
 
7
7
  See [brotli library](https://github.com/google/brotli).
8
8
 
@@ -21,6 +21,8 @@ rake gem
21
21
  gem install pkg/ruby-brs-*.gem
22
22
  ```
23
23
 
24
+ You can also use [overlay](https://github.com/andrew-aladev/overlay) for gentoo.
25
+
24
26
  ## Usage
25
27
 
26
28
  There are simple APIs: `String` and `File`. Also you can use generic streaming API: `Stream::Writer` and `Stream::Reader`.
@@ -36,9 +38,30 @@ BRS::File.decompress "file.txt.br", "file.txt"
36
38
 
37
39
  BRS::Stream::Writer.open("file.txt.br") { |writer| writer << "sample string" }
38
40
  puts BRS::Stream::Reader.open("file.txt.br") { |reader| reader.read }
41
+
42
+ writer = BRS::Stream::Writer.new output_socket
43
+ begin
44
+ bytes_written = writer.write_nonblock "sample string"
45
+ # handle "bytes_written"
46
+ rescue IO::WaitWritable
47
+ # handle wait
48
+ ensure
49
+ writer.close
50
+ end
51
+
52
+ reader = BRS::Stream::Reader.new input_socket
53
+ begin
54
+ puts reader.read_nonblock(512)
55
+ rescue IO::WaitReadable
56
+ # handle wait
57
+ rescue ::EOFError
58
+ # handle eof
59
+ ensure
60
+ reader.close
61
+ end
39
62
  ```
40
63
 
41
- You can create and read `tar.br` archives with `minitar` for example.
64
+ You can create and read `tar.br` archives with [minitar](https://github.com/halostatue/minitar).
42
65
 
43
66
  ```ruby
44
67
  require "brs"
@@ -60,76 +83,70 @@ BRS::Stream::Reader.open "file.tar.br" do |reader|
60
83
  end
61
84
  ```
62
85
 
63
- ## Options
64
-
65
- Each API supports several options:
66
-
67
- ```
68
- :source_buffer_length
69
- :destination_buffer_length
70
- ```
71
-
72
- There are internal buffers for compressed and decompressed data.
73
- For example you want to use 1 KB as source buffer length for compressor - please use 256 B as destination buffer length.
74
- You want to use 256 B as source buffer length for decompressor - please use 1 KB as destination buffer length.
75
-
76
- Values: 0 - infinity, default value: 0.
77
- 0 means automatic buffer length selection.
78
-
79
- ```
80
- :mode
81
- ```
82
-
83
- Values: `BRS::Option::MODES`, default value: `:generic`.
86
+ You can also use `Content-Encoding: br` with [sinatra](http://sinatrarb.com):
84
87
 
85
- ```
86
- :quality
87
- ```
88
-
89
- Values: `BRS::Option::MIN_QUALITY` - `BRS::Option::MAX_QUALITY`, default value: `BRS::Option::MAX_QUALITY`.
88
+ ```ruby
89
+ require "brs"
90
+ require "sinatra"
90
91
 
91
- ```
92
- :lgwin
92
+ get "/" do
93
+ headers["Content-Encoding"] = "br"
94
+ BRS::String.compress "sample string"
95
+ end
93
96
  ```
94
97
 
95
- Values: `BRS::Option::MIN_LGWIN` - `BRS::Option::MAX_LGWIN`, default value: `22`.
98
+ All functionality (including streaming) can be used inside multiple threads with [parallel](https://github.com/grosser/parallel).
99
+ This code will provide heavy load for your CPU.
96
100
 
97
- ```
98
- :lgblock
99
- ```
100
-
101
- Values: `BRS::Option::MIN_LGBLOCK` - `BRS::Option::MAX_LGBLOCK`, default value: none.
101
+ ```ruby
102
+ require "brs"
103
+ require "parallel"
102
104
 
103
- ```
104
- :disable_literal_context_modeling
105
+ Parallel.each large_datas do |large_data|
106
+ BRS::String.compress large_data
107
+ end
105
108
  ```
106
109
 
107
- Values: true/false, default value: false.
110
+ ## Options
108
111
 
109
- ```
110
- :disable_ring_buffer_reallocation
111
- ```
112
+ | Option | Values | Default | Description |
113
+ |------------------------------------|------------|------------|-------------|
114
+ | `source_buffer_length` | 0 - inf | 0 (auto) | internal buffer length for source data |
115
+ | `destination_buffer_length` | 0 - inf | 0 (auto) | internal buffer length for description data |
116
+ | `gvl` | true/false | false | enables global VM lock where possible |
117
+ | `mode` | `MODES` | `:generic` | compressor mode |
118
+ | `quality` | 0 - 11 | 11 | compression level |
119
+ | `lgwin` | 10 - 24 | 22 | compressor window size |
120
+ | `lgblock` | 16 - 24 | nil (auto) | compressor input block size |
121
+ | `disable_literal_context_modeling` | true/false | false | disables literal context modeling format |
122
+ | `disable_ring_buffer_reallocation` | true/false | false | disables ring buffer reallocation |
123
+ | `size_hint` | 0 - inf | 0 (auto) | size of input (if known) |
124
+ | `large_window` | true/false | false | enables large window |
112
125
 
113
- Values: true/false, default value: false.
126
+ There are internal buffers for compressed and decompressed data.
127
+ For example you want to use 1 KB as `source_buffer_length` for compressor - please use 256 B as `destination_buffer_length`.
128
+ You want to use 256 B as `source_buffer_length` for decompressor - please use 1 KB as `destination_buffer_length`.
114
129
 
115
- ```
116
- :size_hint
117
- ```
130
+ `gvl` is disabled by default, this mode allows running multiple compressors/decompressors in different threads simultaneously.
131
+ Please consider enabling `gvl` if you don't want to launch processors in separate threads.
132
+ If `gvl` is enabled ruby won't waste time on acquiring/releasing VM lock.
118
133
 
119
- Values: 0 - infinity, default value: 0.
120
- It is reasonable to provide size of input (if known) for streaming api.
121
134
  `String` and `File` will set `:size_hint` automaticaly.
122
135
 
123
- ```
124
- :large_window
125
- ```
126
-
127
- Values: true/false, default value: false.
136
+ You can also read brotli docs for more info about options.
128
137
 
129
- Please read brotli docs for more info about options.
138
+ | Option | Related constants |
139
+ |-----------|-------------------|
140
+ | `mode` | `BRS::Option::MODES` = `%i[text font generic]` |
141
+ | `quality` | `BRS::Option::MIN_QUALITY` = 0, `BRS::Option::MAX_QUALITY` = 11 |
142
+ | `lgwin` | `BRS::Option::MIN_LGWIN` = 10, `BRS::Option::MAX_LGWIN` = 24 |
143
+ | `lgblock` | `BRS::Option::MIN_LGBLOCK` = 16, `BRS::Option::MAX_LGBLOCK` = 24 |
130
144
 
131
145
  Possible compressor options:
132
146
  ```
147
+ :source_buffer_length
148
+ :destination_buffer_length
149
+ :gvl
133
150
  :mode
134
151
  :quality
135
152
  :lgwin
@@ -141,6 +158,9 @@ Possible compressor options:
141
158
 
142
159
  Possible decompressor options:
143
160
  ```
161
+ :source_buffer_length
162
+ :destination_buffer_length
163
+ :gvl
144
164
  :disable_ring_buffer_reallocation
145
165
  :large_window
146
166
  ```
@@ -154,18 +174,6 @@ data = BRS::String.compress "sample string", :quality => 5
154
174
  puts BRS::String.decompress(data, :disable_ring_buffer_reallocation => true)
155
175
  ```
156
176
 
157
- HTTP encoding (`Content-Encoding: br`) using default options:
158
-
159
- ```ruby
160
- require "brs"
161
- require "sinatra"
162
-
163
- get "/" do
164
- headers["Content-Encoding"] = "br"
165
- BRS::String.compress "sample string"
166
- end
167
- ```
168
-
169
177
  ## String
170
178
 
171
179
  String maintains destination buffer only, so it accepts `destination_buffer_length` option only.
@@ -190,7 +198,7 @@ File maintains both source and destination buffers, it accepts both `source_buff
190
198
 
191
199
  ## Stream::Writer
192
200
 
193
- Its behaviour is similar to builtin [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html).
201
+ Its behaviour is similar to builtin [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib/libdoc/zlib/rdoc/Zlib/GzipWriter.html).
194
202
 
195
203
  Writer maintains destination buffer only, so it accepts `destination_buffer_length` option only.
196
204
 
@@ -228,7 +236,7 @@ Set another encodings, `nil` is just for compatibility with `IO`.
228
236
  #tell
229
237
  ```
230
238
 
231
- See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
239
+ See [`IO`](https://ruby-doc.org/core/IO.html) docs.
232
240
 
233
241
  ```
234
242
  #write(*objects)
@@ -238,7 +246,7 @@ See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
238
246
  #closed?
239
247
  ```
240
248
 
241
- See [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
249
+ See [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
242
250
 
243
251
  ```
244
252
  #write_nonblock(object, *options)
@@ -252,6 +260,9 @@ Special asynchronous methods missing in `Zlib::GzipWriter`.
252
260
  So it is possible to have asynchronous variants for these synchronous methods.
253
261
  Behaviour is the same as `IO#write_nonblock` method.
254
262
 
263
+ All nonblock operations for file will raise `EBADF` error on Windows.
264
+ Setting file into nonblocking mode is [not available on Windows](https://github.com/ruby/ruby/blob/master/win32/win32.c#L4388).
265
+
255
266
  ```
256
267
  #<<(object)
257
268
  #print(*objects)
@@ -260,11 +271,11 @@ Behaviour is the same as `IO#write_nonblock` method.
260
271
  #puts(*objects)
261
272
  ```
262
273
 
263
- Typical helpers, see [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
274
+ Typical helpers, see [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
264
275
 
265
276
  ## Stream::Reader
266
277
 
267
- Its behaviour is similar to builtin [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html).
278
+ Its behaviour is similar to builtin [`Zlib::GzipReader`](https://ruby-doc.org/stdlib/libdoc/zlib/rdoc/Zlib/GzipReader.html).
268
279
 
269
280
  Reader maintains both source and destination buffers, it accepts both `source_buffer_length` and `destination_buffer_length` options.
270
281
 
@@ -299,7 +310,7 @@ Set another encodings.
299
310
  #tell
300
311
  ```
301
312
 
302
- See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
313
+ See [`IO`](https://ruby-doc.org/core/IO.html) docs.
303
314
 
304
315
  ```
305
316
  #read(bytes_to_read = nil, out_buffer = nil)
@@ -309,14 +320,14 @@ See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
309
320
  #closed?
310
321
  ```
311
322
 
312
- See [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
323
+ See [`Zlib::GzipReader`](https://ruby-doc.org/stdlib/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
313
324
 
314
325
  ```
315
326
  #readpartial(bytes_to_read = nil, out_buffer = nil)
316
327
  #read_nonblock(bytes_to_read, out_buffer = nil, *options)
317
328
  ```
318
329
 
319
- See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
330
+ See [`IO`](https://ruby-doc.org/core/IO.html) docs.
320
331
 
321
332
  ```
322
333
  #getbyte
@@ -339,16 +350,26 @@ See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
339
350
  #ungetline(line)
340
351
  ```
341
352
 
342
- Typical helpers, see [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
353
+ Typical helpers, see [`Zlib::GzipReader`](https://ruby-doc.org/stdlib/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
354
+
355
+ ## Thread safety
356
+
357
+ `:gvl` option is disabled by default, you can use bindings effectively in multiple threads.
358
+ Please be careful: bindings are not thread safe.
359
+ You should lock all shared data between threads.
360
+
361
+ For example: you should not use same compressor/decompressor inside multiple threads.
362
+ Please verify that you are using each processor inside single thread at the same time.
363
+
364
+ ## Operating systems
365
+
366
+ GNU/Linux, FreeBSD, OSX, Windows (MinGW).
343
367
 
344
368
  ## CI
345
369
 
346
- See universal test script [scripts/ci_test.sh](scripts/ci_test.sh) for CI.
347
370
  Please visit [scripts/test-images](scripts/test-images).
348
- You can run this test script using many native and cross images.
349
-
350
- Cirrus CI uses `x86_64-pc-linux-gnu` image, Circle CI - `x86_64-gentoo-linux-musl` image.
371
+ See universal test script [scripts/ci_test.sh](scripts/ci_test.sh) for CI.
351
372
 
352
373
  ## License
353
374
 
354
- MIT license, see LICENSE and AUTHORS.
375
+ MIT license, see [LICENSE](LICENSE) and [AUTHORS](AUTHORS).
data/ext/brs_ext/buffer.c CHANGED
@@ -10,10 +10,11 @@ VALUE brs_ext_create_string_buffer(VALUE length)
10
10
  return rb_str_new(NULL, NUM2SIZET(length));
11
11
  }
12
12
 
13
- VALUE brs_ext_resize_string_buffer(VALUE args)
13
+ VALUE brs_ext_resize_string_buffer(VALUE buffer_args)
14
14
  {
15
- VALUE buffer = rb_ary_entry(args, 0);
16
- VALUE length = rb_ary_entry(args, 1);
15
+ VALUE buffer = rb_ary_entry(buffer_args, 0);
16
+ VALUE length = rb_ary_entry(buffer_args, 1);
17
+
17
18
  return rb_str_resize(buffer, NUM2SIZET(length));
18
19
  }
19
20
 
@@ -21,8 +22,21 @@ void brs_ext_buffer_exports(VALUE root_module)
21
22
  {
22
23
  VALUE module = rb_define_module_under(root_module, "Buffer");
23
24
 
24
- rb_define_const(module, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR", SIZET2NUM(BRS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR));
25
- rb_define_const(module, "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR", SIZET2NUM(BRS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR));
26
- rb_define_const(module, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR", SIZET2NUM(BRS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR));
27
- rb_define_const(module, "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR", SIZET2NUM(BRS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR));
25
+ rb_define_const(
26
+ module, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR", SIZET2NUM(BRS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR));
27
+
28
+ rb_define_const(
29
+ module,
30
+ "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR",
31
+ SIZET2NUM(BRS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR));
32
+
33
+ rb_define_const(
34
+ module,
35
+ "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR",
36
+ SIZET2NUM(BRS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR));
37
+
38
+ rb_define_const(
39
+ module,
40
+ "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR",
41
+ SIZET2NUM(BRS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR));
28
42
  }
data/ext/brs_ext/buffer.h CHANGED
@@ -6,10 +6,10 @@
6
6
 
7
7
  #include "ruby.h"
8
8
 
9
- #define BRS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR (1 << 18) // 256 KB
9
+ #define BRS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR (1 << 18) // 256 KB
10
10
  #define BRS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR (1 << 16) // 64 KB
11
11
 
12
- #define BRS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR (1 << 16) // 64 KB
12
+ #define BRS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR (1 << 16) // 64 KB
13
13
  #define BRS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR (1 << 18) // 256 KB
14
14
 
15
15
  VALUE brs_ext_create_string_buffer(VALUE length);
@@ -17,12 +17,12 @@ VALUE brs_ext_create_string_buffer(VALUE length);
17
17
  #define BRS_EXT_CREATE_STRING_BUFFER(buffer, length, exception) \
18
18
  VALUE buffer = rb_protect(brs_ext_create_string_buffer, SIZET2NUM(length), &exception);
19
19
 
20
- VALUE brs_ext_resize_string_buffer(VALUE args);
20
+ VALUE brs_ext_resize_string_buffer(VALUE buffer_args);
21
21
 
22
- #define BRS_EXT_RESIZE_STRING_BUFFER(buffer, length, exception) \
23
- VALUE args = rb_ary_new_from_args(2, buffer, SIZET2NUM(length)); \
24
- buffer = rb_protect(brs_ext_resize_string_buffer, args, &exception); \
25
- RB_GC_GUARD(args);
22
+ #define BRS_EXT_RESIZE_STRING_BUFFER(buffer, length, exception) \
23
+ VALUE buffer_args = rb_ary_new_from_args(2, buffer, SIZET2NUM(length)); \
24
+ buffer = rb_protect(brs_ext_resize_string_buffer, buffer_args, &exception); \
25
+ RB_GC_GUARD(buffer_args);
26
26
 
27
27
  void brs_ext_buffer_exports(VALUE root_module);
28
28
 
data/ext/brs_ext/error.c CHANGED
@@ -39,7 +39,7 @@ brs_ext_result_t brs_ext_get_decompressor_error(BrotliDecoderErrorCode error_cod
39
39
  }
40
40
  }
41
41
 
42
- static inline NORETURN(void raise(const char* name, const char* description))
42
+ static inline NORETURN(void raise_error(const char* name, const char* description))
43
43
  {
44
44
  VALUE module = rb_define_module(BRS_EXT_MODULE_NAME);
45
45
  VALUE error = rb_const_get(module, rb_intern(name));
@@ -50,28 +50,28 @@ void brs_ext_raise_error(brs_ext_result_t ext_result)
50
50
  {
51
51
  switch (ext_result) {
52
52
  case BRS_EXT_ERROR_ALLOCATE_FAILED:
53
- raise("AllocateError", "allocate error");
53
+ raise_error("AllocateError", "allocate error");
54
54
  case BRS_EXT_ERROR_VALIDATE_FAILED:
55
- raise("ValidateError", "validate error");
55
+ raise_error("ValidateError", "validate error");
56
56
 
57
57
  case BRS_EXT_ERROR_USED_AFTER_CLOSE:
58
- raise("UsedAfterCloseError", "used after closed");
58
+ raise_error("UsedAfterCloseError", "used after closed");
59
59
  case BRS_EXT_ERROR_NOT_ENOUGH_SOURCE_BUFFER:
60
- raise("NotEnoughSourceBufferError", "not enough source buffer");
60
+ raise_error("NotEnoughSourceBufferError", "not enough source buffer");
61
61
  case BRS_EXT_ERROR_NOT_ENOUGH_DESTINATION_BUFFER:
62
- raise("NotEnoughDestinationBufferError", "not enough destination buffer");
62
+ raise_error("NotEnoughDestinationBufferError", "not enough destination buffer");
63
63
  case BRS_EXT_ERROR_DECOMPRESSOR_CORRUPTED_SOURCE:
64
- raise("DecompressorCorruptedSourceError", "decompressor received corrupted source");
64
+ raise_error("DecompressorCorruptedSourceError", "decompressor received corrupted source");
65
65
 
66
66
  case BRS_EXT_ERROR_ACCESS_IO:
67
- raise("AccessIOError", "failed to access IO");
67
+ raise_error("AccessIOError", "failed to access IO");
68
68
  case BRS_EXT_ERROR_READ_IO:
69
- raise("ReadIOError", "failed to read IO");
69
+ raise_error("ReadIOError", "failed to read IO");
70
70
  case BRS_EXT_ERROR_WRITE_IO:
71
- raise("WriteIOError", "failed to write IO");
71
+ raise_error("WriteIOError", "failed to write IO");
72
72
 
73
73
  default:
74
74
  // BRS_EXT_ERROR_UNEXPECTED
75
- raise("UnexpectedError", "unexpected error");
75
+ raise_error("UnexpectedError", "unexpected error");
76
76
  }
77
77
  }
data/ext/brs_ext/error.h CHANGED
@@ -11,7 +11,8 @@
11
11
 
12
12
  // Results for errors listed in "lib/brs/error" used in c extension.
13
13
 
14
- enum {
14
+ enum
15
+ {
15
16
  BRS_EXT_ERROR_ALLOCATE_FAILED = 1,
16
17
  BRS_EXT_ERROR_VALIDATE_FAILED,
17
18