Rizin
unix-like reverse engineering framework and cli tools
alone_decoder.h File Reference

Decoder for LZMA_Alone files. More...

#include "common.h"

Go to the source code of this file.

Functions

lzma_ret lzma_alone_decoder_init (lzma_next_coder *next, const lzma_allocator *allocator, uint64_t memlimit, bool picky)
 

Detailed Description

Decoder for LZMA_Alone files.

Definition in file alone_decoder.h.

Function Documentation

◆ lzma_alone_decoder_init()

lzma_ret lzma_alone_decoder_init ( lzma_next_coder next,
const lzma_allocator allocator,
uint64_t  memlimit,
bool  picky 
)

Definition at line 200 of file alone_decoder.c.

202 {
204 
205  lzma_alone_coder *coder = next->coder;
206 
207  if (coder == NULL) {
208  coder = lzma_alloc(sizeof(lzma_alone_coder), allocator);
209  if (coder == NULL)
210  return LZMA_MEM_ERROR;
211 
212  next->coder = coder;
213  next->code = &alone_decode;
214  next->end = &alone_decoder_end;
216  coder->next = LZMA_NEXT_CODER_INIT;
217  }
218 
219  coder->sequence = SEQ_PROPERTIES;
220  coder->picky = picky;
221  coder->pos = 0;
222  coder->options.dict_size = 0;
223  coder->options.preset_dict = NULL;
224  coder->options.preset_dict_size = 0;
225  coder->uncompressed_size = 0;
226  coder->memlimit = my_max(1, memlimit);
227  coder->memusage = LZMA_MEMUSAGE_BASE;
228 
229  return LZMA_OK;
230 }
static lzma_ret alone_decoder_memconfig(void *coder_ptr, uint64_t *memusage, uint64_t *old_memlimit, uint64_t new_memlimit)
static void alone_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
static lzma_ret alone_decode(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)
Definition: alone_decoder.c:53
lzma_ret lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator, uint64_t memlimit, bool picky)
const lzma_allocator * allocator
Definition: block.h:377
uint64_t memlimit
Definition: container.h:537
#define NULL
Definition: cris-opc.c:27
size_t pos
Position in the header fields.
Definition: alone_decoder.c:35
enum lzma_alone_coder::@640 sequence
uint64_t memusage
Amount of memory actually needed (only an estimate)
Definition: alone_decoder.c:44
lzma_next_coder next
Definition: alone_decoder.c:19
uint64_t memlimit
Memory usage limit.
Definition: alone_decoder.c:41
lzma_vli uncompressed_size
Uncompressed size decoded from the header.
Definition: alone_decoder.c:38
lzma_options_lzma options
Definition: alone_decoder.c:48
lzma_code_function code
Pointer to function to do the actual coding.
Definition: common.h:150
void * coder
Pointer to coder-specific data.
Definition: common.h:137
lzma_end_function end
Definition: common.h:155
lzma_ret(* memconfig)(void *coder, uint64_t *memusage, uint64_t *old_memlimit, uint64_t new_memlimit)
Definition: common.h:168
const uint8_t * preset_dict
Pointer to an initial dictionary.
Definition: lzma12.h:240
uint32_t preset_dict_size
Size of the preset dictionary.
Definition: lzma12.h:254
uint32_t dict_size
Dictionary size in bytes.
Definition: lzma12.h:217
#define LZMA_NEXT_CODER_INIT
Macro to initialize lzma_next_coder structure.
Definition: common.h:180
#define LZMA_MEMUSAGE_BASE
Definition: common.h:63
#define lzma_next_coder_init(func, next, allocator)
Definition: common.h:291
void * lzma_alloc(size_t size, const lzma_allocator *allocator) lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
Allocates memory.
#define my_max(x, y)
Definition: sysdefs.h:186
@ LZMA_MEM_ERROR
Cannot allocate memory.
Definition: base.h:128
@ LZMA_OK
Operation completed successfully.
Definition: base.h:58

References allocator, alone_decode(), alone_decoder_end(), alone_decoder_memconfig(), lzma_next_coder_s::code, lzma_next_coder_s::coder, lzma_options_lzma::dict_size, lzma_next_coder_s::end, lzma_alloc(), LZMA_MEM_ERROR, LZMA_MEMUSAGE_BASE, LZMA_NEXT_CODER_INIT, lzma_next_coder_init, LZMA_OK, lzma_next_coder_s::memconfig, memlimit, lzma_alone_coder::memlimit, lzma_alone_coder::memusage, my_max, lzma_alone_coder::next, NULL, lzma_alone_coder::options, lzma_alone_coder::picky, lzma_alone_coder::pos, lzma_options_lzma::preset_dict, lzma_options_lzma::preset_dict_size, lzma_alone_coder::sequence, and lzma_alone_coder::uncompressed_size.

Referenced by auto_decode(), and LZMA_API().