14 #ifndef LZMA_LZ_DECODER_H
15 #define LZMA_LZ_DECODER_H
63 void (*reset)(
void *coder,
const void *
options);
74 #define LZMA_LZ_DECODER_INIT \
79 .set_uncompressed = NULL, \
105 return dict->
buf[dict->
pos - distance - 1
106 + (distance < dict->
pos ? 0 : dict->
size)];
114 return dict->
full == 0;
122 return dict->
full > distance;
131 const size_t dict_avail = dict->
limit - dict->
pos;
138 if (distance < left) {
144 }
while (--left > 0);
146 }
else if (distance < dict->
pos) {
149 dict->
buf + dict->
pos - distance - 1,
159 = dict->
pos - distance - 1 + dict->
size;
162 if (copy_size < left) {
163 memmove(dict->
buf + dict->
pos, dict->
buf + copy_pos,
165 dict->
pos += copy_size;
166 copy_size = left - copy_size;
168 dict->
pos += copy_size;
170 memmove(dict->
buf + dict->
pos, dict->
buf + copy_pos,
192 dict->
buf[dict->
pos++] = byte;
218 dict->buf, &dict->pos, dict->limit);
220 if (dict->pos > dict->full)
221 dict->full = dict->pos;
const lzma_allocator const uint8_t size_t * in_pos
const lzma_allocator const uint8_t size_t in_size
const lzma_allocator * allocator
const lzma_allocator const uint8_t * in
const lzma_filter * filters
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static const char struct stat static buf struct stat static buf static vhangup int options
lzma_ret lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters, lzma_ret(*lz_init)(lzma_lz_decoder *lz, const lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options))
static bool dict_repeat(lzma_dict *dict, uint32_t distance, uint32_t *len)
Repeat *len bytes at distance.
static bool dict_put(lzma_dict *dict, uint8_t byte)
static uint8_t dict_get(const lzma_dict *const dict, const uint32_t distance)
Get a byte from the history buffer.
static bool dict_is_empty(const lzma_dict *const dict)
Test if dictionary is empty.
static bool dict_is_distance_valid(const lzma_dict *const dict, const size_t distance)
Validate the match distance.
static void dict_reset(lzma_dict *dict)
uint64_t lzma_lz_decoder_memusage(size_t dictionary_size)
void lzma_lz_decoder_uncompressed(void *coder, lzma_vli uncompressed_size)
static void dict_write(lzma_dict *restrict dict, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, size_t *restrict left)
Copies arbitrary amount of data into the dictionary.
assert(limit<=UINT32_MAX/2)
Custom functions for memory handling.
bool need_reset
True when dictionary should be reset before decoding more data.
size_t size
Size of the dictionary.
void * coder
Data specific to the LZ-based decoder.
const uint8_t * preset_dict
TODO: Comment.
size_t dict_size
Size of the history buffer.
Hold data and function pointers of the next filter in the chain.
uint64_t uncompressed_size
uint64_t lzma_vli
Variable-length integer type.
lzma_ret
Return values used by several functions in liblzma.
size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size)