diff options
Diffstat (limited to 'src/liblzma/common/block_decoder.c')
-rw-r--r-- | src/liblzma/common/block_decoder.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/liblzma/common/block_decoder.c b/src/liblzma/common/block_decoder.c index 2bfe0b92..b130f567 100644 --- a/src/liblzma/common/block_decoder.c +++ b/src/liblzma/common/block_decoder.c @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////////// // /// \file block_decoder.c -/// \brief Decodes .lzma Blocks +/// \brief Decodes .xz Blocks // // Copyright (C) 2007 Lasse Collin // @@ -34,7 +34,7 @@ struct lzma_coder_s { /// Decoding options; we also write Compressed Size and Uncompressed /// Size back to this structure when the decoding has been finished. - lzma_block *options; + lzma_block *block; /// Compressed Size calculated while decoding lzma_vli compressed_size; @@ -101,10 +101,10 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator, coder->compressed_limit) || update_size(&coder->uncompressed_size, out_used, - coder->options->uncompressed_size)) + coder->block->uncompressed_size)) return LZMA_DATA_ERROR; - lzma_check_update(&coder->check, coder->options->check, + lzma_check_update(&coder->check, coder->block->check, out + out_start, out_used); if (ret != LZMA_STREAM_END) @@ -113,15 +113,15 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator, // Compressed and Uncompressed Sizes are now at their final // values. Verify that they match the values given to us. if (!is_size_valid(coder->compressed_size, - coder->options->compressed_size) + coder->block->compressed_size) || !is_size_valid(coder->uncompressed_size, - coder->options->uncompressed_size)) + coder->block->uncompressed_size)) return LZMA_DATA_ERROR; - // Copy the values into coder->options. The caller + // Copy the values into coder->block. The caller // may use this information to construct Index. - coder->options->compressed_size = coder->compressed_size; - coder->options->uncompressed_size = coder->uncompressed_size; + coder->block->compressed_size = coder->compressed_size; + coder->block->uncompressed_size = coder->uncompressed_size; coder->sequence = SEQ_PADDING; } @@ -133,7 +133,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator, while (coder->compressed_size & 3) { // We use compressed_size here just get the Padding // right. The actual Compressed Size was stored to - // coder->options already, and won't be modified by + // coder->block already, and won't be modified by // us anymore. ++coder->compressed_size; @@ -144,17 +144,17 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator, return LZMA_DATA_ERROR; } - if (coder->options->check == LZMA_CHECK_NONE) + if (coder->block->check == LZMA_CHECK_NONE) return LZMA_STREAM_END; - lzma_check_finish(&coder->check, coder->options->check); + lzma_check_finish(&coder->check, coder->block->check); coder->sequence = SEQ_CHECK; // Fall through case SEQ_CHECK: { const bool chksup = lzma_check_is_supported( - coder->options->check); + coder->block->check); while (*in_pos < in_size) { // coder->check.buffer[] may be uninitialized when @@ -168,7 +168,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator, ++*in_pos; if (++coder->check_pos == lzma_check_size( - coder->options->check)) + coder->block->check)) return LZMA_STREAM_END; } @@ -191,15 +191,15 @@ block_decoder_end(lzma_coder *coder, lzma_allocator *allocator) extern lzma_ret lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, - lzma_block *options) + lzma_block *block) { lzma_next_coder_init(lzma_block_decoder_init, next, allocator); // Validate the options. lzma_block_unpadded_size() does that for us // except for Uncompressed Size and filters. Filters are validated // by the raw decoder. - if (lzma_block_unpadded_size(options) == 0 - || !lzma_vli_is_valid(options->uncompressed_size)) + if (lzma_block_unpadded_size(block) == 0 + || !lzma_vli_is_valid(block->uncompressed_size)) return LZMA_PROG_ERROR; // Allocate and initialize *next->coder if needed. @@ -215,7 +215,7 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, // Basic initializations next->coder->sequence = SEQ_CODE; - next->coder->options = options; + next->coder->block = block; next->coder->compressed_size = 0; next->coder->uncompressed_size = 0; @@ -223,28 +223,28 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, // value so that encoded size of the Block (including Block Padding) // is still a valid VLI and a multiple of four. next->coder->compressed_limit - = options->compressed_size == LZMA_VLI_UNKNOWN + = block->compressed_size == LZMA_VLI_UNKNOWN ? (LZMA_VLI_MAX & ~LZMA_VLI_C(3)) - - options->header_size - - lzma_check_size(options->check) - : options->compressed_size; + - block->header_size + - lzma_check_size(block->check) + : block->compressed_size; // Initialize the check. It's caller's problem if the Check ID is not // supported, and the Block decoder cannot verify the Check field. - // Caller can test lzma_checks[options->check]. + // Caller can test lzma_check_is_supported(block->check). next->coder->check_pos = 0; - lzma_check_init(&next->coder->check, options->check); + lzma_check_init(&next->coder->check, block->check); // Initialize the filter chain. return lzma_raw_decoder_init(&next->coder->next, allocator, - options->filters); + block->filters); } extern LZMA_API lzma_ret -lzma_block_decoder(lzma_stream *strm, lzma_block *options) +lzma_block_decoder(lzma_stream *strm, lzma_block *block) { - lzma_next_strm_init(lzma_block_decoder_init, strm, options); + lzma_next_strm_init(lzma_block_decoder_init, strm, block); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; |