aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblzma/lzma/lzma_decoder.c')
-rw-r--r--src/liblzma/lzma/lzma_decoder.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/liblzma/lzma/lzma_decoder.c b/src/liblzma/lzma/lzma_decoder.c
index b8f93170..eedc0733 100644
--- a/src/liblzma/lzma/lzma_decoder.c
+++ b/src/liblzma/lzma/lzma_decoder.c
@@ -161,7 +161,7 @@ typedef struct {
} lzma_length_decoder;
-struct lzma_coder_s {
+typedef struct {
///////////////////
// Probabilities //
///////////////////
@@ -277,14 +277,16 @@ struct lzma_coder_s {
/// If decoding a literal: match byte.
/// If decoding a match: length of the match.
uint32_t len;
-};
+} lzma_lzma1_decoder;
static lzma_ret
-lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr,
+lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr,
const uint8_t *restrict in,
size_t *restrict in_pos, size_t in_size)
{
+ lzma_lzma1_decoder *restrict coder = coder_ptr;
+
////////////////////
// Initialization //
////////////////////
@@ -840,23 +842,17 @@ out:
static void
-lzma_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size)
+lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
{
+ lzma_lzma1_decoder *coder = coder_ptr;
coder->uncompressed_size = uncompressed_size;
}
-/*
-extern void
-lzma_lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
-{
- // This is hack.
- (*(lzma_coder **)(coder))->uncompressed_size = uncompressed_size;
-}
-*/
static void
-lzma_decoder_reset(lzma_coder *coder, const void *opt)
+lzma_decoder_reset(void *coder_ptr, const void *opt)
{
+ lzma_lzma1_decoder *coder = coder_ptr;
const lzma_options_lzma *options = opt;
// NOTE: We assume that lc/lp/pb are valid since they were
@@ -941,7 +937,7 @@ lzma_lzma_decoder_create(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *opt, lzma_lz_options *lz_options)
{
if (lz->coder == NULL) {
- lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
+ lz->coder = lzma_alloc(sizeof(lzma_lzma1_decoder), allocator);
if (lz->coder == NULL)
return LZMA_MEM_ERROR;
@@ -1014,7 +1010,8 @@ extern uint64_t
lzma_lzma_decoder_memusage_nocheck(const void *options)
{
const lzma_options_lzma *const opt = options;
- return sizeof(lzma_coder) + lzma_lz_decoder_memusage(opt->dict_size);
+ return sizeof(lzma_lzma1_decoder)
+ + lzma_lz_decoder_memusage(opt->dict_size);
}