diff options
Diffstat (limited to 'src/liblzma/delta')
-rw-r--r-- | src/liblzma/delta/delta_common.c | 5 | ||||
-rw-r--r-- | src/liblzma/delta/delta_decoder.c | 3 | ||||
-rw-r--r-- | src/liblzma/delta/delta_encoder.c | 17 | ||||
-rw-r--r-- | src/liblzma/delta/delta_private.h | 2 |
4 files changed, 20 insertions, 7 deletions
diff --git a/src/liblzma/delta/delta_common.c b/src/liblzma/delta/delta_common.c index 6d55ff65..930ad215 100644 --- a/src/liblzma/delta/delta_common.c +++ b/src/liblzma/delta/delta_common.c @@ -25,7 +25,7 @@ delta_coder_end(lzma_coder *coder, lzma_allocator *allocator) extern lzma_ret lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator, - const lzma_filter_info *filters, lzma_code_function code) + const lzma_filter_info *filters) { // Allocate memory for the decoder if needed. if (next->coder == NULL) { @@ -38,9 +38,6 @@ lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator, next->coder->next = LZMA_NEXT_CODER_INIT; } - // Coding function is different for encoder and decoder. - next->code = code; - // Validate the options. if (lzma_delta_coder_memusage(filters[0].options) == UINT64_MAX) return LZMA_OPTIONS_ERROR; diff --git a/src/liblzma/delta/delta_decoder.c b/src/liblzma/delta/delta_decoder.c index 2ddf163d..2cf60d5b 100644 --- a/src/liblzma/delta/delta_decoder.c +++ b/src/liblzma/delta/delta_decoder.c @@ -50,7 +50,8 @@ extern lzma_ret lzma_delta_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters) { - return lzma_delta_coder_init(next, allocator, filters, &delta_decode); + next->code = &delta_decode; + return lzma_delta_coder_init(next, allocator, filters); } diff --git a/src/liblzma/delta/delta_encoder.c b/src/liblzma/delta/delta_encoder.c index 0244673e..80d0d176 100644 --- a/src/liblzma/delta/delta_encoder.c +++ b/src/liblzma/delta/delta_encoder.c @@ -83,11 +83,26 @@ delta_encode(lzma_coder *coder, lzma_allocator *allocator, } +static lzma_ret +delta_encoder_update(lzma_coder *coder, lzma_allocator *allocator, + const lzma_filter *filters_null lzma_attribute((unused)), + const lzma_filter *reversed_filters) +{ + // Delta doesn't and will never support changing the options in + // the middle of encoding. If the app tries to change them, we + // simply ignore them. + return lzma_next_filter_update( + &coder->next, allocator, reversed_filters + 1); +} + + extern lzma_ret lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters) { - return lzma_delta_coder_init(next, allocator, filters, &delta_encode); + next->code = &delta_encode; + next->update = &delta_encoder_update; + return lzma_delta_coder_init(next, allocator, filters); } diff --git a/src/liblzma/delta/delta_private.h b/src/liblzma/delta/delta_private.h index 69be82e2..62b7fed8 100644 --- a/src/liblzma/delta/delta_private.h +++ b/src/liblzma/delta/delta_private.h @@ -32,6 +32,6 @@ struct lzma_coder_s { extern lzma_ret lzma_delta_coder_init( lzma_next_coder *next, lzma_allocator *allocator, - const lzma_filter_info *filters, lzma_code_function code); + const lzma_filter_info *filters); #endif |