aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma_decoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-06-18 18:02:10 +0300
committerLasse Collin <lasse.collin@tukaani.org>2008-06-18 18:02:10 +0300
commit7d17818cec8597f847b0a2537fde991bbc3d9e96 (patch)
tree9c41502e3eb96f103fe98e13456b382fbba7a292 /src/liblzma/lzma/lzma_decoder.c
parentUpdate the file format specification draft. The new one is (diff)
downloadxz-7d17818cec8597f847b0a2537fde991bbc3d9e96.tar.xz
Update the code to mostly match the new simpler file format
specification. Simplify things by removing most of the support for known uncompressed size in most places. There are some miscellaneous changes here and there too. The API of liblzma has got many changes and still some more will be done soon. While most of the code has been updated, some things are not fixed (the command line tool will choke with invalid filter chain, if nothing else). Subblock filter is somewhat broken for now. It will be updated once the encoded format of the Subblock filter has been decided.
Diffstat (limited to 'src/liblzma/lzma/lzma_decoder.c')
-rw-r--r--src/liblzma/lzma/lzma_decoder.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/liblzma/lzma/lzma_decoder.c b/src/liblzma/lzma/lzma_decoder.c
index dfe83589..d4cefe0b 100644
--- a/src/liblzma/lzma/lzma_decoder.c
+++ b/src/liblzma/lzma/lzma_decoder.c
@@ -547,6 +547,9 @@ decode_real(lzma_coder *restrict coder, const uint8_t *restrict in,
// Note that rep0 is known to have a safe value, thus we
// don't need to check if we are wrapping the dictionary
// when it isn't full yet.
+ if (unlikely(lz_is_empty(coder->lz)))
+ return true;
+
coder->lz.dict[coder->lz.pos]
= lz_get_byte(coder->lz, rep0);
++coder->lz.pos;
@@ -698,7 +701,6 @@ lzma_lzma_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
{
const lzma_ret ret = lzma_lz_decoder_reset(
&next->coder->lz, allocator, &decode_real,
- filters[0].uncompressed_size,
options->dictionary_size, MATCH_MAX_LEN);
if (ret != LZMA_OK) {
lzma_literal_end(&next->coder->literal_coder,
@@ -785,6 +787,15 @@ lzma_lzma_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
}
+extern void
+lzma_lzma_decoder_uncompressed_size(
+ lzma_next_coder *next, lzma_vli uncompressed_size)
+{
+ next->coder->lz.uncompressed_size = uncompressed_size;
+ return;
+}
+
+
extern bool
lzma_lzma_decode_properties(lzma_options_lzma *options, uint8_t byte)
{