brotli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +1 -1
  3. data/.travis.yml +2 -1
  4. data/README.md +1 -1
  5. data/Rakefile +1 -1
  6. data/ext/brotli/brotli.cc +1 -1
  7. data/ext/brotli/extconf.rb +72 -14
  8. data/lib/brotli/version.rb +1 -1
  9. data/vendor/brotli/LICENSE +19 -202
  10. data/vendor/brotli/dec/Makefile +1 -1
  11. data/vendor/brotli/dec/bit_reader.c +23 -30
  12. data/vendor/brotli/dec/bit_reader.h +270 -141
  13. data/vendor/brotli/dec/context.h +3 -12
  14. data/vendor/brotli/dec/decode.c +1813 -1048
  15. data/vendor/brotli/dec/decode.h +22 -16
  16. data/vendor/brotli/dec/dictionary.c +9466 -0
  17. data/vendor/brotli/dec/dictionary.h +6 -9461
  18. data/vendor/brotli/dec/huffman.c +104 -71
  19. data/vendor/brotli/dec/huffman.h +19 -28
  20. data/vendor/brotli/dec/port.h +124 -32
  21. data/vendor/brotli/dec/prefix.h +4 -13
  22. data/vendor/brotli/dec/state.c +93 -56
  23. data/vendor/brotli/dec/state.h +124 -53
  24. data/vendor/brotli/dec/streams.c +14 -11
  25. data/vendor/brotli/dec/streams.h +6 -11
  26. data/vendor/brotli/dec/transform.h +2 -11
  27. data/vendor/brotli/dec/types.h +21 -19
  28. data/vendor/brotli/enc/Makefile +4 -1
  29. data/vendor/brotli/enc/backward_references.cc +87 -94
  30. data/vendor/brotli/enc/backward_references.h +8 -18
  31. data/vendor/brotli/enc/bit_cost.h +11 -19
  32. data/vendor/brotli/enc/block_splitter.cc +43 -48
  33. data/vendor/brotli/enc/block_splitter.h +7 -16
  34. data/vendor/brotli/enc/brotli_bit_stream.cc +48 -50
  35. data/vendor/brotli/enc/brotli_bit_stream.h +7 -16
  36. data/vendor/brotli/enc/cluster.h +24 -25
  37. data/vendor/brotli/enc/command.h +34 -41
  38. data/vendor/brotli/enc/context.h +11 -18
  39. data/vendor/brotli/enc/dictionary.cc +9466 -0
  40. data/vendor/brotli/enc/dictionary.h +20 -9464
  41. data/vendor/brotli/enc/dictionary_hash.h +7 -15
  42. data/vendor/brotli/enc/encode.cc +80 -148
  43. data/vendor/brotli/enc/encode.h +19 -29
  44. data/vendor/brotli/enc/encode_parallel.cc +35 -108
  45. data/vendor/brotli/enc/encode_parallel.h +7 -16
  46. data/vendor/brotli/enc/entropy_encode.cc +33 -42
  47. data/vendor/brotli/enc/entropy_encode.h +8 -16
  48. data/vendor/brotli/enc/fast_log.h +8 -15
  49. data/vendor/brotli/enc/find_match_length.h +7 -17
  50. data/vendor/brotli/enc/hash.h +130 -150
  51. data/vendor/brotli/enc/histogram.cc +7 -16
  52. data/vendor/brotli/enc/histogram.h +11 -17
  53. data/vendor/brotli/enc/literal_cost.cc +28 -35
  54. data/vendor/brotli/enc/literal_cost.h +9 -23
  55. data/vendor/brotli/enc/metablock.cc +18 -26
  56. data/vendor/brotli/enc/metablock.h +6 -14
  57. data/vendor/brotli/enc/port.h +14 -14
  58. data/vendor/brotli/enc/prefix.h +11 -18
  59. data/vendor/brotli/enc/ringbuffer.h +18 -27
  60. data/vendor/brotli/enc/static_dict.cc +7 -1
  61. data/vendor/brotli/enc/static_dict.h +7 -15
  62. data/vendor/brotli/enc/static_dict_lut.h +7 -15
  63. data/vendor/brotli/enc/streams.cc +15 -28
  64. data/vendor/brotli/enc/streams.h +27 -35
  65. data/vendor/brotli/enc/transform.h +9 -16
  66. data/vendor/brotli/enc/types.h +27 -0
  67. data/vendor/brotli/enc/utf8_util.cc +82 -0
  68. data/vendor/brotli/enc/utf8_util.h +25 -0
  69. data/vendor/brotli/enc/write_bits.h +11 -18
  70. metadata +7 -2
@@ -1,16 +1,7 @@
1
1
  /* Copyright 2013 Google Inc. All Rights Reserved.
2
2
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
3
+ Distributed under MIT license.
4
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
14
5
  */
15
6
 
16
7
  /* API for Brotli decompression */
@@ -51,6 +42,16 @@ static inline BrotliResult BrotliFailure(const char *f, int l, const char *fn) {
51
42
  }
52
43
  #endif
53
44
 
45
+ /* Creates the instance of BrotliState and initializes it. alloc_func and
46
+ free_func MUST be both zero or both non-zero. In the case they are both zero,
47
+ default memory allocators are used. opaque parameter is passed to alloc_func
48
+ and free_func when they are called. */
49
+ BrotliState* BrotliCreateState(
50
+ brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque);
51
+
52
+ /* Deinitializes and frees BrotliState instance. */
53
+ void BrotliDestroyState(BrotliState* state);
54
+
54
55
  /* Sets *decoded_size to the decompressed size of the given encoded stream. */
55
56
  /* This function only works if the encoded buffer has a single meta block, */
56
57
  /* or if it has two meta-blocks, where the first is uncompressed and the */
@@ -62,9 +63,6 @@ int BrotliDecompressedSize(size_t encoded_size,
62
63
 
63
64
  /* Decompresses the data in encoded_buffer into decoded_buffer, and sets */
64
65
  /* *decoded_size to the decompressed length. */
65
- /* Returns 0 if there was either a bit stream error or memory allocation */
66
- /* error, and 1 otherwise. */
67
- /* If decoded size is zero, returns 1 and keeps decoded_buffer unchanged. */
68
66
  BrotliResult BrotliDecompressBuffer(size_t encoded_size,
69
67
  const uint8_t* encoded_buffer,
70
68
  size_t* decoded_size,
@@ -72,6 +70,7 @@ BrotliResult BrotliDecompressBuffer(size_t encoded_size,
72
70
 
73
71
  /* Same as above, but uses the specified input and output callbacks instead */
74
72
  /* of reading from and writing to pre-allocated memory buffers. */
73
+ /* DEPRECATED */
75
74
  BrotliResult BrotliDecompress(BrotliInput input, BrotliOutput output);
76
75
 
77
76
  /* Same as above, but supports the caller to call the decoder repeatedly with
@@ -99,6 +98,7 @@ BrotliResult BrotliDecompress(BrotliInput input, BrotliOutput output);
99
98
  it returning a smaller value than the amount of bytes to write always results
100
99
  in an error.
101
100
  */
101
+ /* DEPRECATED */
102
102
  BrotliResult BrotliDecompressStreaming(BrotliInput input, BrotliOutput output,
103
103
  int finish, BrotliState* s);
104
104
 
@@ -129,6 +129,7 @@ BrotliResult BrotliDecompressStreaming(BrotliInput input, BrotliOutput output,
129
129
  *available_out yourself before a next call, e.g. to point to a new larger
130
130
  buffer.
131
131
  */
132
+ /* DEPRECATED */
132
133
  BrotliResult BrotliDecompressBufferStreaming(size_t* available_in,
133
134
  const uint8_t** next_in,
134
135
  int finish,
@@ -137,6 +138,13 @@ BrotliResult BrotliDecompressBufferStreaming(size_t* available_in,
137
138
  size_t* total_out,
138
139
  BrotliState* s);
139
140
 
141
+ BrotliResult BrotliDecompressStream(size_t* available_in,
142
+ const uint8_t** next_in,
143
+ size_t* available_out,
144
+ uint8_t** next_out,
145
+ size_t* total_out,
146
+ BrotliState* s);
147
+
140
148
  /* Fills the new state with a dictionary for LZ77, warming up the ringbuffer,
141
149
  e.g. for custom static dictionaries for data formats.
142
150
  Not to be confused with the built-in transformable dictionary of Brotli.
@@ -150,8 +158,6 @@ BrotliResult BrotliDecompressBufferStreaming(size_t* available_in,
150
158
  void BrotliSetCustomDictionary(
151
159
  size_t size, const uint8_t* dict, BrotliState* s);
152
160
 
153
- /* Escalate internal functions visibility; for testing purposes only. */
154
- void InverseMoveToFrontTransformForTesting(uint8_t* v, int l, BrotliState* s);
155
161
 
156
162
  #if defined(__cplusplus) || defined(c_plusplus)
157
163
  } /* extern "C" */