aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma2_encoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-01-27 18:36:05 +0200
committerLasse Collin <lasse.collin@tukaani.org>2009-01-27 18:36:05 +0200
commitf76e39cf930f888d460b443d18f977ebedea8b2a (patch)
tree314f531dc9953c5b87a5268d53373e6646598323 /src/liblzma/lzma/lzma2_encoder.c
parentRegenerate the CRC tables without trailing blanks. (diff)
downloadxz-f76e39cf930f888d460b443d18f977ebedea8b2a.tar.xz
Added initial support for preset dictionary for raw LZMA1
and LZMA2. It is not supported by the .xz format or the xz command line tool yet.
Diffstat (limited to 'src/liblzma/lzma/lzma2_encoder.c')
-rw-r--r--src/liblzma/lzma/lzma2_encoder.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/liblzma/lzma/lzma2_encoder.c b/src/liblzma/lzma/lzma2_encoder.c
index 81b6f973..cc676d5e 100644
--- a/src/liblzma/lzma/lzma2_encoder.c
+++ b/src/liblzma/lzma/lzma2_encoder.c
@@ -318,15 +318,17 @@ lzma2_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
lz->coder->lzma = NULL;
}
- lz->coder->sequence = SEQ_INIT;
- lz->coder->need_properties = true;
- lz->coder->need_state_reset = false;
- lz->coder->need_dictionary_reset = true;
-
lz->coder->opt_cur = *(const lzma_options_lzma *)(options);
lz->coder->opt_new = lz->coder->opt_cur.persistent
? options : NULL;
+ lz->coder->sequence = SEQ_INIT;
+ lz->coder->need_properties = true;
+ lz->coder->need_state_reset = false;
+ lz->coder->need_dictionary_reset
+ = lz->coder->opt_cur.preset_dict == NULL
+ || lz->coder->opt_cur.preset_dict_size == 0;
+
// Initialize LZMA encoder
return_if_error(lzma_lzma_encoder_create(&lz->coder->lzma, allocator,
&lz->coder->opt_cur, lz_options));