|
static lzma_ret | copy_or_code (lzma_simple_coder *coder, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) |
| Copied or encodes/decodes more data to out[]. More...
|
|
static size_t | call_filter (lzma_simple_coder *coder, uint8_t *buffer, size_t size) |
|
static lzma_ret | simple_code (void *coder_ptr, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) |
|
static void | simple_coder_end (void *coder_ptr, const lzma_allocator *allocator) |
|
static lzma_ret | simple_coder_update (void *coder_ptr, const lzma_allocator *allocator, const lzma_filter *filters_null lzma_attribute((__unused__)), const lzma_filter *reversed_filters) |
|
lzma_ret | lzma_simple_coder_init (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters, size_t(*filter)(void *simple, uint32_t now_pos, bool is_encoder, uint8_t *buffer, size_t size), size_t simple_size, size_t unfiltered_max, uint32_t alignment, bool is_encoder) |
|
Wrapper for simple filters.
Simple filters don't change the size of the data i.e. number of bytes in equals the number of bytes out.
Definition in file simple_coder.c.
Copied or encodes/decodes more data to out[].
Definition at line 21 of file simple_coder.c.
const lzma_allocator const uint8_t size_t uint8_t size_t * out_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_allocator const uint8_t size_t uint8_t * out
assert(limit<=UINT32_MAX/2)
lzma_code_function code
Pointer to function to do the actual coding.
void * coder
Pointer to coder-specific data.
lzma_next_coder next
Next filter in the chain.
bool end_was_reached
True if the next coder in the chain has returned LZMA_STREAM_END.
lzma_ret
Return values used by several functions in liblzma.
@ LZMA_STREAM_END
End of stream was reached.
@ LZMA_OK
Operation completed successfully.
@ LZMA_FINISH
Finish the coding operation.
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)
References test-lz4-speed::action, allocator, assert(), lzma_next_coder_s::code, lzma_next_coder_s::coder, lzma_simple_coder::end_was_reached, in, in_pos, in_size, lzma_simple_coder::is_encoder, lzma_bufcpy(), LZMA_FINISH, LZMA_OK, LZMA_STREAM_END, lzma_simple_coder::next, NULL, out, and out_pos.
Referenced by simple_code().
lzma_ret lzma_simple_coder_init |
( |
lzma_next_coder * |
next, |
|
|
const lzma_allocator * |
allocator, |
|
|
const lzma_filter_info * |
filters, |
|
|
size_t(*)(void *simple, uint32_t now_pos, bool is_encoder, uint8_t *buffer, size_t size) |
filter, |
|
|
size_t |
simple_size, |
|
|
size_t |
unfiltered_max, |
|
|
uint32_t |
alignment, |
|
|
bool |
is_encoder |
|
) |
| |
Definition at line 235 of file simple_coder.c.
264 if (simple_size > 0) {
276 if (coder->
now_pos & (alignment - 1))
const lzma_filter * filters
static const char struct stat static buf struct stat static buf static vhangup int options
static bool filter(RzParse *p, ut64 addr, RzFlag *f, RzAnalysisHint *hint, char *data, char *str, int len, bool big_endian)
static lzma_ret simple_coder_update(void *coder_ptr, const lzma_allocator *allocator, const lzma_filter *filters_null lzma_attribute((__unused__)), const lzma_filter *reversed_filters)
static lzma_ret simple_code(void *coder_ptr, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action)
static void simple_coder_end(void *coder_ptr, const lzma_allocator *allocator)
void * options
Pointer to filter-specific options structure.
lzma_ret(* update)(void *coder, const lzma_allocator *allocator, const lzma_filter *filters, const lzma_filter *reversed_filters)
uint32_t start_offset
Start offset for conversions.
size_t allocated
Size of the memory allocated for the buffer.
#define LZMA_NEXT_CODER_INIT
Macro to initialize lzma_next_coder structure.
void * lzma_alloc(size_t size, const lzma_allocator *allocator) lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
Allocates memory.
@ LZMA_MEM_ERROR
Cannot allocate memory.
@ LZMA_OPTIONS_ERROR
Invalid or unsupported options.
lzma_ret lzma_next_filter_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters)
References lzma_simple_coder::allocated, allocator, lzma_next_coder_s::code, lzma_next_coder_s::coder, lzma_next_coder_s::end, lzma_simple_coder::end_was_reached, filter(), lzma_simple_coder::filter, lzma_simple_coder::filtered, filters, lzma_simple_coder::is_encoder, lzma_alloc(), LZMA_MEM_ERROR, LZMA_NEXT_CODER_INIT, lzma_next_filter_init(), LZMA_OPTIONS_ERROR, lzma_simple_coder::next, lzma_simple_coder::now_pos, NULL, options, lzma_filter::options, lzma_simple_coder::pos, lzma_simple_coder::simple, simple_code(), simple_coder_end(), simple_coder_update(), lzma_simple_coder::size, lzma_options_bcj::start_offset, and lzma_next_coder_s::update.
Referenced by arm_coder_init(), armthumb_coder_init(), ia64_coder_init(), powerpc_coder_init(), sparc_coder_init(), and x86_coder_init().
Definition at line 69 of file simple_coder.c.
110 const size_t out_avail = out_size - *
out_pos;
111 const size_t buf_avail = coder->
size - coder->
pos;
112 if (out_avail > buf_avail || buf_avail == 0) {
115 const size_t out_start = *
out_pos;
147 const size_t unfiltered =
size - filtered;
148 assert(unfiltered <= coder->allocated / 2);
153 coder->
size = unfiltered;
160 }
else if (unfiltered > 0) {
166 }
else if (coder->
pos > 0) {
178 if (coder->
size > 0) {
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static size_t call_filter(lzma_simple_coder *coder, uint8_t *buffer, size_t size)
static lzma_ret copy_or_code(lzma_simple_coder *coder, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action)
Copied or encodes/decodes more data to out[].
uint8_t buffer[]
Temporary buffer.
@ LZMA_SYNC_FLUSH
Make all the input available at output.
References test-lz4-speed::action, lzma_simple_coder::allocated, allocator, assert(), lzma_simple_coder::buffer, call_filter(), copy_or_code(), lzma_simple_coder::end_was_reached, lzma_simple_coder::filtered, in, in_pos, in_size, lzma_bufcpy(), LZMA_OK, LZMA_OPTIONS_ERROR, LZMA_STREAM_END, LZMA_SYNC_FLUSH, memcpy(), out, out_pos, lzma_simple_coder::pos, and lzma_simple_coder::size.
Referenced by lzma_simple_coder_init().