aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lz
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-11-27 18:20:33 +0200
committerLasse Collin <lasse.collin@tukaani.org>2022-11-27 18:20:33 +0200
commit218394958c7683f892275bb40eae880620feebcc (patch)
treed21f20359b49097fde9e13f34dcb3c0d2bee51e5 /src/liblzma/lz
parentliblzma: Remove two FIXME comments. (diff)
downloadxz-218394958c7683f892275bb40eae880620feebcc.tar.xz
liblzma: Pass the Filter ID to LZ encoder and decoder.
This allows using two Filter IDs with the same initialization function and data structures.
Diffstat (limited to '')
-rw-r--r--src/liblzma/lz/lz_decoder.c5
-rw-r--r--src/liblzma/lz/lz_decoder.h3
-rw-r--r--src/liblzma/lz/lz_encoder.c5
-rw-r--r--src/liblzma/lz/lz_encoder.h3
-rw-r--r--src/liblzma/lzma/lzma2_decoder.c3
-rw-r--r--src/liblzma/lzma/lzma2_encoder.c3
-rw-r--r--src/liblzma/lzma/lzma_decoder.c2
-rw-r--r--src/liblzma/lzma/lzma_encoder.c2
8 files changed, 16 insertions, 10 deletions
diff --git a/src/liblzma/lz/lz_decoder.c b/src/liblzma/lz/lz_decoder.c
index ab6af0dd..4a62db76 100644
--- a/src/liblzma/lz/lz_decoder.c
+++ b/src/liblzma/lz/lz_decoder.c
@@ -212,7 +212,8 @@ extern 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,
+ const lzma_allocator *allocator,
+ lzma_vli id, const void *options,
lzma_lz_options *lz_options))
{
// Allocate the base structure if it isn't already allocated.
@@ -236,7 +237,7 @@ lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
// us the dictionary size.
lzma_lz_options lz_options;
return_if_error(lz_init(&coder->lz, allocator,
- filters[0].options, &lz_options));
+ filters[0].id, filters[0].options, &lz_options));
// If the dictionary size is very small, increase it to 4096 bytes.
// This is to prevent constant wrapping of the dictionary, which
diff --git a/src/liblzma/lz/lz_decoder.h b/src/liblzma/lz/lz_decoder.h
index e6d7ab2a..8e68ac8a 100644
--- a/src/liblzma/lz/lz_decoder.h
+++ b/src/liblzma/lz/lz_decoder.h
@@ -87,7 +87,8 @@ extern 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,
+ const lzma_allocator *allocator,
+ lzma_vli id, const void *options,
lzma_lz_options *lz_options));
extern uint64_t lzma_lz_decoder_memusage(size_t dictionary_size);
diff --git a/src/liblzma/lz/lz_encoder.c b/src/liblzma/lz/lz_encoder.c
index 702582ce..5489085a 100644
--- a/src/liblzma/lz/lz_encoder.c
+++ b/src/liblzma/lz/lz_encoder.c
@@ -544,7 +544,8 @@ extern 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,
+ const lzma_allocator *allocator,
+ lzma_vli id, const void *options,
lzma_lz_options *lz_options))
{
#if defined(HAVE_SMALL) && !defined(HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR)
@@ -585,7 +586,7 @@ lzma_lz_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
// Initialize the LZ-based encoder.
lzma_lz_options lz_options;
return_if_error(lz_init(&coder->lz, allocator,
- filters[0].options, &lz_options));
+ filters[0].id, filters[0].options, &lz_options));
// Setup the size information into coder->mf and deallocate
// old buffers if they have wrong size.
diff --git a/src/liblzma/lz/lz_encoder.h b/src/liblzma/lz/lz_encoder.h
index 41439408..7950a2f4 100644
--- a/src/liblzma/lz/lz_encoder.h
+++ b/src/liblzma/lz/lz_encoder.h
@@ -311,7 +311,8 @@ extern 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,
+ const lzma_allocator *allocator,
+ lzma_vli id, const void *options,
lzma_lz_options *lz_options));
diff --git a/src/liblzma/lzma/lzma2_decoder.c b/src/liblzma/lzma/lzma2_decoder.c
index 105a28dc..567df490 100644
--- a/src/liblzma/lzma/lzma2_decoder.c
+++ b/src/liblzma/lzma/lzma2_decoder.c
@@ -226,7 +226,8 @@ lzma2_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
static lzma_ret
lzma2_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
- const void *opt, lzma_lz_options *lz_options)
+ lzma_vli id lzma_attribute((__unused__)), const void *opt,
+ lzma_lz_options *lz_options)
{
lzma_lzma2_coder *coder = lz->coder;
if (coder == NULL) {
diff --git a/src/liblzma/lzma/lzma2_encoder.c b/src/liblzma/lzma/lzma2_encoder.c
index 6914f279..f1252c57 100644
--- a/src/liblzma/lzma/lzma2_encoder.c
+++ b/src/liblzma/lzma/lzma2_encoder.c
@@ -310,7 +310,8 @@ lzma2_encoder_options_update(void *coder_ptr, const lzma_filter *filter)
static lzma_ret
lzma2_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
- const void *options, lzma_lz_options *lz_options)
+ lzma_vli id lzma_attribute((__unused__)), const void *options,
+ lzma_lz_options *lz_options)
{
if (options == NULL)
return LZMA_PROG_ERROR;
diff --git a/src/liblzma/lzma/lzma_decoder.c b/src/liblzma/lzma/lzma_decoder.c
index f56ccaf7..69507f51 100644
--- a/src/liblzma/lzma/lzma_decoder.c
+++ b/src/liblzma/lzma/lzma_decoder.c
@@ -1014,7 +1014,7 @@ lzma_lzma_decoder_create(lzma_lz_decoder *lz, const lzma_allocator *allocator,
/// the LZ initialization).
static lzma_ret
lzma_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
- const void *options, lzma_lz_options *lz_options)
+ lzma_vli id, const void *options, lzma_lz_options *lz_options)
{
if (!is_lclppb_valid(options))
return LZMA_PROG_ERROR;
diff --git a/src/liblzma/lzma/lzma_encoder.c b/src/liblzma/lzma/lzma_encoder.c
index 9a64b71f..e2dbbc03 100644
--- a/src/liblzma/lzma/lzma_encoder.c
+++ b/src/liblzma/lzma/lzma_encoder.c
@@ -680,7 +680,7 @@ lzma_lzma_encoder_create(void **coder_ptr,
static lzma_ret
lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
- const void *options, lzma_lz_options *lz_options)
+ lzma_vli id, const void *options, lzma_lz_options *lz_options)
{
lz->code = &lzma_encode;
lz->set_out_limit = &lzma_lzma_set_out_limit;