XZ Utils 5.4.0
|
Definitions common to the whole liblzma library. More...
Data Structures | |
struct | lzma_filter_info_s |
struct | lzma_next_coder_s |
Hold data and function pointers of the next filter in the chain. More... | |
struct | lzma_internal_s |
Macros | |
#define | LZMA_API_EXPORT |
#define | LZMA_API(type) LZMA_API_EXPORT type LZMA_API_CALL |
#define | lzma_has_attribute(attr) 0 |
#define | likely(expr) (expr) |
#define | unlikely(expr) (expr) |
#define | LZMA_BUFFER_SIZE 4096 |
Size of temporary buffers needed in some filters. More... | |
#define | LZMA_THREADS_MAX 16384 |
#define | LZMA_MEMUSAGE_BASE (UINT64_C(1) << 15) |
#define | LZMA_FILTER_RESERVED_START (LZMA_VLI_C(1) << 62) |
#define | LZMA_SUPPORTED_FLAGS |
#define | LZMA_ACTION_MAX ((unsigned int)(LZMA_FULL_BARRIER)) |
Largest valid lzma_action value as unsigned integer. More... | |
#define | LZMA_TIMED_OUT LZMA_RET_INTERNAL1 |
#define | LZMA_INDEX_DETECTED LZMA_RET_INTERNAL2 |
#define | LZMA_NEXT_CODER_INIT |
Macro to initialize lzma_next_coder structure. More... | |
#define | return_if_error(expr) |
Return if expression doesn't evaluate to LZMA_OK. More... | |
#define | lzma_next_coder_init(func, next, allocator) |
#define | lzma_next_strm_init(func, strm, ...) |
Typedefs | |
typedef struct lzma_next_coder_s | lzma_next_coder |
typedef struct lzma_filter_info_s | lzma_filter_info |
typedef lzma_ret(* | lzma_init_function) (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters) |
Type of a function used to initialize a filter encoder or decoder. More... | |
typedef lzma_ret(* | lzma_code_function) (void *coder, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) |
typedef void(* | lzma_end_function) (void *coder, const lzma_allocator *allocator) |
Type of a function to free the memory allocated for the coder. More... | |
Functions | |
void * | lzma_alloc (size_t size, const lzma_allocator *allocator) lzma_attribute((__malloc__)) lzma_attr_alloc_size(1) |
Allocates memory. More... | |
void * | lzma_attribute ((__malloc__)) lzma_attr_alloc_size(1) lzma_alloc_zero(size_t size |
void | lzma_free (void *ptr, const lzma_allocator *allocator) |
Frees memory. More... | |
lzma_ret | lzma_strm_init (lzma_stream *strm) |
lzma_ret | lzma_next_filter_init (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters) |
lzma_ret | lzma_next_filter_update (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter *reversed_filters) |
void | lzma_next_end (lzma_next_coder *next, const lzma_allocator *allocator) |
size_t | lzma_bufcpy (const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size) |
Variables | |
void const lzma_allocator * | allocator |
Definitions common to the whole liblzma library.
#define LZMA_BUFFER_SIZE 4096 |
Size of temporary buffers needed in some filters.
#define LZMA_THREADS_MAX 16384 |
Maximum number of worker threads within one multithreaded component. The limit exists solely to make it simpler to prevent integer overflows when allocating structures etc. This should be big enough for now... the code won't scale anywhere close to this number anyway.
#define LZMA_MEMUSAGE_BASE (UINT64_C(1) << 15) |
Starting value for memory usage estimates. Instead of calculating size of every structure and taking into account malloc() overhead etc., we add a base size to all memory usage estimates. It's not very accurate but should be easily good enough.
#define LZMA_FILTER_RESERVED_START (LZMA_VLI_C(1) << 62) |
Start of internal Filter ID space. These IDs must never be used in Streams.
#define LZMA_SUPPORTED_FLAGS |
Supported flags that can be passed to lzma_stream_decoder(), lzma_auto_decoder(), or lzma_stream_decoder_mt().
#define LZMA_ACTION_MAX ((unsigned int)(LZMA_FULL_BARRIER)) |
Largest valid lzma_action value as unsigned integer.
#define LZMA_TIMED_OUT LZMA_RET_INTERNAL1 |
Special return value (lzma_ret) to indicate that a timeout was reached and lzma_code() must not return LZMA_BUF_ERROR. This is converted to LZMA_OK in lzma_code().
#define LZMA_INDEX_DETECTED LZMA_RET_INTERNAL2 |
Special return value (lzma_ret) for use in stream_decoder_mt.c to indicate Index was detected instead of a Block Header.
#define LZMA_NEXT_CODER_INIT |
Macro to initialize lzma_next_coder structure.
#define return_if_error | ( | expr | ) |
#define lzma_next_coder_init | ( | func, | |
next, | |||
allocator | |||
) |
If next isn't already initialized, free the previous coder. Then mark that next is possibly initialized for the coder using this macro. "Possibly" means that if e.g. allocation of next->coder fails, the structure isn't actually initialized for this coder, but leaving next->init to func is still OK.
#define lzma_next_strm_init | ( | func, | |
strm, | |||
... | |||
) |
Initializes lzma_strm and calls func() to initialize strm->internal->next. (The function being called will use lzma_next_coder_init()). If initialization fails, memory that wasn't freed by func() is freed along strm->internal.
typedef lzma_ret(* lzma_init_function) (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters) |
Type of a function used to initialize a filter encoder or decoder.
typedef lzma_ret(* lzma_code_function) (void *coder, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) |
Type of a function to do some kind of coding work (filters, Stream, Block encoders/decoders etc.). Some special coders use don't use both input and output buffers, but for simplicity they still use this same function prototype.
typedef void(* lzma_end_function) (void *coder, const lzma_allocator *allocator) |
Type of a function to free the memory allocated for the coder.
void * lzma_alloc | ( | size_t | size, |
const lzma_allocator * | allocator | ||
) |
Allocates memory.
Referenced by lzma_strm_init().
void * lzma_attribute | ( | (__malloc__) | ) |
Allocates memory and zeroes it (like calloc()). This can be faster than lzma_alloc() + memzero() while being backward compatible with custom allocators.
void lzma_free | ( | void * | ptr, |
const lzma_allocator * | allocator | ||
) |
Frees memory.
Referenced by lzma_end().
lzma_ret lzma_strm_init | ( | lzma_stream * | strm | ) |
Allocates strm->internal if it is NULL, and initializes *strm and strm->internal. This function is only called via lzma_next_strm_init macro.
References lzma_stream::allocator, lzma_stream::internal, lzma_alloc(), LZMA_MEM_ERROR, LZMA_NEXT_CODER_INIT, LZMA_PROG_ERROR, lzma_internal_s::next, and strm.
lzma_ret lzma_next_filter_init | ( | lzma_next_coder * | next, |
const lzma_allocator * | allocator, | ||
const lzma_filter_info * | filters | ||
) |
Initializes the next filter in the chain, if any. This takes care of freeing the memory of previously initialized filter if it is different than the filter being initialized now. This way the actual filter initialization functions don't need to use lzma_next_coder_init macro.
lzma_ret lzma_next_filter_update | ( | lzma_next_coder * | next, |
const lzma_allocator * | allocator, | ||
const lzma_filter * | reversed_filters | ||
) |
Update the next filter in the chain, if any. This checks that the application is not trying to change the Filter IDs.
void lzma_next_end | ( | lzma_next_coder * | next, |
const lzma_allocator * | allocator | ||
) |
Frees the memory allocated for next->coder either using next->end or, if next->end is NULL, using lzma_free.
Referenced by lzma_end().
size_t lzma_bufcpy | ( | const uint8_t *restrict | in, |
size_t *restrict | in_pos, | ||
size_t | in_size, | ||
uint8_t *restrict | out, | ||
size_t *restrict | out_pos, | ||
size_t | out_size | ||
) |
Copy as much data as possible from in[] to out[] and update *in_pos and *out_pos accordingly. Returns the number of bytes copied.
Referenced by dict_write(), and fill_temp().