diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-09-27 19:09:21 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-09-27 19:09:21 +0300 |
commit | 1dcecfb09b55157b8653d747963069c8bed74f04 (patch) | |
tree | 81fa1f1e8bf6871981970ca826d897db6f33527b /src/liblzma/common/alone_encoder.c | |
parent | Added 7z2lzma.bash. (diff) | |
download | xz-1dcecfb09b55157b8653d747963069c8bed74f04.tar.xz |
Some API changes, bug fixes, cleanups etc.
Diffstat (limited to '')
-rw-r--r-- | src/liblzma/common/alone_encoder.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/liblzma/common/alone_encoder.c b/src/liblzma/common/alone_encoder.c index 7fb11570..41fb6162 100644 --- a/src/liblzma/common/alone_encoder.c +++ b/src/liblzma/common/alone_encoder.c @@ -106,9 +106,10 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, if (lzma_lzma_lclppb_encode(options, next->coder->header)) return LZMA_PROG_ERROR; - // - Dictionary size (4 bytes) - if (options->dictionary_size < LZMA_DICTIONARY_SIZE_MIN - || options->dictionary_size > LZMA_DICTIONARY_SIZE_MAX) + // - Dictionary size (4 bytes); limit to 1 GiB since that's what + // LZMA SDK currently does for encoding. + if (options->dict_size < LZMA_DICT_SIZE_MIN + || options->dict_size > (UINT32_C(1) << 30)) return LZMA_PROG_ERROR; // Round up to to the next 2^n or 2^n + 2^(n - 1) depending on which @@ -118,7 +119,7 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, // // FIXME Maybe LZMA_Alone needs some lower limit for maximum // dictionary size? Must check decoders from old LZMA SDK version. - uint32_t d = options->dictionary_size - 1; + uint32_t d = options->dict_size - 1; d |= d >> 2; d |= d >> 3; d |= d >> 4; |