liblzma: Make the use of lzma_allocator const-correct.
There is a tiny risk of causing breakage: If an application assigns lzma_stream.allocator to a non-const pointer, such code won't compile anymore. I don't know why anyone would do such a thing though, so in practice this shouldn't cause trouble. Thanks to Jan Kratochvil for the patch.
This commit is contained in:
parent
d625c7cf82
commit
3778db1be5
|
@ -472,8 +472,10 @@ typedef struct {
|
||||||
*
|
*
|
||||||
* In most cases this is NULL which makes liblzma use
|
* In most cases this is NULL which makes liblzma use
|
||||||
* the standard malloc() and free().
|
* the standard malloc() and free().
|
||||||
|
*
|
||||||
|
* \note In 5.0.x this is not a const pointer.
|
||||||
*/
|
*/
|
||||||
lzma_allocator *allocator;
|
const lzma_allocator *allocator;
|
||||||
|
|
||||||
/** Internal state is not visible to applications. */
|
/** Internal state is not visible to applications. */
|
||||||
lzma_internal *internal;
|
lzma_internal *internal;
|
||||||
|
|
|
@ -341,7 +341,7 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode(
|
||||||
* block->header_size is invalid or block->filters is NULL.
|
* block->header_size is invalid or block->filters is NULL.
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block,
|
extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block,
|
||||||
lzma_allocator *allocator, const uint8_t *in)
|
const lzma_allocator *allocator, const uint8_t *in)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size)
|
||||||
* - LZMA_PROG_ERROR
|
* - LZMA_PROG_ERROR
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
|
extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
|
||||||
lzma_block *block, lzma_allocator *allocator,
|
lzma_block *block, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t in_size,
|
const uint8_t *in, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
@ -524,7 +524,7 @@ extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
|
||||||
* - LZMA_PROG_ERROR
|
* - LZMA_PROG_ERROR
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_block_buffer_decode(
|
extern LZMA_API(lzma_ret) lzma_block_buffer_decode(
|
||||||
lzma_block *block, lzma_allocator *allocator,
|
lzma_block *block, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
lzma_nothrow;
|
lzma_nothrow;
|
||||||
|
|
|
@ -288,7 +288,8 @@ extern LZMA_API(lzma_ret) lzma_easy_encoder(
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
|
extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
|
||||||
uint32_t preset, lzma_check check,
|
uint32_t preset, lzma_check check,
|
||||||
lzma_allocator *allocator, const uint8_t *in, size_t in_size,
|
const lzma_allocator *allocator,
|
||||||
|
const uint8_t *in, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
|
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
|
||||||
|
|
||||||
|
|
||||||
|
@ -436,7 +437,8 @@ extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
|
extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
|
||||||
lzma_filter *filters, lzma_check check,
|
lzma_filter *filters, lzma_check check,
|
||||||
lzma_allocator *allocator, const uint8_t *in, size_t in_size,
|
const lzma_allocator *allocator,
|
||||||
|
const uint8_t *in, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
|
||||||
|
@ -585,7 +587,8 @@ extern LZMA_API(lzma_ret) lzma_alone_decoder(
|
||||||
* - LZMA_PROG_ERROR
|
* - LZMA_PROG_ERROR
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
|
extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
|
||||||
uint64_t *memlimit, uint32_t flags, lzma_allocator *allocator,
|
uint64_t *memlimit, uint32_t flags,
|
||||||
|
const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
|
|
@ -116,8 +116,9 @@ extern LZMA_API(lzma_bool) lzma_filter_decoder_is_supported(lzma_vli id)
|
||||||
* is not NULL.
|
* is not NULL.
|
||||||
* - LZMA_PROG_ERROR: src or dest is NULL.
|
* - LZMA_PROG_ERROR: src or dest is NULL.
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src,
|
extern LZMA_API(lzma_ret) lzma_filters_copy(
|
||||||
lzma_filter *dest, lzma_allocator *allocator) lzma_nothrow;
|
const lzma_filter *src, lzma_filter *dest,
|
||||||
|
const lzma_allocator *allocator) lzma_nothrow;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -256,7 +257,7 @@ extern LZMA_API(lzma_ret) lzma_filters_update(
|
||||||
* won't necessarily meet that bound.)
|
* won't necessarily meet that bound.)
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
|
extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
|
||||||
const lzma_filter *filters, lzma_allocator *allocator,
|
const lzma_filter *filters, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t in_size, uint8_t *out,
|
const uint8_t *in, size_t in_size, uint8_t *out,
|
||||||
size_t *out_pos, size_t out_size) lzma_nothrow;
|
size_t *out_pos, size_t out_size) lzma_nothrow;
|
||||||
|
|
||||||
|
@ -280,7 +281,7 @@ extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
|
||||||
* which no data is written to is out[out_size].
|
* which no data is written to is out[out_size].
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_raw_buffer_decode(
|
extern LZMA_API(lzma_ret) lzma_raw_buffer_decode(
|
||||||
const lzma_filter *filters, lzma_allocator *allocator,
|
const lzma_filter *filters, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
|
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
|
||||||
|
|
||||||
|
@ -356,7 +357,7 @@ extern LZMA_API(lzma_ret) lzma_properties_encode(
|
||||||
* - LZMA_MEM_ERROR
|
* - LZMA_MEM_ERROR
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_properties_decode(
|
extern LZMA_API(lzma_ret) lzma_properties_decode(
|
||||||
lzma_filter *filter, lzma_allocator *allocator,
|
lzma_filter *filter, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size) lzma_nothrow;
|
const uint8_t *props, size_t props_size) lzma_nothrow;
|
||||||
|
|
||||||
|
|
||||||
|
@ -419,6 +420,6 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter,
|
||||||
* - LZMA_PROG_ERROR
|
* - LZMA_PROG_ERROR
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_filter_flags_decode(
|
extern LZMA_API(lzma_ret) lzma_filter_flags_decode(
|
||||||
lzma_filter *filter, lzma_allocator *allocator,
|
lzma_filter *filter, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size)
|
const uint8_t *in, size_t *in_pos, size_t in_size)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
|
|
@ -303,7 +303,7 @@ extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i)
|
||||||
* \return On success, a pointer to an empty initialized lzma_index is
|
* \return On success, a pointer to an empty initialized lzma_index is
|
||||||
* returned. If allocation fails, NULL is returned.
|
* returned. If allocation fails, NULL is returned.
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator)
|
extern LZMA_API(lzma_index *) lzma_index_init(const lzma_allocator *allocator)
|
||||||
lzma_nothrow;
|
lzma_nothrow;
|
||||||
|
|
||||||
|
|
||||||
|
@ -312,8 +312,8 @@ extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator)
|
||||||
*
|
*
|
||||||
* If i is NULL, this does nothing.
|
* If i is NULL, this does nothing.
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(void) lzma_index_end(lzma_index *i, lzma_allocator *allocator)
|
extern LZMA_API(void) lzma_index_end(
|
||||||
lzma_nothrow;
|
lzma_index *i, const lzma_allocator *allocator) lzma_nothrow;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -341,7 +341,7 @@ extern LZMA_API(void) lzma_index_end(lzma_index *i, lzma_allocator *allocator)
|
||||||
* - LZMA_PROG_ERROR
|
* - LZMA_PROG_ERROR
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_index_append(
|
extern LZMA_API(lzma_ret) lzma_index_append(
|
||||||
lzma_index *i, lzma_allocator *allocator,
|
lzma_index *i, const lzma_allocator *allocator,
|
||||||
lzma_vli unpadded_size, lzma_vli uncompressed_size)
|
lzma_vli unpadded_size, lzma_vli uncompressed_size)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
|
||||||
|
@ -564,8 +564,8 @@ extern LZMA_API(lzma_bool) lzma_index_iter_locate(
|
||||||
* - LZMA_MEM_ERROR
|
* - LZMA_MEM_ERROR
|
||||||
* - LZMA_PROG_ERROR
|
* - LZMA_PROG_ERROR
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_index_cat(
|
extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *dest, lzma_index *src,
|
||||||
lzma_index *dest, lzma_index *src, lzma_allocator *allocator)
|
const lzma_allocator *allocator)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ extern LZMA_API(lzma_ret) lzma_index_cat(
|
||||||
* \return A copy of the lzma_index, or NULL if memory allocation failed.
|
* \return A copy of the lzma_index, or NULL if memory allocation failed.
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_index *) lzma_index_dup(
|
extern LZMA_API(lzma_index *) lzma_index_dup(
|
||||||
const lzma_index *i, lzma_allocator *allocator)
|
const lzma_index *i, const lzma_allocator *allocator)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
|
||||||
|
|
||||||
|
@ -677,6 +677,6 @@ extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i,
|
||||||
* - LZMA_PROG_ERROR
|
* - LZMA_PROG_ERROR
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i,
|
extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i,
|
||||||
uint64_t *memlimit, lzma_allocator *allocator,
|
uint64_t *memlimit, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size)
|
const uint8_t *in, size_t *in_pos, size_t in_size)
|
||||||
lzma_nothrow;
|
lzma_nothrow;
|
||||||
|
|
|
@ -37,7 +37,7 @@ typedef struct lzma_index_hash_s lzma_index_hash;
|
||||||
* pointer than the index_hash that was given as an argument.
|
* pointer than the index_hash that was given as an argument.
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
|
extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
|
||||||
lzma_index_hash *index_hash, lzma_allocator *allocator)
|
lzma_index_hash *index_hash, const lzma_allocator *allocator)
|
||||||
lzma_nothrow lzma_attr_warn_unused_result;
|
lzma_nothrow lzma_attr_warn_unused_result;
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
|
||||||
* \brief Deallocate lzma_index_hash structure
|
* \brief Deallocate lzma_index_hash structure
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(void) lzma_index_hash_end(
|
extern LZMA_API(void) lzma_index_hash_end(
|
||||||
lzma_index_hash *index_hash, lzma_allocator *allocator)
|
lzma_index_hash *index_hash, const lzma_allocator *allocator)
|
||||||
lzma_nothrow;
|
lzma_nothrow;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
alone_decode(lzma_coder *coder,
|
alone_decode(lzma_coder *coder,
|
||||||
lzma_allocator *allocator lzma_attribute((__unused__)),
|
const lzma_allocator *allocator lzma_attribute((__unused__)),
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size,
|
size_t *restrict out_pos, size_t out_size,
|
||||||
|
@ -161,7 +161,7 @@ alone_decode(lzma_coder *coder,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alone_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
alone_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
|
@ -188,7 +188,7 @@ alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
uint64_t memlimit)
|
uint64_t memlimit)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
|
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
|
||||||
|
|
|
@ -17,6 +17,6 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_alone_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_alone_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, uint64_t memlimit);
|
const lzma_allocator *allocator, uint64_t memlimit);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
alone_encode(lzma_coder *coder,
|
alone_encode(lzma_coder *coder,
|
||||||
lzma_allocator *allocator lzma_attribute((__unused__)),
|
const lzma_allocator *allocator lzma_attribute((__unused__)),
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size,
|
size_t *restrict out_pos, size_t out_size,
|
||||||
|
@ -65,7 +65,7 @@ alone_encode(lzma_coder *coder,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alone_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
alone_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
|
@ -75,7 +75,7 @@ alone_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
// At least for now, this is not used by any internal function.
|
// At least for now, this is not used by any internal function.
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_options_lzma *options)
|
const lzma_options_lzma *options)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&alone_encoder_init, next, allocator);
|
lzma_next_coder_init(&alone_encoder_init, next, allocator);
|
||||||
|
@ -137,7 +137,7 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_options_alone *options)
|
const lzma_options_alone *options)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&alone_encoder_init, next, allocator, options);
|
lzma_next_coder_init(&alone_encoder_init, next, allocator, options);
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
auto_decode(lzma_coder *coder, lzma_allocator *allocator,
|
auto_decode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -100,7 +100,7 @@ auto_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
auto_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
auto_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
|
@ -143,7 +143,7 @@ auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
auto_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
auto_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
uint64_t memlimit, uint32_t flags)
|
uint64_t memlimit, uint32_t flags)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&auto_decoder_init, next, allocator);
|
lzma_next_coder_init(&auto_decoder_init, next, allocator);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator,
|
lzma_block_buffer_decode(lzma_block *block, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,7 +160,7 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
block_encode_normal(lzma_block *block, lzma_allocator *allocator,
|
block_encode_normal(lzma_block *block, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t in_size,
|
const uint8_t *in, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
{
|
{
|
||||||
|
@ -222,7 +222,7 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
|
lzma_block_buffer_encode(lzma_block *block, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t in_size,
|
const uint8_t *in, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,7 @@ is_size_valid(lzma_vli size, lzma_vli reference)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
block_decode(lzma_coder *coder, lzma_allocator *allocator,
|
block_decode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -170,7 +170,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
block_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
block_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
|
@ -179,7 +179,7 @@ block_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_block_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
lzma_block *block)
|
lzma_block *block)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&lzma_block_decoder_init, next, allocator);
|
lzma_next_coder_init(&lzma_block_decoder_init, next, allocator);
|
||||||
|
|
|
@ -17,6 +17,6 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_block_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_block_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, lzma_block *block);
|
const lzma_allocator *allocator, lzma_block *block);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
block_encode(lzma_coder *coder, lzma_allocator *allocator,
|
block_encode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -134,7 +134,7 @@ block_encode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
block_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
block_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
|
@ -143,7 +143,7 @@ block_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
block_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
block_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters lzma_attribute((__unused__)),
|
const lzma_filter *filters lzma_attribute((__unused__)),
|
||||||
const lzma_filter *reversed_filters)
|
const lzma_filter *reversed_filters)
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ block_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_block_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
lzma_block *block)
|
lzma_block *block)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&lzma_block_encoder_init, next, allocator);
|
lzma_next_coder_init(&lzma_block_encoder_init, next, allocator);
|
||||||
|
|
|
@ -42,6 +42,6 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_block_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_block_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, lzma_block *block);
|
const lzma_allocator *allocator, lzma_block *block);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_properties(lzma_block *block, lzma_allocator *allocator)
|
free_properties(lzma_block *block, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// Free allocated filter options. The last array member is not
|
// Free allocated filter options. The last array member is not
|
||||||
// touched after the initialization in the beginning of
|
// touched after the initialization in the beginning of
|
||||||
|
@ -32,7 +32,7 @@ free_properties(lzma_block *block, lzma_allocator *allocator)
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_block_header_decode(lzma_block *block,
|
lzma_block_header_decode(lzma_block *block,
|
||||||
lzma_allocator *allocator, const uint8_t *in)
|
const lzma_allocator *allocator, const uint8_t *in)
|
||||||
{
|
{
|
||||||
// NOTE: We consider the header to be corrupt not only when the
|
// NOTE: We consider the header to be corrupt not only when the
|
||||||
// CRC32 doesn't match, but also when variable-length integers
|
// CRC32 doesn't match, but also when variable-length integers
|
||||||
|
|
|
@ -36,7 +36,7 @@ lzma_version_string(void)
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
|
||||||
extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
|
extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
|
||||||
lzma_alloc(size_t size, lzma_allocator *allocator)
|
lzma_alloc(size_t size, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// Some malloc() variants return NULL if called with size == 0.
|
// Some malloc() variants return NULL if called with size == 0.
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
|
@ -54,7 +54,7 @@ lzma_alloc(size_t size, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
lzma_free(void *ptr, lzma_allocator *allocator)
|
lzma_free(void *ptr, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
if (allocator != NULL && allocator->free != NULL)
|
if (allocator != NULL && allocator->free != NULL)
|
||||||
allocator->free(allocator->opaque, ptr);
|
allocator->free(allocator->opaque, ptr);
|
||||||
|
@ -88,7 +88,7 @@ lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_filter_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(filters[0].init, next, allocator);
|
lzma_next_coder_init(filters[0].init, next, allocator);
|
||||||
|
@ -99,7 +99,7 @@ lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_next_filter_update(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_filter_update(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *reversed_filters)
|
const lzma_filter *reversed_filters)
|
||||||
{
|
{
|
||||||
// Check that the application isn't trying to change the Filter ID.
|
// Check that the application isn't trying to change the Filter ID.
|
||||||
|
@ -117,7 +117,7 @@ lzma_next_filter_update(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator)
|
lzma_next_end(lzma_next_coder *next, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
if (next->init != (uintptr_t)(NULL)) {
|
if (next->init != (uintptr_t)(NULL)) {
|
||||||
// To avoid tiny end functions that simply call
|
// To avoid tiny end functions that simply call
|
||||||
|
|
|
@ -96,7 +96,7 @@ typedef struct lzma_filter_info_s lzma_filter_info;
|
||||||
|
|
||||||
/// Type of a function used to initialize a filter encoder or decoder
|
/// Type of a function used to initialize a filter encoder or decoder
|
||||||
typedef lzma_ret (*lzma_init_function)(
|
typedef lzma_ret (*lzma_init_function)(
|
||||||
lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters);
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
/// Type of a function to do some kind of coding work (filters, Stream,
|
/// Type of a function to do some kind of coding work (filters, Stream,
|
||||||
|
@ -104,7 +104,7 @@ typedef lzma_ret (*lzma_init_function)(
|
||||||
/// input and output buffers, but for simplicity they still use this same
|
/// input and output buffers, but for simplicity they still use this same
|
||||||
/// function prototype.
|
/// function prototype.
|
||||||
typedef lzma_ret (*lzma_code_function)(
|
typedef lzma_ret (*lzma_code_function)(
|
||||||
lzma_coder *coder, lzma_allocator *allocator,
|
lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size,
|
size_t *restrict out_pos, size_t out_size,
|
||||||
|
@ -112,7 +112,7 @@ typedef lzma_ret (*lzma_code_function)(
|
||||||
|
|
||||||
/// Type of a function to free the memory allocated for the coder
|
/// Type of a function to free the memory allocated for the coder
|
||||||
typedef void (*lzma_end_function)(
|
typedef void (*lzma_end_function)(
|
||||||
lzma_coder *coder, lzma_allocator *allocator);
|
lzma_coder *coder, const lzma_allocator *allocator);
|
||||||
|
|
||||||
|
|
||||||
/// Raw coder validates and converts an array of lzma_filter structures to
|
/// Raw coder validates and converts an array of lzma_filter structures to
|
||||||
|
@ -166,7 +166,7 @@ struct lzma_next_coder_s {
|
||||||
|
|
||||||
/// Update the filter-specific options or the whole filter chain
|
/// Update the filter-specific options or the whole filter chain
|
||||||
/// in the encoder.
|
/// in the encoder.
|
||||||
lzma_ret (*update)(lzma_coder *coder, lzma_allocator *allocator,
|
lzma_ret (*update)(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters,
|
const lzma_filter *filters,
|
||||||
const lzma_filter *reversed_filters);
|
const lzma_filter *reversed_filters);
|
||||||
};
|
};
|
||||||
|
@ -220,11 +220,11 @@ struct lzma_internal_s {
|
||||||
|
|
||||||
|
|
||||||
/// Allocates memory
|
/// Allocates memory
|
||||||
extern void *lzma_alloc(size_t size, lzma_allocator *allocator)
|
extern void *lzma_alloc(size_t size, const lzma_allocator *allocator)
|
||||||
lzma_attribute((__malloc__)) lzma_attr_alloc_size(1);
|
lzma_attribute((__malloc__)) lzma_attr_alloc_size(1);
|
||||||
|
|
||||||
/// Frees memory
|
/// Frees memory
|
||||||
extern void lzma_free(void *ptr, lzma_allocator *allocator);
|
extern void lzma_free(void *ptr, const lzma_allocator *allocator);
|
||||||
|
|
||||||
|
|
||||||
/// Allocates strm->internal if it is NULL, and initializes *strm and
|
/// Allocates strm->internal if it is NULL, and initializes *strm and
|
||||||
|
@ -236,17 +236,19 @@ extern lzma_ret lzma_strm_init(lzma_stream *strm);
|
||||||
/// than the filter being initialized now. This way the actual filter
|
/// than the filter being initialized now. This way the actual filter
|
||||||
/// initialization functions don't need to use lzma_next_coder_init macro.
|
/// initialization functions don't need to use lzma_next_coder_init macro.
|
||||||
extern lzma_ret lzma_next_filter_init(lzma_next_coder *next,
|
extern lzma_ret lzma_next_filter_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
/// Update the next filter in the chain, if any. This checks that
|
/// Update the next filter in the chain, if any. This checks that
|
||||||
/// the application is not trying to change the Filter IDs.
|
/// the application is not trying to change the Filter IDs.
|
||||||
extern lzma_ret lzma_next_filter_update(
|
extern lzma_ret lzma_next_filter_update(
|
||||||
lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *reversed_filters);
|
const lzma_filter *reversed_filters);
|
||||||
|
|
||||||
/// Frees the memory allocated for next->coder either using next->end or,
|
/// Frees the memory allocated for next->coder either using next->end or,
|
||||||
/// if next->end is NULL, using lzma_free.
|
/// if next->end is NULL, using lzma_free.
|
||||||
extern void lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator);
|
extern void lzma_next_end(lzma_next_coder *next,
|
||||||
|
const lzma_allocator *allocator);
|
||||||
|
|
||||||
|
|
||||||
/// Copy as much data as possible from in[] to out[] and update *in_pos
|
/// Copy as much data as possible from in[] to out[] and update *in_pos
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_easy_buffer_encode(uint32_t preset, lzma_check check,
|
lzma_easy_buffer_encode(uint32_t preset, lzma_check check,
|
||||||
lzma_allocator *allocator, const uint8_t *in, size_t in_size,
|
const lzma_allocator *allocator, const uint8_t *in,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
{
|
{
|
||||||
lzma_options_easy opt_easy;
|
lzma_options_easy opt_easy;
|
||||||
if (lzma_easy_preset(&opt_easy, preset))
|
if (lzma_easy_preset(&opt_easy, preset))
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_raw_buffer_decode(const lzma_filter *filters, lzma_allocator *allocator,
|
lzma_raw_buffer_decode(
|
||||||
|
const lzma_filter *filters, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,9 +14,10 @@
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_raw_buffer_encode(const lzma_filter *filters, lzma_allocator *allocator,
|
lzma_raw_buffer_encode(
|
||||||
const uint8_t *in, size_t in_size, uint8_t *out,
|
const lzma_filter *filters, const lzma_allocator *allocator,
|
||||||
size_t *out_pos, size_t out_size)
|
const uint8_t *in, size_t in_size,
|
||||||
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
{
|
{
|
||||||
// Validate what isn't validated later in filter_common.c.
|
// Validate what isn't validated later in filter_common.c.
|
||||||
if ((in == NULL && in_size != 0) || out == NULL
|
if ((in == NULL && in_size != 0) || out == NULL
|
||||||
|
|
|
@ -123,7 +123,7 @@ static const struct {
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_filters_copy(const lzma_filter *src, lzma_filter *dest,
|
lzma_filters_copy(const lzma_filter *src, lzma_filter *dest,
|
||||||
lzma_allocator *allocator)
|
const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
if (src == NULL || dest == NULL)
|
if (src == NULL || dest == NULL)
|
||||||
return LZMA_PROG_ERROR;
|
return LZMA_PROG_ERROR;
|
||||||
|
@ -239,7 +239,7 @@ validate_chain(const lzma_filter *filters, size_t *count)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_raw_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *options,
|
const lzma_filter *options,
|
||||||
lzma_filter_find coder_find, bool is_encoder)
|
lzma_filter_find coder_find, bool is_encoder)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ typedef const lzma_filter_coder *(*lzma_filter_find)(lzma_vli id);
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_raw_coder_init(
|
extern lzma_ret lzma_raw_coder_init(
|
||||||
lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters,
|
const lzma_filter *filters,
|
||||||
lzma_filter_find coder_find, bool is_encoder);
|
lzma_filter_find coder_find, bool is_encoder);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ typedef struct {
|
||||||
/// \return - LZMA_OK: Properties decoded successfully.
|
/// \return - LZMA_OK: Properties decoded successfully.
|
||||||
/// - LZMA_OPTIONS_ERROR: Unsupported properties
|
/// - LZMA_OPTIONS_ERROR: Unsupported properties
|
||||||
/// - LZMA_MEM_ERROR: Memory allocation failed.
|
/// - LZMA_MEM_ERROR: Memory allocation failed.
|
||||||
lzma_ret (*props_decode)(void **options, lzma_allocator *allocator,
|
lzma_ret (*props_decode)(
|
||||||
|
void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size);
|
const uint8_t *props, size_t props_size);
|
||||||
|
|
||||||
} lzma_filter_decoder;
|
} lzma_filter_decoder;
|
||||||
|
@ -136,7 +137,7 @@ lzma_filter_decoder_is_supported(lzma_vli id)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_raw_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_raw_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *options)
|
const lzma_filter *options)
|
||||||
{
|
{
|
||||||
return lzma_raw_coder_init(next, allocator,
|
return lzma_raw_coder_init(next, allocator,
|
||||||
|
@ -165,7 +166,7 @@ lzma_raw_decoder_memusage(const lzma_filter *filters)
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_properties_decode(lzma_filter *filter, lzma_allocator *allocator,
|
lzma_properties_decode(lzma_filter *filter, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size)
|
const uint8_t *props, size_t props_size)
|
||||||
{
|
{
|
||||||
// Make it always NULL so that the caller can always safely free() it.
|
// Make it always NULL so that the caller can always safely free() it.
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_raw_decoder_init(
|
extern lzma_ret lzma_raw_decoder_init(
|
||||||
lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *options);
|
const lzma_filter *options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -196,7 +196,7 @@ lzma_filters_update(lzma_stream *strm, const lzma_filter *filters)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_raw_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_raw_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *options)
|
const lzma_filter *options)
|
||||||
{
|
{
|
||||||
return lzma_raw_coder_init(next, allocator,
|
return lzma_raw_coder_init(next, allocator,
|
||||||
|
|
|
@ -21,7 +21,7 @@ extern uint64_t lzma_mt_block_size(const lzma_filter *filters);
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_raw_encoder_init(
|
extern lzma_ret lzma_raw_encoder_init(
|
||||||
lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters);
|
const lzma_filter *filters);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_filter_flags_decode(
|
lzma_filter_flags_decode(
|
||||||
lzma_filter *filter, lzma_allocator *allocator,
|
lzma_filter *filter, const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size)
|
const uint8_t *in, size_t *in_pos, size_t in_size)
|
||||||
{
|
{
|
||||||
// Set the pointer to NULL so the caller can always safely free it.
|
// Set the pointer to NULL so the caller can always safely free it.
|
||||||
|
|
|
@ -191,8 +191,8 @@ index_tree_init(index_tree *tree)
|
||||||
|
|
||||||
/// Helper for index_tree_end()
|
/// Helper for index_tree_end()
|
||||||
static void
|
static void
|
||||||
index_tree_node_end(index_tree_node *node, lzma_allocator *allocator,
|
index_tree_node_end(index_tree_node *node, const lzma_allocator *allocator,
|
||||||
void (*free_func)(void *node, lzma_allocator *allocator))
|
void (*free_func)(void *node, const lzma_allocator *allocator))
|
||||||
{
|
{
|
||||||
// The tree won't ever be very huge, so recursion should be fine.
|
// The tree won't ever be very huge, so recursion should be fine.
|
||||||
// 20 levels in the tree is likely quite a lot already in practice.
|
// 20 levels in the tree is likely quite a lot already in practice.
|
||||||
|
@ -215,8 +215,8 @@ index_tree_node_end(index_tree_node *node, lzma_allocator *allocator,
|
||||||
/// to free the Record groups from each index_stream before freeing
|
/// to free the Record groups from each index_stream before freeing
|
||||||
/// the index_stream itself.
|
/// the index_stream itself.
|
||||||
static void
|
static void
|
||||||
index_tree_end(index_tree *tree, lzma_allocator *allocator,
|
index_tree_end(index_tree *tree, const lzma_allocator *allocator,
|
||||||
void (*free_func)(void *node, lzma_allocator *allocator))
|
void (*free_func)(void *node, const lzma_allocator *allocator))
|
||||||
{
|
{
|
||||||
if (tree->root != NULL)
|
if (tree->root != NULL)
|
||||||
index_tree_node_end(tree->root, allocator, free_func);
|
index_tree_node_end(tree->root, allocator, free_func);
|
||||||
|
@ -340,7 +340,7 @@ index_tree_locate(const index_tree *tree, lzma_vli target)
|
||||||
static index_stream *
|
static index_stream *
|
||||||
index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
|
index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
|
||||||
lzma_vli stream_number, lzma_vli block_number_base,
|
lzma_vli stream_number, lzma_vli block_number_base,
|
||||||
lzma_allocator *allocator)
|
const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
index_stream *s = lzma_alloc(sizeof(index_stream), allocator);
|
index_stream *s = lzma_alloc(sizeof(index_stream), allocator);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
|
@ -368,7 +368,7 @@ index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
|
||||||
|
|
||||||
/// Free the memory allocated for a Stream and its Record groups.
|
/// Free the memory allocated for a Stream and its Record groups.
|
||||||
static void
|
static void
|
||||||
index_stream_end(void *node, lzma_allocator *allocator)
|
index_stream_end(void *node, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
index_stream *s = node;
|
index_stream *s = node;
|
||||||
index_tree_end(&s->groups, allocator, NULL);
|
index_tree_end(&s->groups, allocator, NULL);
|
||||||
|
@ -377,7 +377,7 @@ index_stream_end(void *node, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_index *
|
static lzma_index *
|
||||||
index_init_plain(lzma_allocator *allocator)
|
index_init_plain(const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_index *i = lzma_alloc(sizeof(lzma_index), allocator);
|
lzma_index *i = lzma_alloc(sizeof(lzma_index), allocator);
|
||||||
if (i != NULL) {
|
if (i != NULL) {
|
||||||
|
@ -395,7 +395,7 @@ index_init_plain(lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_index *)
|
extern LZMA_API(lzma_index *)
|
||||||
lzma_index_init(lzma_allocator *allocator)
|
lzma_index_init(const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_index *i = index_init_plain(allocator);
|
lzma_index *i = index_init_plain(allocator);
|
||||||
if (i == NULL)
|
if (i == NULL)
|
||||||
|
@ -414,7 +414,7 @@ lzma_index_init(lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(void)
|
extern LZMA_API(void)
|
||||||
lzma_index_end(lzma_index *i, lzma_allocator *allocator)
|
lzma_index_end(lzma_index *i, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// NOTE: If you modify this function, check also the bottom
|
// NOTE: If you modify this function, check also the bottom
|
||||||
// of lzma_index_cat().
|
// of lzma_index_cat().
|
||||||
|
@ -637,7 +637,7 @@ lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding)
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_index_append(lzma_index *i, lzma_allocator *allocator,
|
lzma_index_append(lzma_index *i, const lzma_allocator *allocator,
|
||||||
lzma_vli unpadded_size, lzma_vli uncompressed_size)
|
lzma_vli unpadded_size, lzma_vli uncompressed_size)
|
||||||
{
|
{
|
||||||
// Validate.
|
// Validate.
|
||||||
|
@ -765,7 +765,7 @@ index_cat_helper(const index_cat_info *info, index_stream *this)
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
|
lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
|
||||||
lzma_allocator *allocator)
|
const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
const lzma_vli dest_file_size = lzma_index_file_size(dest);
|
const lzma_vli dest_file_size = lzma_index_file_size(dest);
|
||||||
|
|
||||||
|
@ -859,7 +859,7 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
|
||||||
|
|
||||||
/// Duplicate an index_stream.
|
/// Duplicate an index_stream.
|
||||||
static index_stream *
|
static index_stream *
|
||||||
index_dup_stream(const index_stream *src, lzma_allocator *allocator)
|
index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// Catch a somewhat theoretical integer overflow.
|
// Catch a somewhat theoretical integer overflow.
|
||||||
if (src->record_count > PREALLOC_MAX)
|
if (src->record_count > PREALLOC_MAX)
|
||||||
|
@ -919,7 +919,7 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_index *)
|
extern LZMA_API(lzma_index *)
|
||||||
lzma_index_dup(const lzma_index *src, lzma_allocator *allocator)
|
lzma_index_dup(const lzma_index *src, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// Allocate the base structure (no initial Stream).
|
// Allocate the base structure (no initial Stream).
|
||||||
lzma_index *dest = index_init_plain(allocator);
|
lzma_index *dest = index_init_plain(allocator);
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
index_decode(lzma_coder *coder, lzma_allocator *allocator,
|
index_decode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size,
|
size_t in_size,
|
||||||
uint8_t *restrict out lzma_attribute((__unused__)),
|
uint8_t *restrict out lzma_attribute((__unused__)),
|
||||||
|
@ -207,7 +207,7 @@ out:
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
index_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
index_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_index_end(coder->index, allocator);
|
lzma_index_end(coder->index, allocator);
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
|
@ -234,7 +234,7 @@ index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator,
|
index_decoder_reset(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
lzma_index **i, uint64_t memlimit)
|
lzma_index **i, uint64_t memlimit)
|
||||||
{
|
{
|
||||||
// Remember the pointer given by the application. We will set it
|
// Remember the pointer given by the application. We will set it
|
||||||
|
@ -261,7 +261,7 @@ index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
index_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
index_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
lzma_index **i, uint64_t memlimit)
|
lzma_index **i, uint64_t memlimit)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&index_decoder_init, next, allocator);
|
lzma_next_coder_init(&index_decoder_init, next, allocator);
|
||||||
|
@ -299,8 +299,8 @@ lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_index_buffer_decode(
|
lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit,
|
||||||
lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator,
|
const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size)
|
const uint8_t *in, size_t *in_pos, size_t in_size)
|
||||||
{
|
{
|
||||||
// Sanity checks
|
// Sanity checks
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
index_encode(lzma_coder *coder,
|
index_encode(lzma_coder *coder,
|
||||||
lzma_allocator *allocator lzma_attribute((__unused__)),
|
const lzma_allocator *allocator lzma_attribute((__unused__)),
|
||||||
const uint8_t *restrict in lzma_attribute((__unused__)),
|
const uint8_t *restrict in lzma_attribute((__unused__)),
|
||||||
size_t *restrict in_pos lzma_attribute((__unused__)),
|
size_t *restrict in_pos lzma_attribute((__unused__)),
|
||||||
size_t in_size lzma_attribute((__unused__)),
|
size_t in_size lzma_attribute((__unused__)),
|
||||||
|
@ -159,7 +159,7 @@ out:
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
index_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
index_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
return;
|
return;
|
||||||
|
@ -181,7 +181,7 @@ index_encoder_reset(lzma_coder *coder, const lzma_index *i)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_index_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_index *i)
|
const lzma_index *i)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&lzma_index_encoder_init, next, allocator);
|
lzma_next_coder_init(&lzma_index_encoder_init, next, allocator);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_index_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_index_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_index *i);
|
const lzma_allocator *allocator, const lzma_index *i);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -70,7 +70,8 @@ struct lzma_index_hash_s {
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(lzma_index_hash *)
|
extern LZMA_API(lzma_index_hash *)
|
||||||
lzma_index_hash_init(lzma_index_hash *index_hash, lzma_allocator *allocator)
|
lzma_index_hash_init(lzma_index_hash *index_hash,
|
||||||
|
const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
if (index_hash == NULL) {
|
if (index_hash == NULL) {
|
||||||
index_hash = lzma_alloc(sizeof(lzma_index_hash), allocator);
|
index_hash = lzma_alloc(sizeof(lzma_index_hash), allocator);
|
||||||
|
@ -101,7 +102,8 @@ lzma_index_hash_init(lzma_index_hash *index_hash, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
extern LZMA_API(void)
|
extern LZMA_API(void)
|
||||||
lzma_index_hash_end(lzma_index_hash *index_hash, lzma_allocator *allocator)
|
lzma_index_hash_end(lzma_index_hash *index_hash,
|
||||||
|
const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_free(index_hash, allocator);
|
lzma_free(index_hash, allocator);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -54,7 +54,7 @@ lzma_outq_memusage(uint64_t buf_size_max, uint32_t threads)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_outq_init(lzma_outq *outq, lzma_allocator *allocator,
|
lzma_outq_init(lzma_outq *outq, const lzma_allocator *allocator,
|
||||||
uint64_t buf_size_max, uint32_t threads)
|
uint64_t buf_size_max, uint32_t threads)
|
||||||
{
|
{
|
||||||
uint64_t bufs_alloc_size;
|
uint64_t bufs_alloc_size;
|
||||||
|
@ -98,7 +98,7 @@ lzma_outq_init(lzma_outq *outq, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
lzma_outq_end(lzma_outq *outq, lzma_allocator *allocator)
|
lzma_outq_end(lzma_outq *outq, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_free(outq->bufs, allocator);
|
lzma_free(outq->bufs, allocator);
|
||||||
outq->bufs = NULL;
|
outq->bufs = NULL;
|
||||||
|
|
|
@ -87,12 +87,13 @@ extern uint64_t lzma_outq_memusage(uint64_t buf_size_max, uint32_t threads);
|
||||||
/// \return - LZMA_OK
|
/// \return - LZMA_OK
|
||||||
/// - LZMA_MEM_ERROR
|
/// - LZMA_MEM_ERROR
|
||||||
///
|
///
|
||||||
extern lzma_ret lzma_outq_init(lzma_outq *outq, lzma_allocator *allocator,
|
extern lzma_ret lzma_outq_init(
|
||||||
|
lzma_outq *outq, const lzma_allocator *allocator,
|
||||||
uint64_t buf_size_max, uint32_t threads);
|
uint64_t buf_size_max, uint32_t threads);
|
||||||
|
|
||||||
|
|
||||||
/// \brief Free the memory associated with the output queue
|
/// \brief Free the memory associated with the output queue
|
||||||
extern void lzma_outq_end(lzma_outq *outq, lzma_allocator *allocator);
|
extern void lzma_outq_end(lzma_outq *outq, const lzma_allocator *allocator);
|
||||||
|
|
||||||
|
|
||||||
/// \brief Get a new buffer
|
/// \brief Get a new buffer
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags,
|
lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags,
|
||||||
lzma_allocator *allocator,
|
const lzma_allocator *allocator,
|
||||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,8 @@ lzma_stream_buffer_bound(size_t uncompressed_size)
|
||||||
|
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
|
lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
|
||||||
lzma_allocator *allocator, const uint8_t *in, size_t in_size,
|
const lzma_allocator *allocator,
|
||||||
|
const uint8_t *in, size_t in_size,
|
||||||
uint8_t *out, size_t *out_pos_ptr, size_t out_size)
|
uint8_t *out, size_t *out_pos_ptr, size_t out_size)
|
||||||
{
|
{
|
||||||
// Sanity checks
|
// Sanity checks
|
||||||
|
|
|
@ -80,7 +80,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
stream_decoder_reset(lzma_coder *coder, lzma_allocator *allocator)
|
stream_decoder_reset(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// Initialize the Index hash used to verify the Index.
|
// Initialize the Index hash used to verify the Index.
|
||||||
coder->index_hash = lzma_index_hash_init(coder->index_hash, allocator);
|
coder->index_hash = lzma_index_hash_init(coder->index_hash, allocator);
|
||||||
|
@ -96,7 +96,7 @@ stream_decoder_reset(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
stream_decode(lzma_coder *coder, lzma_allocator *allocator,
|
stream_decode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -366,7 +366,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stream_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
stream_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->block_decoder, allocator);
|
lzma_next_end(&coder->block_decoder, allocator);
|
||||||
lzma_index_hash_end(coder->index_hash, allocator);
|
lzma_index_hash_end(coder->index_hash, allocator);
|
||||||
|
@ -401,7 +401,8 @@ stream_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_stream_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_stream_decoder_init(
|
||||||
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
uint64_t memlimit, uint32_t flags)
|
uint64_t memlimit, uint32_t flags)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&lzma_stream_decoder_init, next, allocator);
|
lzma_next_coder_init(&lzma_stream_decoder_init, next, allocator);
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
extern lzma_ret lzma_stream_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_stream_decoder_init(
|
||||||
lzma_allocator *allocator, uint64_t memlimit, uint32_t flags);
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
|
uint64_t memlimit, uint32_t flags);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
block_encoder_init(lzma_coder *coder, lzma_allocator *allocator)
|
block_encoder_init(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// Prepare the Block options. Even though Block encoder doesn't need
|
// Prepare the Block options. Even though Block encoder doesn't need
|
||||||
// compressed_size, uncompressed_size, and header_size to be
|
// compressed_size, uncompressed_size, and header_size to be
|
||||||
|
@ -78,7 +78,7 @@ block_encoder_init(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
stream_encode(lzma_coder *coder, lzma_allocator *allocator,
|
stream_encode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -208,7 +208,7 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stream_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
stream_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->block_encoder, allocator);
|
lzma_next_end(&coder->block_encoder, allocator);
|
||||||
lzma_next_end(&coder->index_encoder, allocator);
|
lzma_next_end(&coder->index_encoder, allocator);
|
||||||
|
@ -223,7 +223,7 @@ stream_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
stream_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters,
|
const lzma_filter *filters,
|
||||||
const lzma_filter *reversed_filters)
|
const lzma_filter *reversed_filters)
|
||||||
{
|
{
|
||||||
|
@ -262,7 +262,7 @@ stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
stream_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters, lzma_check check)
|
const lzma_filter *filters, lzma_check check)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&stream_encoder_init, next, allocator);
|
lzma_next_coder_init(&stream_encoder_init, next, allocator);
|
||||||
|
|
|
@ -69,7 +69,7 @@ struct worker_thread_s {
|
||||||
/// The allocator is set by the main thread. Since a copy of the
|
/// The allocator is set by the main thread. Since a copy of the
|
||||||
/// pointer is kept here, the application must not change the
|
/// pointer is kept here, the application must not change the
|
||||||
/// allocator before calling lzma_end().
|
/// allocator before calling lzma_end().
|
||||||
lzma_allocator *allocator;
|
const lzma_allocator *allocator;
|
||||||
|
|
||||||
/// Block encoder
|
/// Block encoder
|
||||||
lzma_next_coder block_encoder;
|
lzma_next_coder block_encoder;
|
||||||
|
@ -378,7 +378,7 @@ threads_stop(lzma_coder *coder, bool wait)
|
||||||
/// Stop the threads and free the resources associated with them.
|
/// Stop the threads and free the resources associated with them.
|
||||||
/// Wait until the threads have exited.
|
/// Wait until the threads have exited.
|
||||||
static void
|
static void
|
||||||
threads_end(lzma_coder *coder, lzma_allocator *allocator)
|
threads_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
|
for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
|
||||||
mythread_sync(coder->threads[i].mutex) {
|
mythread_sync(coder->threads[i].mutex) {
|
||||||
|
@ -400,7 +400,7 @@ threads_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
/// Initialize a new worker_thread structure and create a new thread.
|
/// Initialize a new worker_thread structure and create a new thread.
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
initialize_new_thread(lzma_coder *coder, lzma_allocator *allocator)
|
initialize_new_thread(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
worker_thread *thr = &coder->threads[coder->threads_initialized];
|
worker_thread *thr = &coder->threads[coder->threads_initialized];
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ error_mutex:
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
get_thread(lzma_coder *coder, lzma_allocator *allocator)
|
get_thread(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// If there are no free output subqueues, there is no
|
// If there are no free output subqueues, there is no
|
||||||
// point to try getting a thread.
|
// point to try getting a thread.
|
||||||
|
@ -478,7 +478,7 @@ get_thread(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
stream_encode_in(lzma_coder *coder, lzma_allocator *allocator,
|
stream_encode_in(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, lzma_action action)
|
size_t in_size, lzma_action action)
|
||||||
{
|
{
|
||||||
|
@ -593,7 +593,7 @@ wait_for_work(lzma_coder *coder, struct timespec *wait_abs,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
stream_encode_mt(lzma_coder *coder, lzma_allocator *allocator,
|
stream_encode_mt(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -735,7 +735,7 @@ stream_encode_mt(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stream_encoder_mt_end(lzma_coder *coder, lzma_allocator *allocator)
|
stream_encoder_mt_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
// Threads must be killed before the output queue can be freed.
|
// Threads must be killed before the output queue can be freed.
|
||||||
threads_end(coder, allocator);
|
threads_end(coder, allocator);
|
||||||
|
@ -811,7 +811,7 @@ get_options(const lzma_mt *options, lzma_options_easy *opt_easy,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
stream_encoder_mt_init(lzma_next_coder *next, lzma_allocator *allocator,
|
stream_encoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_mt *options)
|
const lzma_mt *options)
|
||||||
{
|
{
|
||||||
lzma_next_coder_init(&stream_encoder_mt_init, next, allocator);
|
lzma_next_coder_init(&stream_encoder_mt_init, next, allocator);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
delta_coder_end(lzma_coder *coder, lzma_allocator *allocator)
|
delta_coder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
|
@ -24,7 +24,7 @@ delta_coder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_delta_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
// Allocate memory for the decoder if needed.
|
// Allocate memory for the decoder if needed.
|
||||||
|
|
|
@ -27,7 +27,7 @@ decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
delta_decode(lzma_coder *coder, lzma_allocator *allocator,
|
delta_decode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -47,7 +47,7 @@ delta_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_delta_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_delta_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
next->code = &delta_decode;
|
next->code = &delta_decode;
|
||||||
|
@ -56,7 +56,7 @@ lzma_delta_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_delta_props_decode(void **options, lzma_allocator *allocator,
|
lzma_delta_props_decode(void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size)
|
const uint8_t *props, size_t props_size)
|
||||||
{
|
{
|
||||||
if (props_size != 1)
|
if (props_size != 1)
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
#include "delta_common.h"
|
#include "delta_common.h"
|
||||||
|
|
||||||
extern lzma_ret lzma_delta_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_delta_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern lzma_ret lzma_delta_props_decode(
|
extern lzma_ret lzma_delta_props_decode(
|
||||||
void **options, lzma_allocator *allocator,
|
void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size);
|
const uint8_t *props, size_t props_size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,7 @@ encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
delta_encode(lzma_coder *coder, lzma_allocator *allocator,
|
delta_encode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -84,7 +84,7 @@ delta_encode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
delta_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
delta_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters_null lzma_attribute((__unused__)),
|
const lzma_filter *filters_null lzma_attribute((__unused__)),
|
||||||
const lzma_filter *reversed_filters)
|
const lzma_filter *reversed_filters)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ delta_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_delta_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
next->code = &delta_encode;
|
next->code = &delta_encode;
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
#include "delta_common.h"
|
#include "delta_common.h"
|
||||||
|
|
||||||
extern lzma_ret lzma_delta_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_delta_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern lzma_ret lzma_delta_props_encode(const void *options, uint8_t *out);
|
extern lzma_ret lzma_delta_props_encode(const void *options, uint8_t *out);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_delta_coder_init(
|
extern lzma_ret lzma_delta_coder_init(
|
||||||
lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters);
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -126,7 +126,7 @@ decode_buffer(lzma_coder *coder,
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
lz_decode(lzma_coder *coder,
|
lz_decode(lzma_coder *coder,
|
||||||
lzma_allocator *allocator lzma_attribute((__unused__)),
|
const lzma_allocator *allocator lzma_attribute((__unused__)),
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size,
|
size_t *restrict out_pos, size_t out_size,
|
||||||
|
@ -184,7 +184,7 @@ lz_decode(lzma_coder *coder,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lz_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
lz_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
lzma_free(coder->dict.buf, allocator);
|
lzma_free(coder->dict.buf, allocator);
|
||||||
|
@ -200,10 +200,10 @@ lz_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters,
|
const lzma_filter_info *filters,
|
||||||
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
|
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
|
||||||
lzma_allocator *allocator, const void *options,
|
const lzma_allocator *allocator, const void *options,
|
||||||
lzma_lz_options *lz_options))
|
lzma_lz_options *lz_options))
|
||||||
{
|
{
|
||||||
// Allocate the base structure if it isn't already allocated.
|
// Allocate the base structure if it isn't already allocated.
|
||||||
|
|
|
@ -67,7 +67,7 @@ typedef struct {
|
||||||
lzma_vli uncompressed_size);
|
lzma_vli uncompressed_size);
|
||||||
|
|
||||||
/// Free allocated resources
|
/// Free allocated resources
|
||||||
void (*end)(lzma_coder *coder, lzma_allocator *allocator);
|
void (*end)(lzma_coder *coder, const lzma_allocator *allocator);
|
||||||
|
|
||||||
} lzma_lz_decoder;
|
} lzma_lz_decoder;
|
||||||
|
|
||||||
|
@ -83,9 +83,10 @@ typedef struct {
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters,
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters,
|
||||||
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
|
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
|
||||||
lzma_allocator *allocator, const void *options,
|
const lzma_allocator *allocator, const void *options,
|
||||||
lzma_lz_options *lz_options));
|
lzma_lz_options *lz_options));
|
||||||
|
|
||||||
extern uint64_t lzma_lz_decoder_memusage(size_t dictionary_size);
|
extern uint64_t lzma_lz_decoder_memusage(size_t dictionary_size);
|
||||||
|
|
|
@ -76,8 +76,9 @@ move_window(lzma_mf *mf)
|
||||||
/// This function must not be called once it has returned LZMA_STREAM_END.
|
/// This function must not be called once it has returned LZMA_STREAM_END.
|
||||||
///
|
///
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
|
fill_window(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
size_t *in_pos, size_t in_size, lzma_action action)
|
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||||
|
lzma_action action)
|
||||||
{
|
{
|
||||||
assert(coder->mf.read_pos <= coder->mf.write_pos);
|
assert(coder->mf.read_pos <= coder->mf.write_pos);
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
lz_encode(lzma_coder *coder, lzma_allocator *allocator,
|
lz_encode(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size,
|
size_t in_size,
|
||||||
uint8_t *restrict out, size_t *restrict out_pos,
|
uint8_t *restrict out, size_t *restrict out_pos,
|
||||||
|
@ -179,7 +180,7 @@ lz_encode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
|
lz_encoder_prepare(lzma_mf *mf, const lzma_allocator *allocator,
|
||||||
const lzma_lz_options *lz_options)
|
const lzma_lz_options *lz_options)
|
||||||
{
|
{
|
||||||
// For now, the dictionary size is limited to 1.5 GiB. This may grow
|
// For now, the dictionary size is limited to 1.5 GiB. This may grow
|
||||||
|
@ -360,7 +361,7 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator,
|
lz_encoder_init(lzma_mf *mf, const lzma_allocator *allocator,
|
||||||
const lzma_lz_options *lz_options)
|
const lzma_lz_options *lz_options)
|
||||||
{
|
{
|
||||||
// Allocate the history buffer.
|
// Allocate the history buffer.
|
||||||
|
@ -461,7 +462,7 @@ lzma_lz_encoder_memusage(const lzma_lz_options *lz_options)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lz_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
lz_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
|
|
||||||
|
@ -479,7 +480,7 @@ lz_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
lz_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
lz_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters_null lzma_attribute((__unused__)),
|
const lzma_filter *filters_null lzma_attribute((__unused__)),
|
||||||
const lzma_filter *reversed_filters)
|
const lzma_filter *reversed_filters)
|
||||||
{
|
{
|
||||||
|
@ -495,10 +496,10 @@ lz_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_lz_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters,
|
const lzma_filter_info *filters,
|
||||||
lzma_ret (*lz_init)(lzma_lz_encoder *lz,
|
lzma_ret (*lz_init)(lzma_lz_encoder *lz,
|
||||||
lzma_allocator *allocator, const void *options,
|
const lzma_allocator *allocator, const void *options,
|
||||||
lzma_lz_options *lz_options))
|
lzma_lz_options *lz_options))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SMALL
|
#ifdef HAVE_SMALL
|
||||||
|
|
|
@ -199,7 +199,7 @@ typedef struct {
|
||||||
size_t *restrict out_pos, size_t out_size);
|
size_t *restrict out_pos, size_t out_size);
|
||||||
|
|
||||||
/// Free allocated resources
|
/// Free allocated resources
|
||||||
void (*end)(lzma_coder *coder, lzma_allocator *allocator);
|
void (*end)(lzma_coder *coder, const lzma_allocator *allocator);
|
||||||
|
|
||||||
/// Update the options in the middle of the encoding.
|
/// Update the options in the middle of the encoding.
|
||||||
lzma_ret (*options_update)(lzma_coder *coder,
|
lzma_ret (*options_update)(lzma_coder *coder,
|
||||||
|
@ -296,10 +296,10 @@ mf_read(lzma_mf *mf, uint8_t *out, size_t *out_pos, size_t out_size,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_lz_encoder_init(
|
extern lzma_ret lzma_lz_encoder_init(
|
||||||
lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters,
|
const lzma_filter_info *filters,
|
||||||
lzma_ret (*lz_init)(lzma_lz_encoder *lz,
|
lzma_ret (*lz_init)(lzma_lz_encoder *lz,
|
||||||
lzma_allocator *allocator, const void *options,
|
const lzma_allocator *allocator, const void *options,
|
||||||
lzma_lz_options *lz_options));
|
lzma_lz_options *lz_options));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lzma2_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
lzma2_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
assert(coder->lzma.end == NULL);
|
assert(coder->lzma.end == NULL);
|
||||||
lzma_free(coder->lzma.coder, allocator);
|
lzma_free(coder->lzma.coder, allocator);
|
||||||
|
@ -221,7 +221,7 @@ lzma2_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator,
|
lzma2_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
|
||||||
const void *opt, lzma_lz_options *lz_options)
|
const void *opt, lzma_lz_options *lz_options)
|
||||||
{
|
{
|
||||||
if (lz->coder == NULL) {
|
if (lz->coder == NULL) {
|
||||||
|
@ -248,7 +248,7 @@ lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lzma2_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_lzma2_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
// LZMA2 can only be the last filter in the chain. This is enforced
|
// LZMA2 can only be the last filter in the chain. This is enforced
|
||||||
|
@ -269,7 +269,7 @@ lzma_lzma2_decoder_memusage(const void *options)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lzma2_props_decode(void **options, lzma_allocator *allocator,
|
lzma_lzma2_props_decode(void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size)
|
const uint8_t *props, size_t props_size)
|
||||||
{
|
{
|
||||||
if (props_size != 1)
|
if (props_size != 1)
|
||||||
|
|
|
@ -17,12 +17,13 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
extern lzma_ret lzma_lzma2_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_lzma2_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern uint64_t lzma_lzma2_decoder_memusage(const void *options);
|
extern uint64_t lzma_lzma2_decoder_memusage(const void *options);
|
||||||
|
|
||||||
extern lzma_ret lzma_lzma2_props_decode(
|
extern lzma_ret lzma_lzma2_props_decode(
|
||||||
void **options, lzma_allocator *allocator,
|
void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size);
|
const uint8_t *props, size_t props_size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -262,7 +262,7 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lzma2_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
lzma2_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_free(coder->lzma, allocator);
|
lzma_free(coder->lzma, allocator);
|
||||||
lzma_free(coder, allocator);
|
lzma_free(coder, allocator);
|
||||||
|
@ -304,7 +304,7 @@ lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
lzma2_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
|
lzma2_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
|
||||||
const void *options, lzma_lz_options *lz_options)
|
const void *options, lzma_lz_options *lz_options)
|
||||||
{
|
{
|
||||||
if (options == NULL)
|
if (options == NULL)
|
||||||
|
@ -349,7 +349,7 @@ lzma2_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lzma2_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_lzma2_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return lzma_lz_encoder_init(
|
return lzma_lz_encoder_init(
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_lzma2_encoder_init(
|
extern lzma_ret lzma_lzma2_encoder_init(
|
||||||
lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters);
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern uint64_t lzma_lzma2_encoder_memusage(const void *options);
|
extern uint64_t lzma_lzma2_encoder_memusage(const void *options);
|
||||||
|
|
|
@ -937,7 +937,7 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator,
|
lzma_lzma_decoder_create(lzma_lz_decoder *lz, const lzma_allocator *allocator,
|
||||||
const void *opt, lzma_lz_options *lz_options)
|
const void *opt, lzma_lz_options *lz_options)
|
||||||
{
|
{
|
||||||
if (lz->coder == NULL) {
|
if (lz->coder == NULL) {
|
||||||
|
@ -965,7 +965,7 @@ lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator,
|
||||||
/// initialization (lzma_lzma_decoder_init() passes function pointer to
|
/// initialization (lzma_lzma_decoder_init() passes function pointer to
|
||||||
/// the LZ initialization).
|
/// the LZ initialization).
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
lzma_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator,
|
lzma_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
|
||||||
const void *options, lzma_lz_options *lz_options)
|
const void *options, lzma_lz_options *lz_options)
|
||||||
{
|
{
|
||||||
if (!is_lclppb_valid(options))
|
if (!is_lclppb_valid(options))
|
||||||
|
@ -982,7 +982,7 @@ lzma_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lzma_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_lzma_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
// LZMA can only be the last filter in the chain. This is enforced
|
// LZMA can only be the last filter in the chain. This is enforced
|
||||||
|
@ -1029,7 +1029,7 @@ lzma_lzma_decoder_memusage(const void *options)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lzma_props_decode(void **options, lzma_allocator *allocator,
|
lzma_lzma_props_decode(void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size)
|
const uint8_t *props, size_t props_size)
|
||||||
{
|
{
|
||||||
if (props_size != 5)
|
if (props_size != 5)
|
||||||
|
|
|
@ -19,12 +19,13 @@
|
||||||
|
|
||||||
/// Allocates and initializes LZMA decoder
|
/// Allocates and initializes LZMA decoder
|
||||||
extern lzma_ret lzma_lzma_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_lzma_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern uint64_t lzma_lzma_decoder_memusage(const void *options);
|
extern uint64_t lzma_lzma_decoder_memusage(const void *options);
|
||||||
|
|
||||||
extern lzma_ret lzma_lzma_props_decode(
|
extern lzma_ret lzma_lzma_props_decode(
|
||||||
void **options, lzma_allocator *allocator,
|
void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size);
|
const uint8_t *props, size_t props_size);
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ extern bool lzma_lzma_lclppb_decode(
|
||||||
/// Allocate and setup function pointers only. This is used by LZMA1 and
|
/// Allocate and setup function pointers only. This is used by LZMA1 and
|
||||||
/// LZMA2 decoders.
|
/// LZMA2 decoders.
|
||||||
extern lzma_ret lzma_lzma_decoder_create(
|
extern lzma_ret lzma_lzma_decoder_create(
|
||||||
lzma_lz_decoder *lz, lzma_allocator *allocator,
|
lzma_lz_decoder *lz, const lzma_allocator *allocator,
|
||||||
const void *opt, lzma_lz_options *lz_options);
|
const void *opt, lzma_lz_options *lz_options);
|
||||||
|
|
||||||
/// Gets memory usage without validating lc/lp/pb. This is used by LZMA2
|
/// Gets memory usage without validating lc/lp/pb. This is used by LZMA2
|
||||||
|
|
|
@ -545,7 +545,8 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator,
|
lzma_lzma_encoder_create(lzma_coder **coder_ptr,
|
||||||
|
const lzma_allocator *allocator,
|
||||||
const lzma_options_lzma *options, lzma_lz_options *lz_options)
|
const lzma_options_lzma *options, lzma_lz_options *lz_options)
|
||||||
{
|
{
|
||||||
// Allocate lzma_coder if it wasn't already allocated.
|
// Allocate lzma_coder if it wasn't already allocated.
|
||||||
|
@ -604,7 +605,7 @@ lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
lzma_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
|
lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
|
||||||
const void *options, lzma_lz_options *lz_options)
|
const void *options, lzma_lz_options *lz_options)
|
||||||
{
|
{
|
||||||
lz->code = &lzma_encode;
|
lz->code = &lzma_encode;
|
||||||
|
@ -614,7 +615,7 @@ lzma_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_lzma_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_lzma_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return lzma_lz_encoder_init(
|
return lzma_lz_encoder_init(
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_lzma_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_lzma_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
|
|
||||||
extern uint64_t lzma_lzma_encoder_memusage(const void *options);
|
extern uint64_t lzma_lzma_encoder_memusage(const void *options);
|
||||||
|
@ -35,7 +36,7 @@ extern bool lzma_lzma_lclppb_encode(
|
||||||
|
|
||||||
/// Initializes raw LZMA encoder; this is used by LZMA2.
|
/// Initializes raw LZMA encoder; this is used by LZMA2.
|
||||||
extern lzma_ret lzma_lzma_encoder_create(
|
extern lzma_ret lzma_lzma_encoder_create(
|
||||||
lzma_coder **coder_ptr, lzma_allocator *allocator,
|
lzma_coder **coder_ptr, const lzma_allocator *allocator,
|
||||||
const lzma_options_lzma *options, lzma_lz_options *lz_options);
|
const lzma_options_lzma *options, lzma_lz_options *lz_options);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ arm_code(lzma_simple *simple lzma_attribute((__unused__)),
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
arm_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
arm_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters, bool is_encoder)
|
const lzma_filter_info *filters, bool is_encoder)
|
||||||
{
|
{
|
||||||
return lzma_simple_coder_init(next, allocator, filters,
|
return lzma_simple_coder_init(next, allocator, filters,
|
||||||
|
@ -54,7 +54,8 @@ arm_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_arm_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_simple_arm_encoder_init(lzma_next_coder *next,
|
||||||
|
const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return arm_coder_init(next, allocator, filters, true);
|
return arm_coder_init(next, allocator, filters, true);
|
||||||
|
@ -62,7 +63,8 @@ lzma_simple_arm_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_arm_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_simple_arm_decoder_init(lzma_next_coder *next,
|
||||||
|
const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return arm_coder_init(next, allocator, filters, false);
|
return arm_coder_init(next, allocator, filters, false);
|
||||||
|
|
|
@ -50,7 +50,7 @@ armthumb_code(lzma_simple *simple lzma_attribute((__unused__)),
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
armthumb_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
armthumb_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters, bool is_encoder)
|
const lzma_filter_info *filters, bool is_encoder)
|
||||||
{
|
{
|
||||||
return lzma_simple_coder_init(next, allocator, filters,
|
return lzma_simple_coder_init(next, allocator, filters,
|
||||||
|
@ -60,7 +60,8 @@ armthumb_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
|
lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters)
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return armthumb_coder_init(next, allocator, filters, true);
|
return armthumb_coder_init(next, allocator, filters, true);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,8 @@ lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_armthumb_decoder_init(lzma_next_coder *next,
|
lzma_simple_armthumb_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters)
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return armthumb_coder_init(next, allocator, filters, false);
|
return armthumb_coder_init(next, allocator, filters, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ ia64_code(lzma_simple *simple lzma_attribute((__unused__)),
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
ia64_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
ia64_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters, bool is_encoder)
|
const lzma_filter_info *filters, bool is_encoder)
|
||||||
{
|
{
|
||||||
return lzma_simple_coder_init(next, allocator, filters,
|
return lzma_simple_coder_init(next, allocator, filters,
|
||||||
|
@ -96,7 +96,8 @@ ia64_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_ia64_encoder_init(lzma_next_coder *next,
|
lzma_simple_ia64_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters)
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return ia64_coder_init(next, allocator, filters, true);
|
return ia64_coder_init(next, allocator, filters, true);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +105,8 @@ lzma_simple_ia64_encoder_init(lzma_next_coder *next,
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_ia64_decoder_init(lzma_next_coder *next,
|
lzma_simple_ia64_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters)
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return ia64_coder_init(next, allocator, filters, false);
|
return ia64_coder_init(next, allocator, filters, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ powerpc_code(lzma_simple *simple lzma_attribute((__unused__)),
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
powerpc_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
powerpc_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters, bool is_encoder)
|
const lzma_filter_info *filters, bool is_encoder)
|
||||||
{
|
{
|
||||||
return lzma_simple_coder_init(next, allocator, filters,
|
return lzma_simple_coder_init(next, allocator, filters,
|
||||||
|
@ -59,7 +59,8 @@ powerpc_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
|
lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters)
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return powerpc_coder_init(next, allocator, filters, true);
|
return powerpc_coder_init(next, allocator, filters, true);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +68,8 @@ lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_powerpc_decoder_init(lzma_next_coder *next,
|
lzma_simple_powerpc_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters)
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return powerpc_coder_init(next, allocator, filters, false);
|
return powerpc_coder_init(next, allocator, filters, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
/// Copied or encodes/decodes more data to out[].
|
/// Copied or encodes/decodes more data to out[].
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
copy_or_code(lzma_coder *coder, lzma_allocator *allocator,
|
copy_or_code(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -66,7 +66,7 @@ call_filter(lzma_coder *coder, uint8_t *buffer, size_t size)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
simple_code(lzma_coder *coder, lzma_allocator *allocator,
|
simple_code(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
size_t in_size, uint8_t *restrict out,
|
size_t in_size, uint8_t *restrict out,
|
||||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||||
|
@ -198,7 +198,7 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
simple_coder_end(lzma_coder *coder, lzma_allocator *allocator)
|
simple_coder_end(lzma_coder *coder, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
lzma_next_end(&coder->next, allocator);
|
lzma_next_end(&coder->next, allocator);
|
||||||
lzma_free(coder->simple, allocator);
|
lzma_free(coder->simple, allocator);
|
||||||
|
@ -208,7 +208,7 @@ simple_coder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
simple_coder_update(lzma_coder *coder, lzma_allocator *allocator,
|
simple_coder_update(lzma_coder *coder, const lzma_allocator *allocator,
|
||||||
const lzma_filter *filters_null lzma_attribute((__unused__)),
|
const lzma_filter *filters_null lzma_attribute((__unused__)),
|
||||||
const lzma_filter *reversed_filters)
|
const lzma_filter *reversed_filters)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,7 @@ simple_coder_update(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_simple_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters,
|
const lzma_filter_info *filters,
|
||||||
size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
|
size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
|
||||||
bool is_encoder, uint8_t *buffer, size_t size),
|
bool is_encoder, uint8_t *buffer, size_t size),
|
||||||
|
|
|
@ -17,44 +17,56 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_x86_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_x86_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_x86_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_x86_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_powerpc_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_powerpc_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_ia64_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_ia64_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_ia64_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_ia64_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_arm_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_arm_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_arm_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_arm_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_armthumb_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_armthumb_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_sparc_encoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_sparc_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_sparc_decoder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_sparc_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_props_decode(void **options, lzma_allocator *allocator,
|
lzma_simple_props_decode(void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size)
|
const uint8_t *props, size_t props_size)
|
||||||
{
|
{
|
||||||
if (props_size == 0)
|
if (props_size == 0)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "simple_coder.h"
|
#include "simple_coder.h"
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_props_decode(
|
extern lzma_ret lzma_simple_props_decode(
|
||||||
void **options, lzma_allocator *allocator,
|
void **options, const lzma_allocator *allocator,
|
||||||
const uint8_t *props, size_t props_size);
|
const uint8_t *props, size_t props_size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,7 +66,8 @@ struct lzma_coder_s {
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret lzma_simple_coder_init(lzma_next_coder *next,
|
extern lzma_ret lzma_simple_coder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters,
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters,
|
||||||
size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
|
size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
|
||||||
bool is_encoder, uint8_t *buffer, size_t size),
|
bool is_encoder, uint8_t *buffer, size_t size),
|
||||||
size_t simple_size, size_t unfiltered_max,
|
size_t simple_size, size_t unfiltered_max,
|
||||||
|
|
|
@ -57,7 +57,7 @@ sparc_code(lzma_simple *simple lzma_attribute((__unused__)),
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
sparc_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
sparc_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters, bool is_encoder)
|
const lzma_filter_info *filters, bool is_encoder)
|
||||||
{
|
{
|
||||||
return lzma_simple_coder_init(next, allocator, filters,
|
return lzma_simple_coder_init(next, allocator, filters,
|
||||||
|
@ -67,7 +67,8 @@ sparc_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_sparc_encoder_init(lzma_next_coder *next,
|
lzma_simple_sparc_encoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters)
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return sparc_coder_init(next, allocator, filters, true);
|
return sparc_coder_init(next, allocator, filters, true);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +76,8 @@ lzma_simple_sparc_encoder_init(lzma_next_coder *next,
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_sparc_decoder_init(lzma_next_coder *next,
|
lzma_simple_sparc_decoder_init(lzma_next_coder *next,
|
||||||
lzma_allocator *allocator, const lzma_filter_info *filters)
|
const lzma_allocator *allocator,
|
||||||
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return sparc_coder_init(next, allocator, filters, false);
|
return sparc_coder_init(next, allocator, filters, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
|
||||||
|
|
||||||
|
|
||||||
static lzma_ret
|
static lzma_ret
|
||||||
x86_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
x86_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters, bool is_encoder)
|
const lzma_filter_info *filters, bool is_encoder)
|
||||||
{
|
{
|
||||||
const lzma_ret ret = lzma_simple_coder_init(next, allocator, filters,
|
const lzma_ret ret = lzma_simple_coder_init(next, allocator, filters,
|
||||||
|
@ -139,7 +139,8 @@ x86_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_x86_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_simple_x86_encoder_init(lzma_next_coder *next,
|
||||||
|
const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return x86_coder_init(next, allocator, filters, true);
|
return x86_coder_init(next, allocator, filters, true);
|
||||||
|
@ -147,7 +148,8 @@ lzma_simple_x86_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
|
|
||||||
|
|
||||||
extern lzma_ret
|
extern lzma_ret
|
||||||
lzma_simple_x86_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
lzma_simple_x86_decoder_init(lzma_next_coder *next,
|
||||||
|
const lzma_allocator *allocator,
|
||||||
const lzma_filter_info *filters)
|
const lzma_filter_info *filters)
|
||||||
{
|
{
|
||||||
return x86_coder_init(next, allocator, filters, false);
|
return x86_coder_init(next, allocator, filters, false);
|
||||||
|
|
Loading…
Reference in New Issue