brotli 0.2.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +34 -0
  3. data/.github/workflows/publish.yml +34 -0
  4. data/Gemfile +6 -3
  5. data/Rakefile +16 -9
  6. data/brotli.gemspec +7 -13
  7. data/ext/brotli/brotli.c +209 -31
  8. data/ext/brotli/buffer.c +1 -7
  9. data/ext/brotli/buffer.h +1 -1
  10. data/ext/brotli/extconf.rb +20 -18
  11. data/lib/brotli/version.rb +1 -1
  12. data/test/brotli_test.rb +104 -0
  13. data/test/brotli_writer_test.rb +36 -0
  14. data/test/test_helper.rb +8 -0
  15. data/vendor/brotli/c/common/constants.c +15 -0
  16. data/vendor/brotli/c/common/constants.h +136 -0
  17. data/vendor/brotli/c/common/context.c +156 -0
  18. data/vendor/brotli/c/common/context.h +4 -152
  19. data/vendor/brotli/c/common/dictionary.bin.br +0 -0
  20. data/vendor/brotli/c/common/dictionary.c +10 -1
  21. data/vendor/brotli/c/common/platform.c +22 -0
  22. data/vendor/brotli/c/common/platform.h +43 -17
  23. data/vendor/brotli/c/common/transform.c +59 -3
  24. data/vendor/brotli/c/common/transform.h +5 -0
  25. data/vendor/brotli/c/common/version.h +2 -2
  26. data/vendor/brotli/c/dec/bit_reader.c +28 -0
  27. data/vendor/brotli/c/dec/bit_reader.h +58 -16
  28. data/vendor/brotli/c/dec/decode.c +353 -251
  29. data/vendor/brotli/c/dec/huffman.h +6 -12
  30. data/vendor/brotli/c/dec/prefix.h +0 -18
  31. data/vendor/brotli/c/dec/state.c +9 -14
  32. data/vendor/brotli/c/dec/state.h +144 -37
  33. data/vendor/brotli/c/enc/backward_references.c +8 -7
  34. data/vendor/brotli/c/enc/backward_references.h +5 -4
  35. data/vendor/brotli/c/enc/backward_references_hq.c +51 -33
  36. data/vendor/brotli/c/enc/backward_references_hq.h +11 -8
  37. data/vendor/brotli/c/enc/backward_references_inc.h +24 -14
  38. data/vendor/brotli/c/enc/block_splitter.c +3 -3
  39. data/vendor/brotli/c/enc/block_splitter_inc.h +15 -6
  40. data/vendor/brotli/c/enc/brotli_bit_stream.c +13 -30
  41. data/vendor/brotli/c/enc/cluster_inc.h +6 -3
  42. data/vendor/brotli/c/enc/command.c +28 -0
  43. data/vendor/brotli/c/enc/command.h +12 -12
  44. data/vendor/brotli/c/enc/compress_fragment_two_pass.c +1 -1
  45. data/vendor/brotli/c/enc/dictionary_hash.c +1826 -1100
  46. data/vendor/brotli/c/enc/dictionary_hash.h +2 -1
  47. data/vendor/brotli/c/enc/encode.c +104 -39
  48. data/vendor/brotli/c/enc/encoder_dict.c +3 -2
  49. data/vendor/brotli/c/enc/encoder_dict.h +3 -1
  50. data/vendor/brotli/c/enc/entropy_encode.c +2 -0
  51. data/vendor/brotli/c/enc/entropy_encode.h +2 -2
  52. data/vendor/brotli/c/enc/fast_log.c +105 -0
  53. data/vendor/brotli/c/enc/fast_log.h +19 -100
  54. data/vendor/brotli/c/enc/find_match_length.h +2 -3
  55. data/vendor/brotli/c/enc/hash.h +80 -90
  56. data/vendor/brotli/c/enc/hash_composite_inc.h +52 -63
  57. data/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +88 -49
  58. data/vendor/brotli/c/enc/hash_longest_match64_inc.h +50 -50
  59. data/vendor/brotli/c/enc/hash_longest_match_inc.h +53 -50
  60. data/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +91 -60
  61. data/vendor/brotli/c/enc/hash_rolling_inc.h +23 -27
  62. data/vendor/brotli/c/enc/hash_to_binary_tree_inc.h +39 -38
  63. data/vendor/brotli/c/enc/memory.h +24 -12
  64. data/vendor/brotli/c/enc/metablock.c +23 -27
  65. data/vendor/brotli/c/enc/metablock_inc.h +1 -1
  66. data/vendor/brotli/c/enc/params.h +3 -1
  67. data/vendor/brotli/c/enc/ringbuffer.h +4 -1
  68. data/vendor/brotli/c/enc/utf8_util.c +1 -1
  69. data/vendor/brotli/c/enc/write_bits.h +27 -25
  70. data/vendor/brotli/c/include/brotli/encode.h +22 -1
  71. data/vendor/brotli/c/include/brotli/port.h +14 -0
  72. metadata +17 -97
  73. data/.travis.yml +0 -31
  74. data/docs/Brotli.html +0 -485
  75. data/docs/Brotli/Error.html +0 -124
  76. data/docs/_index.html +0 -122
  77. data/docs/class_list.html +0 -51
  78. data/docs/css/common.css +0 -1
  79. data/docs/css/full_list.css +0 -58
  80. data/docs/css/style.css +0 -496
  81. data/docs/file.README.html +0 -127
  82. data/docs/file_list.html +0 -56
  83. data/docs/frames.html +0 -17
  84. data/docs/index.html +0 -127
  85. data/docs/js/app.js +0 -292
  86. data/docs/js/full_list.js +0 -216
  87. data/docs/js/jquery.js +0 -4
  88. data/docs/method_list.html +0 -67
  89. data/docs/top-level-namespace.html +0 -110
  90. data/spec/brotli_spec.rb +0 -88
  91. data/spec/inflate_spec.rb +0 -75
  92. data/spec/spec_helper.rb +0 -4
@@ -71,7 +71,7 @@ static void FN(InitBlockSplitter)(
71
71
  *histograms_size = max_num_types;
72
72
  *histograms = BROTLI_ALLOC(m, HistogramType, *histograms_size);
73
73
  self->histograms_ = *histograms;
74
- if (BROTLI_IS_OOM(m)) return;
74
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(*histograms)) return;
75
75
  /* Clear only current histogram. */
76
76
  FN(HistogramClear)(&self->histograms_[0]);
77
77
  self->last_histogram_ix_[0] = self->last_histogram_ix_[1] = 0;
@@ -23,7 +23,8 @@ typedef struct BrotliHasherParams {
23
23
  typedef struct BrotliDistanceParams {
24
24
  uint32_t distance_postfix_bits;
25
25
  uint32_t num_direct_distance_codes;
26
- uint32_t alphabet_size;
26
+ uint32_t alphabet_size_max;
27
+ uint32_t alphabet_size_limit;
27
28
  size_t max_distance;
28
29
  } BrotliDistanceParams;
29
30
 
@@ -33,6 +34,7 @@ typedef struct BrotliEncoderParams {
33
34
  int quality;
34
35
  int lgwin;
35
36
  int lgblock;
37
+ size_t stream_offset;
36
38
  size_t size_hint;
37
39
  BROTLI_BOOL disable_literal_context_modeling;
38
40
  BROTLI_BOOL large_window;
@@ -75,7 +75,7 @@ static BROTLI_INLINE void RingBufferInitBuffer(
75
75
  uint8_t* new_data = BROTLI_ALLOC(
76
76
  m, uint8_t, 2 + buflen + kSlackForEightByteHashingEverywhere);
77
77
  size_t i;
78
- if (BROTLI_IS_OOM(m)) return;
78
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(new_data)) return;
79
79
  if (rb->data_) {
80
80
  memcpy(new_data, rb->data_,
81
81
  2 + rb->cur_size_ + kSlackForEightByteHashingEverywhere);
@@ -125,6 +125,9 @@ static BROTLI_INLINE void RingBufferWrite(
125
125
  later when we copy the last two bytes to the first two positions. */
126
126
  rb->buffer_[rb->size_ - 2] = 0;
127
127
  rb->buffer_[rb->size_ - 1] = 0;
128
+ /* Initialize tail; might be touched by "best_len++" optimization when
129
+ ring buffer is "full". */
130
+ rb->buffer_[rb->size_] = 241;
128
131
  }
129
132
  {
130
133
  const size_t masked_pos = rb->pos_ & rb->mask_;
@@ -77,7 +77,7 @@ BROTLI_BOOL BrotliIsMostlyUTF8(
77
77
  i += bytes_read;
78
78
  if (symbol < 0x110000) size_utf8 += bytes_read;
79
79
  }
80
- return TO_BROTLI_BOOL(size_utf8 > min_fraction * (double)length);
80
+ return TO_BROTLI_BOOL((double)size_utf8 > min_fraction * (double)length);
81
81
  }
82
82
 
83
83
  #if defined(__cplusplus) || defined(c_plusplus)
@@ -16,8 +16,6 @@
16
16
  extern "C" {
17
17
  #endif
18
18
 
19
- /*#define BIT_WRITER_DEBUG */
20
-
21
19
  /* This function writes bits into bytes in increasing addresses, and within
22
20
  a byte least-significant-bit first.
23
21
 
@@ -28,7 +26,7 @@ extern "C" {
28
26
 
29
27
  0000 0RRR 0000 0000 0000 0000
30
28
 
31
- Now, we could write 5 or less bits in MSB by just sifting by 3
29
+ Now, we could write 5 or less bits in MSB by just shifting by 3
32
30
  and OR'ing to BYTE-0.
33
31
 
34
32
  For n bits, we take the last 5 bits, OR that with high bits in BYTE-0,
@@ -37,37 +35,41 @@ static BROTLI_INLINE void BrotliWriteBits(size_t n_bits,
37
35
  uint64_t bits,
38
36
  size_t* BROTLI_RESTRICT pos,
39
37
  uint8_t* BROTLI_RESTRICT array) {
38
+ BROTLI_LOG(("WriteBits %2d 0x%08x%08x %10d\n", (int)n_bits,
39
+ (uint32_t)(bits >> 32), (uint32_t)(bits & 0xFFFFFFFF),
40
+ (int)*pos));
41
+ BROTLI_DCHECK((bits >> n_bits) == 0);
42
+ BROTLI_DCHECK(n_bits <= 56);
40
43
  #if defined(BROTLI_LITTLE_ENDIAN)
41
44
  /* This branch of the code can write up to 56 bits at a time,
42
45
  7 bits are lost by being perhaps already in *p and at least
43
46
  1 bit is needed to initialize the bit-stream ahead (i.e. if 7
44
47
  bits are in *p and we write 57 bits, then the next write will
45
48
  access a byte that was never initialized). */
46
- uint8_t* p = &array[*pos >> 3];
47
- uint64_t v = (uint64_t)(*p); /* Zero-extend 8 to 64 bits. */
48
- BROTLI_LOG(("WriteBits %2d 0x%08x%08x %10d\n", (int)n_bits,
49
- (uint32_t)(bits >> 32), (uint32_t)(bits & 0xFFFFFFFF),
50
- (int)*pos));
51
- BROTLI_DCHECK((bits >> n_bits) == 0);
52
- BROTLI_DCHECK(n_bits <= 56);
53
- v |= bits << (*pos & 7);
54
- BROTLI_UNALIGNED_STORE64LE(p, v); /* Set some bits. */
55
- *pos += n_bits;
49
+ {
50
+ uint8_t* p = &array[*pos >> 3];
51
+ uint64_t v = (uint64_t)(*p); /* Zero-extend 8 to 64 bits. */
52
+ v |= bits << (*pos & 7);
53
+ BROTLI_UNALIGNED_STORE64LE(p, v); /* Set some bits. */
54
+ *pos += n_bits;
55
+ }
56
56
  #else
57
57
  /* implicit & 0xFF is assumed for uint8_t arithmetics */
58
- uint8_t* array_pos = &array[*pos >> 3];
59
- const size_t bits_reserved_in_first_byte = (*pos & 7);
60
- size_t bits_left_to_write;
61
- bits <<= bits_reserved_in_first_byte;
62
- *array_pos++ |= (uint8_t)bits;
63
- for (bits_left_to_write = n_bits + bits_reserved_in_first_byte;
64
- bits_left_to_write >= 9;
65
- bits_left_to_write -= 8) {
66
- bits >>= 8;
67
- *array_pos++ = (uint8_t)bits;
58
+ {
59
+ uint8_t* array_pos = &array[*pos >> 3];
60
+ const size_t bits_reserved_in_first_byte = (*pos & 7);
61
+ size_t bits_left_to_write;
62
+ bits <<= bits_reserved_in_first_byte;
63
+ *array_pos++ |= (uint8_t)bits;
64
+ for (bits_left_to_write = n_bits + bits_reserved_in_first_byte;
65
+ bits_left_to_write >= 9;
66
+ bits_left_to_write -= 8) {
67
+ bits >>= 8;
68
+ *array_pos++ = (uint8_t)bits;
69
+ }
70
+ *array_pos = 0;
71
+ *pos += n_bits;
68
72
  }
69
- *array_pos = 0;
70
- *pos += n_bits;
71
73
  #endif
72
74
  }
73
75
 
@@ -201,7 +201,23 @@ typedef enum BrotliEncoderParameter {
201
201
  *
202
202
  * Range is from 0 to (15 << NPOSTFIX) in steps of (1 << NPOSTFIX).
203
203
  */
204
- BROTLI_PARAM_NDIRECT = 8
204
+ BROTLI_PARAM_NDIRECT = 8,
205
+ /**
206
+ * Number of bytes of input stream already processed by a different instance.
207
+ *
208
+ * @note It is important to configure all the encoder instances with same
209
+ * parameters (except this one) in order to allow all the encoded parts
210
+ * obey the same restrictions implied by header.
211
+ *
212
+ * If offset is not 0, then stream header is omitted.
213
+ * In any case output start is byte aligned, so for proper streams stitching
214
+ * "predecessor" stream must be flushed.
215
+ *
216
+ * Range is not artificially limited, but all the values greater or equal to
217
+ * maximal window size have the same effect. Values greater than 2**30 are not
218
+ * allowed.
219
+ */
220
+ BROTLI_PARAM_STREAM_OFFSET = 9
205
221
  } BrotliEncoderParameter;
206
222
 
207
223
  /**
@@ -274,6 +290,11 @@ BROTLI_ENC_API size_t BrotliEncoderMaxCompressedSize(size_t input_size);
274
290
  * @note If ::BrotliEncoderMaxCompressedSize(@p input_size) returns non-zero
275
291
  * value, then output is guaranteed to be no longer than that.
276
292
  *
293
+ * @note If @p lgwin is greater than ::BROTLI_MAX_WINDOW_BITS then resulting
294
+ * stream might be incompatible with RFC 7932; to decode such streams,
295
+ * decoder should be configured with
296
+ * ::BROTLI_DECODER_PARAM_LARGE_WINDOW = @c 1
297
+ *
277
298
  * @param quality quality parameter value, e.g. ::BROTLI_DEFAULT_QUALITY
278
299
  * @param lgwin lgwin parameter value, e.g. ::BROTLI_DEFAULT_WINDOW
279
300
  * @param mode mode parameter value, e.g. ::BROTLI_DEFAULT_MODE
@@ -218,6 +218,20 @@
218
218
  BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
219
219
  #endif
220
220
 
221
+ #if defined(__has_feature)
222
+ #define BROTLI_HAS_FEATURE(feature) __has_feature(feature)
223
+ #else
224
+ #define BROTLI_HAS_FEATURE(feature) (0)
225
+ #endif
226
+
227
+ #if defined(ADDRESS_SANITIZER) || BROTLI_HAS_FEATURE(address_sanitizer) || \
228
+ defined(THREAD_SANITIZER) || BROTLI_HAS_FEATURE(thread_sanitizer) || \
229
+ defined(MEMORY_SANITIZER) || BROTLI_HAS_FEATURE(memory_sanitizer)
230
+ #define BROTLI_SANITIZED 1
231
+ #else
232
+ #define BROTLI_SANITIZED 0
233
+ #endif
234
+
221
235
  #if defined(_WIN32) || defined(__CYGWIN__)
222
236
  #define BROTLI_PUBLIC
223
237
  #elif BROTLI_GNUC_VERSION_CHECK(3, 3, 0) || \
metadata CHANGED
@@ -1,85 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brotli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - miyucy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-12 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
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
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: rake-compiler
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: rspec
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
- - !ruby/object:Gem::Dependency
70
- name: rantly
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
11
+ date: 2020-12-27 00:00:00.000000000 Z
12
+ dependencies: []
83
13
  description: Brotli compressor/decompressor
84
14
  email:
85
15
  - fistfvck@gmail.com
@@ -88,10 +18,11 @@ extensions:
88
18
  - ext/brotli/extconf.rb
89
19
  extra_rdoc_files: []
90
20
  files:
21
+ - ".github/workflows/main.yml"
22
+ - ".github/workflows/publish.yml"
91
23
  - ".gitignore"
92
24
  - ".gitmodules"
93
25
  - ".rspec"
94
- - ".travis.yml"
95
26
  - Gemfile
96
27
  - LICENSE.txt
97
28
  - README.md
@@ -100,22 +31,6 @@ files:
100
31
  - bin/console
101
32
  - bin/setup
102
33
  - brotli.gemspec
103
- - docs/Brotli.html
104
- - docs/Brotli/Error.html
105
- - docs/_index.html
106
- - docs/class_list.html
107
- - docs/css/common.css
108
- - docs/css/full_list.css
109
- - docs/css/style.css
110
- - docs/file.README.html
111
- - docs/file_list.html
112
- - docs/frames.html
113
- - docs/index.html
114
- - docs/js/app.js
115
- - docs/js/full_list.js
116
- - docs/js/jquery.js
117
- - docs/method_list.html
118
- - docs/top-level-namespace.html
119
34
  - ext/brotli/brotli.c
120
35
  - ext/brotli/brotli.h
121
36
  - ext/brotli/buffer.c
@@ -124,16 +39,19 @@ files:
124
39
  - lib/brotli.rb
125
40
  - lib/brotli/version.rb
126
41
  - smoke.sh
127
- - spec/brotli_spec.rb
128
- - spec/inflate_spec.rb
129
- - spec/spec_helper.rb
42
+ - test/brotli_test.rb
43
+ - test/brotli_writer_test.rb
44
+ - test/test_helper.rb
130
45
  - vendor/brotli/LICENSE
46
+ - vendor/brotli/c/common/constants.c
131
47
  - vendor/brotli/c/common/constants.h
48
+ - vendor/brotli/c/common/context.c
132
49
  - vendor/brotli/c/common/context.h
133
50
  - vendor/brotli/c/common/dictionary.bin
134
51
  - vendor/brotli/c/common/dictionary.bin.br
135
52
  - vendor/brotli/c/common/dictionary.c
136
53
  - vendor/brotli/c/common/dictionary.h
54
+ - vendor/brotli/c/common/platform.c
137
55
  - vendor/brotli/c/common/platform.h
138
56
  - vendor/brotli/c/common/transform.c
139
57
  - vendor/brotli/c/common/transform.h
@@ -163,6 +81,7 @@ files:
163
81
  - vendor/brotli/c/enc/cluster.c
164
82
  - vendor/brotli/c/enc/cluster.h
165
83
  - vendor/brotli/c/enc/cluster_inc.h
84
+ - vendor/brotli/c/enc/command.c
166
85
  - vendor/brotli/c/enc/command.h
167
86
  - vendor/brotli/c/enc/compress_fragment.c
168
87
  - vendor/brotli/c/enc/compress_fragment.h
@@ -176,6 +95,7 @@ files:
176
95
  - vendor/brotli/c/enc/entropy_encode.c
177
96
  - vendor/brotli/c/enc/entropy_encode.h
178
97
  - vendor/brotli/c/enc/entropy_encode_static.h
98
+ - vendor/brotli/c/enc/fast_log.c
179
99
  - vendor/brotli/c/enc/fast_log.h
180
100
  - vendor/brotli/c/enc/find_match_length.h
181
101
  - vendor/brotli/c/enc/hash.h
@@ -229,11 +149,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
149
  - !ruby/object:Gem::Version
230
150
  version: '0'
231
151
  requirements: []
232
- rubygems_version: 3.0.3
152
+ rubygems_version: 3.1.4
233
153
  signing_key:
234
154
  specification_version: 4
235
155
  summary: Brotli compressor/decompressor
236
156
  test_files:
237
- - spec/brotli_spec.rb
238
- - spec/inflate_spec.rb
239
- - spec/spec_helper.rb
157
+ - test/brotli_test.rb
158
+ - test/brotli_writer_test.rb
159
+ - test/test_helper.rb
@@ -1,31 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache:
4
- bundler: true
5
- directories:
6
- - "$HOME/.ccache"
7
- rvm:
8
- - 1.9
9
- - 2.2
10
- - 2.3
11
- - 2.4
12
- - 2.5
13
- - 2.6
14
- - truffleruby
15
- env:
16
- global:
17
- - RANTLY_COUNT=10000
18
- - PATH="/usr/lib/ccache:$PATH"
19
- before_install: ./bin/before_install.sh
20
- deploy:
21
- provider: rubygems
22
- api_key:
23
- secure: pHMMdI6cthdpQ8XHK4LPMRJK9yndRNRprSpttbK+M2Cq6O8ABIx9YsaiR4U6+kkS4RXwWnnJ6qkglQVLsCd1x+elJA0V8MxhOdzKyQgNC5wbIhtIdEZ9cN0c/hG8e9pKa35K9q9ETJ4M8QWNPxkJTRKw1yM8rIMbzf0oy0Btrcz+pJG8C9cMQwfV3QGJFPdO4Hcb5v2gK9rMDU5v3OD9CgbQqaZN3tbR2G1WTiAkFk86RlwPTyaurIRiUV/AQedPSPHHJ5SYbThjcu5iy1OtlFHkVTy/5QNm8ooJkX3pAVhnexTL/iufP0YI9xmYPq4k4RxK1ywSATbvz13JKyD94Sdlhpblz4kJaA4Fg3td8qQtZnFEICBuiW1yelWwVXbyb+zjeL8K4EizoqZV2WwKq2GR3fmyAgFHWiVXRbu0aNjJi23rpNkAGif41vAbsskgBgOiKYsW5/ZOE2opL7lH5l8GGjiYQ8cOKbiNKpUSFaCfwOwgZt4QBTNsN+GuasLNZkm3Dt4Wj7KhFJ+HtAfTnSpomsSQ5/wGwMUchQKo9mfSE0lmKglFyvRV23+WnEX0ZC2jUIJmaxGn1PajDL5tjnZOd5mZAehrc74r84o5olM39y7DynU6FP9QaVBaXF/vue4kIbL0ePSxxwMIYErOh0pOWbWx7ipMfDn+1jfsmvA=
24
- gem: brotli
25
- on:
26
- tags: true
27
- repo: miyucy/brotli
28
- script: bundle exec rake && ./smoke.sh
29
- matrix:
30
- allow_failures:
31
- - rvm: truffleruby
@@ -1,485 +0,0 @@
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>