| OLD | NEW |
| 1 /* Copyright 2013 Google Inc. All Rights Reserved. | 1 /* Copyright 2013 Google Inc. All Rights Reserved. |
| 2 | 2 |
| 3 Distributed under MIT license. | 3 Distributed under MIT license. |
| 4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT | 4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* API for Brotli decompression */ | 7 /* API for Brotli decompression */ |
| 8 | 8 |
| 9 #ifndef BROTLI_DEC_DECODE_H_ | 9 #ifndef BROTLI_DEC_DECODE_H_ |
| 10 #define BROTLI_DEC_DECODE_H_ | 10 #define BROTLI_DEC_DECODE_H_ |
| 11 | 11 |
| 12 #include "./state.h" | |
| 13 #include "./types.h" | 12 #include "./types.h" |
| 14 | 13 |
| 15 #if defined(__cplusplus) || defined(c_plusplus) | 14 #if defined(__cplusplus) || defined(c_plusplus) |
| 16 extern "C" { | 15 extern "C" { |
| 17 #endif | 16 #endif |
| 18 | 17 |
| 18 typedef struct BrotliStateStruct BrotliState; |
| 19 |
| 19 typedef enum { | 20 typedef enum { |
| 20 /* Decoding error, e.g. corrupt input or memory allocation problem */ | 21 /* Decoding error, e.g. corrupt input or memory allocation problem */ |
| 21 BROTLI_RESULT_ERROR = 0, | 22 BROTLI_RESULT_ERROR = 0, |
| 22 /* Decoding successfully completed */ | 23 /* Decoding successfully completed */ |
| 23 BROTLI_RESULT_SUCCESS = 1, | 24 BROTLI_RESULT_SUCCESS = 1, |
| 24 /* Partially done; should be called again with more input */ | 25 /* Partially done; should be called again with more input */ |
| 25 BROTLI_RESULT_NEEDS_MORE_INPUT = 2, | 26 BROTLI_RESULT_NEEDS_MORE_INPUT = 2, |
| 26 /* Partially done; should be called again with more output */ | 27 /* Partially done; should be called again with more output */ |
| 27 BROTLI_RESULT_NEEDS_MORE_OUTPUT = 3 | 28 BROTLI_RESULT_NEEDS_MORE_OUTPUT = 3 |
| 28 } BrotliResult; | 29 } BrotliResult; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 size_t* available_out, | 74 size_t* available_out, |
| 74 uint8_t** next_out, | 75 uint8_t** next_out, |
| 75 size_t* total_out, | 76 size_t* total_out, |
| 76 BrotliState* s); | 77 BrotliState* s); |
| 77 | 78 |
| 78 /* Fills the new state with a dictionary for LZ77, warming up the ringbuffer, | 79 /* Fills the new state with a dictionary for LZ77, warming up the ringbuffer, |
| 79 e.g. for custom static dictionaries for data formats. | 80 e.g. for custom static dictionaries for data formats. |
| 80 Not to be confused with the built-in transformable dictionary of Brotli. | 81 Not to be confused with the built-in transformable dictionary of Brotli. |
| 81 The dictionary must exist in memory until decoding is done and is owned by | 82 The dictionary must exist in memory until decoding is done and is owned by |
| 82 the caller. To use: | 83 the caller. To use: |
| 83 1) initialize state with BrotliStateInit | 84 1) Allocate and initialize state with BrotliCreateState |
| 84 2) use BrotliSetCustomDictionary | 85 2) Use BrotliSetCustomDictionary |
| 85 3) use BrotliDecompressStream | 86 3) Use BrotliDecompressStream |
| 86 4) clean up with BrotliStateCleanup | 87 4) Clean up and free state with BrotliDestroyState |
| 87 */ | 88 */ |
| 88 void BrotliSetCustomDictionary( | 89 void BrotliSetCustomDictionary( |
| 89 size_t size, const uint8_t* dict, BrotliState* s); | 90 size_t size, const uint8_t* dict, BrotliState* s); |
| 90 | 91 |
| 92 /* Returns 1, if s is in a state where we have not read any input bytes yet, |
| 93 and 0 otherwise */ |
| 94 int BrotliStateIsStreamStart(const BrotliState* s); |
| 95 |
| 96 /* Returns 1, if s is in a state where we reached the end of the input and |
| 97 produced all of the output, and 0 otherwise. */ |
| 98 int BrotliStateIsStreamEnd(const BrotliState* s); |
| 91 | 99 |
| 92 #if defined(__cplusplus) || defined(c_plusplus) | 100 #if defined(__cplusplus) || defined(c_plusplus) |
| 93 } /* extern "C" */ | 101 } /* extern "C" */ |
| 94 #endif | 102 #endif |
| 95 | 103 |
| 96 #endif /* BROTLI_DEC_DECODE_H_ */ | 104 #endif /* BROTLI_DEC_DECODE_H_ */ |
| OLD | NEW |