brotli 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +1 -0
  3. data/Rakefile +6 -1
  4. data/brotli.gemspec +1 -1
  5. data/docs/Brotli.html +485 -0
  6. data/docs/Brotli/Error.html +124 -0
  7. data/docs/_index.html +122 -0
  8. data/docs/class_list.html +51 -0
  9. data/docs/css/common.css +1 -0
  10. data/docs/css/full_list.css +58 -0
  11. data/docs/css/style.css +496 -0
  12. data/docs/file.README.html +127 -0
  13. data/docs/file_list.html +56 -0
  14. data/docs/frames.html +17 -0
  15. data/docs/index.html +127 -0
  16. data/docs/js/app.js +292 -0
  17. data/docs/js/full_list.js +216 -0
  18. data/docs/js/jquery.js +4 -0
  19. data/docs/method_list.html +67 -0
  20. data/docs/top-level-namespace.html +110 -0
  21. data/ext/brotli/brotli.c +20 -0
  22. data/lib/brotli/version.rb +1 -1
  23. data/vendor/brotli/c/common/constants.h +13 -6
  24. data/vendor/brotli/c/{dec → common}/context.h +182 -172
  25. data/vendor/brotli/c/common/dictionary.bin +0 -0
  26. data/vendor/brotli/c/common/dictionary.bin.br +0 -0
  27. data/vendor/brotli/c/common/dictionary.c +1 -1
  28. data/vendor/brotli/c/common/dictionary.h +4 -4
  29. data/vendor/brotli/c/common/platform.h +509 -0
  30. data/vendor/brotli/c/common/transform.c +235 -0
  31. data/vendor/brotli/c/common/transform.h +80 -0
  32. data/vendor/brotli/c/common/version.h +8 -1
  33. data/vendor/brotli/c/dec/bit_reader.c +1 -1
  34. data/vendor/brotli/c/dec/bit_reader.h +35 -86
  35. data/vendor/brotli/c/dec/decode.c +322 -205
  36. data/vendor/brotli/c/dec/huffman.c +35 -37
  37. data/vendor/brotli/c/dec/huffman.h +13 -9
  38. data/vendor/brotli/c/dec/prefix.h +3 -4
  39. data/vendor/brotli/c/dec/state.c +26 -34
  40. data/vendor/brotli/c/dec/state.h +34 -23
  41. data/vendor/brotli/c/enc/backward_references.c +25 -15
  42. data/vendor/brotli/c/enc/backward_references.h +5 -6
  43. data/vendor/brotli/c/enc/backward_references_hq.c +94 -68
  44. data/vendor/brotli/c/enc/backward_references_hq.h +22 -25
  45. data/vendor/brotli/c/enc/backward_references_inc.h +10 -10
  46. data/vendor/brotli/c/enc/bit_cost.c +1 -1
  47. data/vendor/brotli/c/enc/bit_cost.h +5 -5
  48. data/vendor/brotli/c/enc/block_encoder_inc.h +7 -6
  49. data/vendor/brotli/c/enc/block_splitter.c +2 -3
  50. data/vendor/brotli/c/enc/block_splitter.h +1 -1
  51. data/vendor/brotli/c/enc/block_splitter_inc.h +11 -11
  52. data/vendor/brotli/c/enc/brotli_bit_stream.c +102 -101
  53. data/vendor/brotli/c/enc/brotli_bit_stream.h +19 -38
  54. data/vendor/brotli/c/enc/cluster.c +1 -1
  55. data/vendor/brotli/c/enc/cluster.h +1 -1
  56. data/vendor/brotli/c/enc/command.h +40 -30
  57. data/vendor/brotli/c/enc/compress_fragment.c +21 -22
  58. data/vendor/brotli/c/enc/compress_fragment.h +1 -1
  59. data/vendor/brotli/c/enc/compress_fragment_two_pass.c +101 -68
  60. data/vendor/brotli/c/enc/compress_fragment_two_pass.h +1 -1
  61. data/vendor/brotli/c/enc/dictionary_hash.c +1 -1
  62. data/vendor/brotli/c/enc/encode.c +262 -162
  63. data/vendor/brotli/c/enc/encoder_dict.c +32 -0
  64. data/vendor/brotli/c/enc/encoder_dict.h +41 -0
  65. data/vendor/brotli/c/enc/entropy_encode.c +14 -14
  66. data/vendor/brotli/c/enc/entropy_encode.h +5 -5
  67. data/vendor/brotli/c/enc/entropy_encode_static.h +3 -3
  68. data/vendor/brotli/c/enc/fast_log.h +4 -2
  69. data/vendor/brotli/c/enc/find_match_length.h +3 -3
  70. data/vendor/brotli/c/enc/hash.h +75 -24
  71. data/vendor/brotli/c/enc/hash_composite_inc.h +133 -0
  72. data/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +9 -8
  73. data/vendor/brotli/c/enc/hash_longest_match64_inc.h +8 -8
  74. data/vendor/brotli/c/enc/hash_longest_match_inc.h +8 -8
  75. data/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +10 -9
  76. data/vendor/brotli/c/enc/hash_rolling_inc.h +215 -0
  77. data/vendor/brotli/c/enc/hash_to_binary_tree_inc.h +9 -8
  78. data/vendor/brotli/c/enc/histogram.c +9 -6
  79. data/vendor/brotli/c/enc/histogram.h +6 -3
  80. data/vendor/brotli/c/enc/histogram_inc.h +1 -1
  81. data/vendor/brotli/c/enc/literal_cost.c +5 -5
  82. data/vendor/brotli/c/enc/literal_cost.h +2 -2
  83. data/vendor/brotli/c/enc/memory.c +5 -16
  84. data/vendor/brotli/c/enc/memory.h +40 -1
  85. data/vendor/brotli/c/enc/metablock.c +163 -25
  86. data/vendor/brotli/c/enc/metablock.h +13 -8
  87. data/vendor/brotli/c/enc/metablock_inc.h +1 -1
  88. data/vendor/brotli/c/enc/params.h +44 -0
  89. data/vendor/brotli/c/enc/prefix.h +3 -4
  90. data/vendor/brotli/c/enc/quality.h +29 -24
  91. data/vendor/brotli/c/enc/ringbuffer.h +15 -11
  92. data/vendor/brotli/c/enc/static_dict.c +49 -45
  93. data/vendor/brotli/c/enc/static_dict.h +4 -3
  94. data/vendor/brotli/c/enc/static_dict_lut.h +1 -1
  95. data/vendor/brotli/c/enc/utf8_util.c +20 -20
  96. data/vendor/brotli/c/enc/utf8_util.h +1 -1
  97. data/vendor/brotli/c/enc/write_bits.h +16 -21
  98. data/vendor/brotli/c/include/brotli/decode.h +13 -8
  99. data/vendor/brotli/c/include/brotli/encode.h +33 -8
  100. data/vendor/brotli/c/include/brotli/port.h +211 -83
  101. data/vendor/brotli/c/include/brotli/types.h +0 -7
  102. metadata +33 -12
  103. data/vendor/brotli/c/dec/port.h +0 -168
  104. data/vendor/brotli/c/dec/transform.h +0 -300
  105. data/vendor/brotli/c/enc/context.h +0 -184
  106. data/vendor/brotli/c/enc/port.h +0 -184
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 28b044ea8f0192f41b544f72eea2855d490f2722
4
- data.tar.gz: 6face28127a2acde37dd8a72a203d277f72f78a9
2
+ SHA256:
3
+ metadata.gz: 654b30a28d785e3484c1305d26f50115c8310f1098826444c54b697fa059882f
4
+ data.tar.gz: 66db5adaf23432e61b3b8ca73d1f9c9fea8a0402e96ed550b3ba74b2b3a9e2f7
5
5
  SHA512:
6
- metadata.gz: 12b573800edcd717571dff187a05cb9b71d8e6d33c64a8c9c358b3b6e332152b80035c66e050ae83846d02378abf63a3df778afd3af04ca17dc6ea3cd124f80f
7
- data.tar.gz: 1932d518c3345ab655a52bc75a0066304eb88ad1207d830a94ad6d97148cedb4094859691730329e34ad442bb4c089c1c1a51d430eb2c12ad20177633b5360ad
6
+ metadata.gz: eb94be99c4623a954eee6d8d32e59870980b412a8691fee3a2f86ba9de655e28d88df7957a89af4a4d20504eb586e6ba1f1a05b9d9f617f94dfe00344324d4e8
7
+ data.tar.gz: d056d603ce93f6580fe7fcf7b111a30ffce2e45d215a1f0bc189599665dd0361dbdc7d3d44dd0642bc2e61174672e11bd65666f2f2083d612223c0aa19128220
data/Gemfile CHANGED
@@ -4,3 +4,4 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'travis'
7
+ gem 'yard'
data/Rakefile CHANGED
@@ -1,13 +1,18 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require "rake/extensiontask"
4
+ require "yard"
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
8
  task :default => [:compile, :spec]
7
- require "rake/extensiontask"
8
9
 
9
10
  task :build => :compile
10
11
 
11
12
  Rake::ExtensionTask.new("brotli") do |ext|
12
13
  ext.lib_dir = "lib/brotli"
13
14
  end
15
+
16
+ YARD::Rake::YardocTask.new do |t|
17
+ t.options = ["--no-progress", "--output-dir", "docs"]
18
+ end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.extensions = ["ext/brotli/extconf.rb"]
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 1.10"
29
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rake"
30
30
  spec.add_development_dependency "rake-compiler"
31
31
  spec.add_development_dependency "rspec"
32
32
  spec.add_development_dependency "rantly"
@@ -0,0 +1,485 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Brotli
8
+
9
+ &mdash; Documentation by YARD 0.9.16
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Brotli";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (B)</a> &raquo;
40
+
41
+
42
+ <span class="title">Brotli</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Brotli
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/brotli/version.rb<span class="defines">,<br />
82
+ ext/brotli/brotli.c</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Defined Under Namespace</h2>
89
+ <p class="children">
90
+
91
+
92
+
93
+
94
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Brotli/Error.html" title="Brotli::Error (class)">Error</a></span>
95
+
96
+
97
+ </p>
98
+
99
+
100
+ <h2>
101
+ Constant Summary
102
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
103
+ </h2>
104
+
105
+ <dl class="constants">
106
+
107
+ <dt id="VERSION-constant" class="">VERSION =
108
+
109
+ </dt>
110
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.2.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
111
+
112
+ </dl>
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+ <h2>
123
+ Class Method Summary
124
+ <small><a href="#" class="summary_toggle">collapse</a></small>
125
+ </h2>
126
+
127
+ <ul class="summary">
128
+
129
+ <li class="public ">
130
+ <span class="summary_signature">
131
+
132
+ <a href="#deflate-class_method" title="deflate (class method)">.<strong>deflate</strong>(str, opts = nil) &#x21d2; String </a>
133
+
134
+
135
+
136
+ </span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'>
147
+ <p>Deflated string.</p>
148
+ </div></span>
149
+
150
+ </li>
151
+
152
+
153
+ <li class="public ">
154
+ <span class="summary_signature">
155
+
156
+ <a href="#inflate-class_method" title="inflate (class method)">.<strong>inflate</strong>(str) &#x21d2; Object </a>
157
+
158
+
159
+
160
+ </span>
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ <span class="summary_desc"><div class='inline'></div></span>
171
+
172
+ </li>
173
+
174
+
175
+ </ul>
176
+
177
+
178
+
179
+
180
+ <div id="class_method_details" class="method_details_list">
181
+ <h2>Class Method Details</h2>
182
+
183
+
184
+ <div class="method_details first">
185
+ <h3 class="signature first" id="deflate-class_method">
186
+
187
+ .<strong>deflate</strong>(str, opts = nil) &#x21d2; <tt>String</tt>
188
+
189
+
190
+
191
+
192
+
193
+ </h3><div class="docstring">
194
+ <div class="discussion">
195
+
196
+ <p>Returns Deflated string</p>
197
+
198
+
199
+ </div>
200
+ </div>
201
+ <div class="tags">
202
+
203
+ <div class="docstring">
204
+ <div class="discussion">
205
+
206
+
207
+ </div>
208
+ </div>
209
+ <div class="tags">
210
+
211
+ <p class="tag_title">Returns:</p>
212
+ <ul class="return">
213
+
214
+ <li>
215
+
216
+
217
+ <span class='type'>(<tt>String</tt>)</span>
218
+
219
+
220
+
221
+ </li>
222
+
223
+ </ul>
224
+
225
+ </div>
226
+ <p class="tag_title">Parameters:</p>
227
+ <ul class="param">
228
+
229
+ <li>
230
+
231
+ <span class='name'>str</span>
232
+
233
+
234
+ <span class='type'>(<tt>String</tt>)</span>
235
+
236
+
237
+
238
+ &mdash;
239
+ <div class='inline'>
240
+ <p>string</p>
241
+ </div>
242
+
243
+ </li>
244
+
245
+ <li>
246
+
247
+ <span class='name'>opts</span>
248
+
249
+
250
+ <span class='type'>(<tt>Hash</tt>)</span>
251
+
252
+
253
+
254
+ &mdash;
255
+ <div class='inline'>
256
+ <p>options</p>
257
+ </div>
258
+
259
+ </li>
260
+
261
+ </ul>
262
+
263
+
264
+
265
+
266
+
267
+ <p class="tag_title">Returns:</p>
268
+ <ul class="return">
269
+
270
+ <li>
271
+
272
+
273
+ <span class='type'>(<tt>String</tt>)</span>
274
+
275
+
276
+
277
+ &mdash;
278
+ <div class='inline'>
279
+ <p>Deflated string</p>
280
+ </div>
281
+
282
+ </li>
283
+
284
+ </ul>
285
+
286
+ </div><table class="source_code">
287
+ <tr>
288
+ <td>
289
+ <pre class="lines">
290
+
291
+
292
+ 264
293
+ 265
294
+ 266
295
+ 267
296
+ 268
297
+ 269
298
+ 270
299
+ 271
300
+ 272
301
+ 273
302
+ 274
303
+ 275
304
+ 276
305
+ 277
306
+ 278
307
+ 279
308
+ 280
309
+ 281
310
+ 282
311
+ 283
312
+ 284
313
+ 285
314
+ 286
315
+ 287
316
+ 288
317
+ 289
318
+ 290
319
+ 291
320
+ 292
321
+ 293
322
+ 294</pre>
323
+ </td>
324
+ <td>
325
+ <pre class="code"><span class="info file"># File 'ext/brotli/brotli.c', line 264</span>
326
+
327
+ static VALUE
328
+ brotli_deflate(int argc, VALUE *argv, VALUE self)
329
+ {
330
+ VALUE str = Qnil, opts = Qnil, value = Qnil;
331
+ brotli_deflate_args_t args;
332
+
333
+ rb_scan_args(argc, argv, &quot;11&quot;, &amp;str, &amp;opts);
334
+ StringValue(str);
335
+
336
+ args.str = (uint8_t*)RSTRING_PTR(str);
337
+ args.len = (size_t)RSTRING_LEN(str);
338
+ args.s = brotli_deflate_parse_options(
339
+ BrotliEncoderCreateInstance(brotli_alloc, brotli_free, NULL),
340
+ opts);
341
+ args.buffer = create_buffer(BUFSIZ);
342
+ args.finished = BROTLI_FALSE;
343
+
344
+ #ifdef HAVE_RUBY_THREAD_H
345
+ rb_thread_call_without_gvl(brotli_deflate_no_gvl, (void *)&amp;args, NULL, NULL);
346
+ #else
347
+ brotli_deflate_no_gvl((void *)&amp;args);
348
+ #endif
349
+ if (args.finished == BROTLI_TRUE) {
350
+ value = rb_str_new(args.buffer-&gt;ptr, args.buffer-&gt;used);
351
+ }
352
+
353
+ delete_buffer(args.buffer);
354
+ BrotliEncoderDestroyInstance(args.s);
355
+
356
+ return value;
357
+ }</pre>
358
+ </td>
359
+ </tr>
360
+ </table>
361
+ </div>
362
+
363
+ <div class="method_details ">
364
+ <h3 class="signature " id="inflate-class_method">
365
+
366
+ .<strong>inflate</strong>(str) &#x21d2; <tt>Object</tt>
367
+
368
+
369
+
370
+
371
+
372
+ </h3><table class="source_code">
373
+ <tr>
374
+ <td>
375
+ <pre class="lines">
376
+
377
+
378
+ 72
379
+ 73
380
+ 74
381
+ 75
382
+ 76
383
+ 77
384
+ 78
385
+ 79
386
+ 80
387
+ 81
388
+ 82
389
+ 83
390
+ 84
391
+ 85
392
+ 86
393
+ 87
394
+ 88
395
+ 89
396
+ 90
397
+ 91
398
+ 92
399
+ 93
400
+ 94
401
+ 95
402
+ 96
403
+ 97
404
+ 98
405
+ 99
406
+ 100
407
+ 101
408
+ 102
409
+ 103
410
+ 104
411
+ 105
412
+ 106
413
+ 107
414
+ 108
415
+ 109
416
+ 110
417
+ 111
418
+ 112
419
+ 113
420
+ 114</pre>
421
+ </td>
422
+ <td>
423
+ <pre class="code"><span class="info file"># File 'ext/brotli/brotli.c', line 72</span>
424
+
425
+ static VALUE
426
+ brotli_inflate(VALUE self, VALUE str)
427
+ {
428
+ VALUE value = Qnil;
429
+ brotli_inflate_args_t args;
430
+
431
+ StringValue(str);
432
+
433
+ args.str = (uint8_t*)RSTRING_PTR(str);
434
+ args.len = (size_t)RSTRING_LEN(str);
435
+ args.buffer = create_buffer(BUFSIZ);
436
+ args.s = BrotliDecoderCreateInstance(brotli_alloc,
437
+ brotli_free,
438
+ NULL);
439
+ args.r = BROTLI_DECODER_RESULT_ERROR;
440
+
441
+ #ifdef HAVE_RUBY_THREAD_H
442
+ rb_thread_call_without_gvl(brotli_inflate_no_gvl, (void *)&amp;args, NULL, NULL);
443
+ #else
444
+ brotli_inflate_no_gvl((void *)&amp;args);
445
+ #endif
446
+ if (args.r == BROTLI_DECODER_RESULT_SUCCESS) {
447
+ value = rb_str_new(args.buffer-&gt;ptr, args.buffer-&gt;used);
448
+ delete_buffer(args.buffer);
449
+ BrotliDecoderDestroyInstance(args.s);
450
+ } else if (args.r == BROTLI_DECODER_RESULT_ERROR) {
451
+ const char * error = BrotliDecoderErrorString(BrotliDecoderGetErrorCode(args.s));
452
+ delete_buffer(args.buffer);
453
+ BrotliDecoderDestroyInstance(args.s);
454
+ rb_raise(rb_eBrotli, &quot;%s&quot;, error);
455
+ } else if (args.r == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
456
+ delete_buffer(args.buffer);
457
+ BrotliDecoderDestroyInstance(args.s);
458
+ rb_raise(rb_eBrotli, &quot;Needs more input&quot;);
459
+ } else if (args.r == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
460
+ /* never reach to this block */
461
+ delete_buffer(args.buffer);
462
+ BrotliDecoderDestroyInstance(args.s);
463
+ rb_raise(rb_eBrotli, &quot;Needs more output&quot;);
464
+ }
465
+
466
+ return value;
467
+ }</pre>
468
+ </td>
469
+ </tr>
470
+ </table>
471
+ </div>
472
+
473
+ </div>
474
+
475
+ </div>
476
+
477
+ <div id="footer">
478
+ Generated on Fri Aug 17 23:21:32 2018 by
479
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
480
+ 0.9.16 (ruby-2.5.1).
481
+ </div>
482
+
483
+ </div>
484
+ </body>
485
+ </html>