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

LZMA encoder API. More...

#include "common.h"

Go to the source code of this file.

Typedefs

typedef struct lzma_lzma1_encoder_s lzma_lzma1_encoder
 

Functions

lzma_ret lzma_lzma_encoder_init (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters)
 
uint64_t lzma_lzma_encoder_memusage (const void *options)
 
lzma_ret lzma_lzma_props_encode (const void *options, uint8_t *out)
 
bool lzma_lzma_lclppb_encode (const lzma_options_lzma *options, uint8_t *byte)
 Encodes lc/lp/pb into one byte. Returns false on success and true on error. More...
 

Detailed Description

LZMA encoder API.

Definition in file lzma_encoder.h.

Typedef Documentation

◆ lzma_lzma1_encoder

Definition at line 1 of file lzma_encoder.h.

Function Documentation

◆ lzma_lzma_encoder_init()

lzma_ret lzma_lzma_encoder_init ( lzma_next_coder next,
const lzma_allocator allocator,
const lzma_filter_info filters 
)

Definition at line 619 of file lzma_encoder.c.

621 {
622  return lzma_lz_encoder_init(
624 }
const lzma_allocator * allocator
Definition: block.h:377
const lzma_filter * filters
Definition: container.h:315
lzma_ret lzma_lz_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters, lzma_ret(*lz_init)(lzma_lz_encoder *lz, const lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options))
Definition: lz_encoder.c:525
static lzma_ret lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)
Definition: lzma_encoder.c:609

References allocator, filters, lzma_encoder_init(), and lzma_lz_encoder_init().

Referenced by alone_encoder_init().

◆ lzma_lzma_encoder_memusage()

uint64_t lzma_lzma_encoder_memusage ( const void *  options)

Definition at line 628 of file lzma_encoder.c.

629 {
631  return UINT64_MAX;
632 
633  lzma_lz_options lz_options;
634  set_lz_options(&lz_options, options);
635 
636  const uint64_t lz_memusage = lzma_lz_encoder_memusage(&lz_options);
637  if (lz_memusage == UINT64_MAX)
638  return UINT64_MAX;
639 
640  return (uint64_t)(sizeof(lzma_lzma1_encoder)) + lz_memusage;
641 }
static const char struct stat static buf struct stat static buf static vhangup int options
Definition: sflib.h:145
uint64_t lzma_lz_encoder_memusage(const lzma_lz_options *lz_options)
Definition: lz_encoder.c:464
static bool is_options_valid(const lzma_options_lzma *options)
Definition: lzma_encoder.c:422
static void set_lz_options(lzma_lz_options *lz_options, const lzma_options_lzma *options)
Definition: lzma_encoder.c:435
struct lzma_lzma1_encoder_s lzma_lzma1_encoder
Definition: lzma_encoder.h:20
unsigned long uint64_t
Definition: sftypes.h:28
#define UINT64_MAX

References is_options_valid(), lzma_lz_encoder_memusage(), options, set_lz_options(), and UINT64_MAX.

Referenced by lzma_lzma2_encoder_memusage().

◆ lzma_lzma_lclppb_encode()

bool lzma_lzma_lclppb_encode ( const lzma_options_lzma options,
uint8_t byte 
)

Encodes lc/lp/pb into one byte. Returns false on success and true on error.

Definition at line 645 of file lzma_encoder.c.

646 {
647  if (!is_lclppb_valid(options))
648  return true;
649 
650  *byte = (options->pb * 5 + options->lp) * 9 + options->lc;
651  assert(*byte <= (4 * 5 + 4) * 9 + 8);
652 
653  return false;
654 }
static bool is_lclppb_valid(const lzma_options_lzma *options)
Validates lc, lp, and pb.
Definition: lzma_common.h:33
assert(limit<=UINT32_MAX/2)

References assert(), is_lclppb_valid(), and options.

Referenced by alone_encoder_init(), and lzma2_header_lzma().

◆ lzma_lzma_props_encode()

lzma_ret lzma_lzma_props_encode ( const void *  options,
uint8_t out 
)