aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common
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/common
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 'src/liblzma/common')
-rw-r--r--src/liblzma/common/alone_decoder.c1
-rw-r--r--src/liblzma/common/alone_encoder.c1
-rw-r--r--src/liblzma/common/common.h7
-rw-r--r--src/liblzma/common/lzip_decoder.c1
-rw-r--r--src/liblzma/common/microlzma_decoder.c1
-rw-r--r--src/liblzma/common/microlzma_encoder.c1
6 files changed, 10 insertions, 2 deletions
diff --git a/src/liblzma/common/alone_decoder.c b/src/liblzma/common/alone_decoder.c
index c4d96cda..5c4d60b1 100644
--- a/src/liblzma/common/alone_decoder.c
+++ b/src/liblzma/common/alone_decoder.c
@@ -132,6 +132,7 @@ alone_decode(void *coder_ptr, const lzma_allocator *allocator,
lzma_filter_info filters[2] = {
{
+ .id = LZMA_FILTER_LZMA1,
.init = &lzma_lzma_decoder_init,
.options = &coder->options,
}, {
diff --git a/src/liblzma/common/alone_encoder.c b/src/liblzma/common/alone_encoder.c
index 96c1db70..c9392f37 100644
--- a/src/liblzma/common/alone_encoder.c
+++ b/src/liblzma/common/alone_encoder.c
@@ -129,6 +129,7 @@ alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
// Initialize the LZMA encoder.
const lzma_filter_info filters[2] = {
{
+ .id = LZMA_FILTER_LZMA1,
.init = &lzma_lzma_encoder_init,
.options = (void *)(options),
}, {
diff --git a/src/liblzma/common/common.h b/src/liblzma/common/common.h
index b3a624c6..01841de0 100644
--- a/src/liblzma/common/common.h
+++ b/src/liblzma/common/common.h
@@ -162,8 +162,11 @@ typedef void (*lzma_end_function)(
/// an array of lzma_filter_info structures. This array is used with
/// lzma_next_filter_init to initialize the filter chain.
struct lzma_filter_info_s {
- /// Filter ID. This is used only by the encoder
- /// with lzma_filters_update().
+ /// Filter ID. This can be used to share the same initiazation
+ /// function *and* data structures with different Filter IDs
+ /// (LZMA_FILTER_LZMA1EXT does it), and also by the encoder
+ /// with lzma_filters_update() if filter chain is updated
+ /// in the middle of a raw stream or Block (LZMA_SYNC_FLUSH).
lzma_vli id;
/// Pointer to function used to initialize the filter.
diff --git a/src/liblzma/common/lzip_decoder.c b/src/liblzma/common/lzip_decoder.c
index 29c83cfa..20794f94 100644
--- a/src/liblzma/common/lzip_decoder.c
+++ b/src/liblzma/common/lzip_decoder.c
@@ -231,6 +231,7 @@ lzip_decode(void *coder_ptr, const lzma_allocator *allocator,
const lzma_filter_info filters[2] = {
{
+ .id = LZMA_FILTER_LZMA1,
.init = &lzma_lzma_decoder_init,
.options = &coder->options,
}, {
diff --git a/src/liblzma/common/microlzma_decoder.c b/src/liblzma/common/microlzma_decoder.c
index d6337816..ba2f10ad 100644
--- a/src/liblzma/common/microlzma_decoder.c
+++ b/src/liblzma/common/microlzma_decoder.c
@@ -95,6 +95,7 @@ microlzma_decode(void *coder_ptr, const lzma_allocator *allocator,
options.dict_size = coder->dict_size;
lzma_filter_info filters[2] = {
{
+ .id = LZMA_FILTER_LZMA1,
.init = &lzma_lzma_decoder_init,
.options = &options,
}, {
diff --git a/src/liblzma/common/microlzma_encoder.c b/src/liblzma/common/microlzma_encoder.c
index 072b500f..d3ef0632 100644
--- a/src/liblzma/common/microlzma_encoder.c
+++ b/src/liblzma/common/microlzma_encoder.c
@@ -116,6 +116,7 @@ microlzma_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
// Initialize the LZMA encoder.
const lzma_filter_info filters[2] = {
{
+ .id = LZMA_FILTER_LZMA1,
.init = &lzma_lzma_encoder_init,
.options = (void *)(options),
}, {