summaryrefslogtreecommitdiffstats
path: root/Utilities/cmliblzma/liblzma/common/index_decoder.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-08-06 13:56:41 (GMT)
committerBrad King <brad.king@kitware.com>2018-08-06 14:22:56 (GMT)
commit6166adfdd40954767f3c4e40da502285ed16a9b1 (patch)
treede3266371a950f40937f4f5a248c44244215755d /Utilities/cmliblzma/liblzma/common/index_decoder.c
parent0a3912112d11514ba1652423e21a767507ce75fb (diff)
downloadCMake-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/common/index_decoder.c')
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_decoder.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/Utilities/cmliblzma/liblzma/common/index_decoder.c b/Utilities/cmliblzma/liblzma/common/index_decoder.c
index 6c91f10..83c8a3a 100644
--- a/Utilities/cmliblzma/liblzma/common/index_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/index_decoder.c
@@ -289,7 +289,7 @@ index_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
{
- lzma_next_strm_init2(index_decoder_init, strm, i, memlimit);
+ lzma_next_strm_init(index_decoder_init, strm, i, memlimit);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
@@ -303,23 +303,21 @@ lzma_index_buffer_decode(
lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size)
{
- lzma_coder coder;
- lzma_ret ret;
-
- // Store the input start position so that we can restore it in case
- // of an error.
- const size_t in_start = *in_pos;
-
// Sanity checks
if (i == NULL || memlimit == NULL
|| in == NULL || in_pos == NULL || *in_pos > in_size)
return LZMA_PROG_ERROR;
// Initialize the decoder.
+ lzma_coder coder;
return_if_error(index_decoder_reset(&coder, allocator, i, *memlimit));
+ // Store the input start position so that we can restore it in case
+ // of an error.
+ const size_t in_start = *in_pos;
+
// Do the actual decoding.
- ret = index_decode(&coder, allocator, in, in_pos, in_size,
+ lzma_ret ret = index_decode(&coder, allocator, in, in_pos, in_size,
NULL, NULL, 0, LZMA_RUN);
if (ret == LZMA_STREAM_END) {