diff options
author | Brad King <brad.king@kitware.com> | 2018-08-06 13:56:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-08-06 14:22:56 (GMT) |
commit | 6166adfdd40954767f3c4e40da502285ed16a9b1 (patch) | |
tree | de3266371a950f40937f4f5a248c44244215755d /Utilities/cmliblzma/liblzma/lz/lz_decoder.c | |
parent | 0a3912112d11514ba1652423e21a767507ce75fb (diff) | |
download | CMake-6166adfdd40954767f3c4e40da502285ed16a9b1.zip CMake-6166adfdd40954767f3c4e40da502285ed16a9b1.tar.gz CMake-6166adfdd40954767f3c4e40da502285ed16a9b1.tar.bz2 |
liblzma: Revert "Port from C99 to C89/90"
Revert commit v3.1.0-rc1~255^2~5 (liblzma: Port from C99 to C89/90,
2014-07-13). We now compile as C99 or above except on MSVC where
we will use another approach.
Diffstat (limited to 'Utilities/cmliblzma/liblzma/lz/lz_decoder.c')
-rw-r--r-- | Utilities/cmliblzma/liblzma/lz/lz_decoder.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c index f45984e..d74085c 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c @@ -69,17 +69,13 @@ decode_buffer(lzma_coder *coder, size_t *restrict out_pos, size_t out_size) { while (true) { - size_t copy_size; - size_t dict_start; - lzma_ret ret; - // Wrap the dictionary if needed. if (coder->dict.pos == coder->dict.size) coder->dict.pos = 0; // Store the current dictionary position. It is needed to know // where to start copying to the out[] buffer. - dict_start = coder->dict.pos; + const size_t dict_start = coder->dict.pos; // Calculate how much we allow coder->lz.code() to decode. // It must not decode past the end of the dictionary @@ -90,13 +86,13 @@ decode_buffer(lzma_coder *coder, coder->dict.size - coder->dict.pos); // Call the coder->lz.code() to do the actual decoding. - ret = coder->lz.code( + const lzma_ret ret = coder->lz.code( coder->lz.coder, &coder->dict, in, in_pos, in_size); // Copy the decoded data from the dictionary to the out[] // buffer. - copy_size = coder->dict.pos - dict_start; + const size_t copy_size = coder->dict.pos - dict_start; assert(copy_size <= out_size - *out_pos); memcpy(out + *out_pos, coder->dict.buf + dict_start, copy_size); @@ -143,15 +139,13 @@ lz_decode(lzma_coder *coder, // We aren't the last coder in the chain, we need to decode // our input to a temporary buffer. while (*out_pos < out_size) { - lzma_ret ret; - // Fill the temporary buffer if it is empty. if (!coder->next_finished && coder->temp.pos == coder->temp.size) { coder->temp.pos = 0; coder->temp.size = 0; - ret = coder->next.code( + const lzma_ret ret = coder->next.code( coder->next.coder, allocator, in, in_pos, in_size, coder->temp.buffer, &coder->temp.size, @@ -173,7 +167,7 @@ lz_decode(lzma_coder *coder, return LZMA_OK; } - ret = decode_buffer(coder, coder->temp.buffer, + const lzma_ret ret = decode_buffer(coder, coder->temp.buffer, &coder->temp.pos, coder->temp.size, out, out_pos, out_size); @@ -212,8 +206,6 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)) { - lzma_lz_options lz_options; - // Allocate the base structure if it isn't already allocated. if (next->coder == NULL) { next->coder = lzma_alloc(sizeof(lzma_coder), allocator); @@ -231,6 +223,7 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, // Allocate and initialize the LZ-based decoder. It will also give // us the dictionary size. + lzma_lz_options lz_options; return_if_error(lz_init(&next->coder->lz, allocator, filters[0].options, &lz_options)); |