![]() |
Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
|
#include <brotli/port.h>#include <brotli/types.h>Go to the source code of this file.
Macros | |
| #define | BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE, SEPARATOR) |
| #define | BROTLI_COMMA_ , |
| #define | BROTLI_ERROR_CODE_ENUM_ITEM_(PREFIX, NAME, CODE) |
| #define | BROTLI_LAST_ERROR_CODE BROTLI_DECODER_ERROR_UNREACHABLE |
Typedefs | |
| typedef struct BrotliDecoderStateStruct | BrotliDecoderState |
| typedef enum BrotliDecoderParameter | BrotliDecoderParameter |
Enumerations | |
| enum | BrotliDecoderResult { BROTLI_DECODER_RESULT_ERROR = 0 , BROTLI_DECODER_RESULT_SUCCESS = 1 , BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT = 2 , BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT = 3 } |
| enum | BrotliDecoderErrorCode |
| enum | BrotliDecoderParameter { BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION = 0 , BROTLI_DECODER_PARAM_LARGE_WINDOW = 1 } |
API for Brotli decompression.
| #define BROTLI_COMMA_ , |
| #define BROTLI_DECODER_ERROR_CODES_LIST | ( | BROTLI_ERROR_CODE, | |
| SEPARATOR ) |
Template that evaluates items of BrotliDecoderErrorCode.
Example:
| #define BROTLI_LAST_ERROR_CODE BROTLI_DECODER_ERROR_UNREACHABLE |
The value of the last error code, negative integer.
All other error code values are in the range from BROTLI_LAST_ERROR_CODE to -1. There are also 4 other possible non-error codes 0 .. 3 in BrotliDecoderErrorCode enumeration.
| typedef enum BrotliDecoderParameter BrotliDecoderParameter |
Options to be used with BrotliDecoderSetParameter.
| typedef struct BrotliDecoderStateStruct BrotliDecoderState |
Opaque structure that holds decoder state.
Allocated and initialized with BrotliDecoderCreateInstance. Cleaned up and deallocated with BrotliDecoderDestroyInstance.
Error code for detailed logging / production debugging.
Options to be used with BrotliDecoderSetParameter.
| enum BrotliDecoderResult |
Result type for BrotliDecoderDecompress and BrotliDecoderDecompressStream functions.
| BROTLI_DEC_API BrotliDecoderState * BrotliDecoderCreateInstance | ( | brotli_alloc_func | alloc_func, |
| brotli_free_func | free_func, | ||
| void * | opaque ) |
Creates an instance of BrotliDecoderState and initializes it.
The instance can be used once for decoding and should then be destroyed with BrotliDecoderDestroyInstance, it cannot be reused for a new decoding session.
alloc_func and free_func MUST be both zero or both non-zero. In the case they are both zero, default memory allocators are used. opaque is passed to alloc_func and free_func when they are called. free_func has to return without doing anything when asked to free a NULL pointer.
| alloc_func | custom memory allocation function |
| free_func | custom memory free function |
| opaque | custom memory manager handle |
0 if instance can not be allocated or initialized | BROTLI_DEC_API BrotliDecoderResult BrotliDecoderDecompress | ( | size_t | encoded_size, |
| const uint8_t | encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], | ||
| size_t * | decoded_size, | ||
| uint8_t | decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)] ) |
Performs one-shot memory-to-memory decompression.
Decompresses the data in encoded_buffer into decoded_buffer, and sets *decoded_size to the decompressed length.
| encoded_size | size of encoded_buffer | |
| encoded_buffer | compressed data buffer with at least encoded_size addressable bytes | |
| [in,out] | decoded_size | in: size of decoded_buffer; out: length of decompressed data written to decoded_buffer |
| decoded_buffer | decompressed data destination buffer |
decoded_buffer is not large enough; | BROTLI_DEC_API BrotliDecoderResult BrotliDecoderDecompressStream | ( | BrotliDecoderState * | state, |
| size_t * | available_in, | ||
| const uint8_t ** | next_in, | ||
| size_t * | available_out, | ||
| uint8_t ** | next_out, | ||
| size_t * | total_out ) |
Decompresses the input stream to the output stream.
The values *available_in and *available_out must specify the number of bytes addressable at *next_in and *next_out respectively. When *available_out is 0, next_out is allowed to be NULL.
After each call, *available_in will be decremented by the amount of input bytes consumed, and the *next_in pointer will be incremented by that amount. Similarly, *available_out will be decremented by the amount of output bytes written, and the *next_out pointer will be incremented by that amount.
total_out, if it is not a null-pointer, will be set to the number of bytes decompressed since the last state initialization.
next_in and available_in could be passed to the next consumer after decoding is complete.| state | decoder instance | |
| [in,out] | available_in | in: amount of available input; out: amount of unused input |
| [in,out] | next_in | pointer to the next compressed byte |
| [in,out] | available_out | in: length of output buffer; out: remaining size of output buffer |
| [in,out] | next_out | output buffer cursor; can be NULL if available_out is 0 |
| [out] | total_out | number of bytes decompressed so far; can be NULL |
| BROTLI_DEC_API void BrotliDecoderDestroyInstance | ( | BrotliDecoderState * | state | ) |
Deinitializes and frees BrotliDecoderState instance.
| state | decoder instance to be cleaned up and deallocated |
| BROTLI_DEC_API const char * BrotliDecoderErrorString | ( | BrotliDecoderErrorCode | c | ) |
Converts error code to a c-string.
| BROTLI_DEC_API BrotliDecoderErrorCode BrotliDecoderGetErrorCode | ( | const BrotliDecoderState * | state | ) |
Acquires a detailed error code.
Should be used only after BrotliDecoderDecompressStream returns BROTLI_DECODER_RESULT_ERROR.
See also BrotliDecoderErrorString
| state | decoder instance |
| BROTLI_DEC_API BROTLI_BOOL BrotliDecoderHasMoreOutput | ( | const BrotliDecoderState * | state | ) |
Checks if decoder has more output.
| state | decoder instance |
| BROTLI_DEC_API BROTLI_BOOL BrotliDecoderIsFinished | ( | const BrotliDecoderState * | state | ) |
Checks if decoder instance reached the final state.
| state | decoder instance |
| BROTLI_DEC_API BROTLI_BOOL BrotliDecoderIsUsed | ( | const BrotliDecoderState * | state | ) |
Checks if instance has already consumed input.
Instance that returns BROTLI_FALSE is considered "fresh" and could be reused.
| state | decoder instance |
| BROTLI_DEC_API BROTLI_BOOL BrotliDecoderSetParameter | ( | BrotliDecoderState * | state, |
| BrotliDecoderParameter | param, | ||
| uint32_t | value ) |
Sets the specified parameter to the given decoder instance.
| state | decoder instance |
| param | parameter to set |
| value | new parameter value |
| BROTLI_DEC_API const uint8_t * BrotliDecoderTakeOutput | ( | BrotliDecoderState * | state, |
| size_t * | size ) |
Acquires pointer to internal output buffer.
This method is used to make language bindings easier and more efficient:
Also this could be useful if there is an output stream that is able to consume all the provided data (e.g. when data is saved to file system).
*size bytes of output are considered consumed for all consecutive calls to the instance methods; returned pointer becomes invalidated as well.| state | decoder instance | |
| [in,out] | size | in: number of bytes caller is ready to take, 0 if any amount could be handled; out: amount of data pointed by returned pointer and considered consumed; out value is never greater than in value, unless it is 0 |
| BROTLI_DEC_API uint32_t BrotliDecoderVersion | ( | void | ) |
Gets a decoder library version.
Look at BROTLI_VERSION for more information.