lz_decoder.c | lz_decoder.c | |||
---|---|---|---|---|
skipping to change at line 124 | skipping to change at line 124 | |||
// written to the dictionary. | // written to the dictionary. | |||
if (ret != LZMA_OK || *out_pos == out_size | if (ret != LZMA_OK || *out_pos == out_size | |||
|| coder->dict.pos < coder->dict.siz e) | || coder->dict.pos < coder->dict.siz e) | |||
return ret; | return ret; | |||
} | } | |||
} | } | |||
} | } | |||
static lzma_ret | static lzma_ret | |||
lz_decode(lzma_coder *coder, | lz_decode(lzma_coder *coder, | |||
lzma_allocator *allocator lzma_attribute((__unused__)), | const lzma_allocator *allocator lzma_attribute((__unused__)) , | |||
const uint8_t *restrict in, size_t *restrict in_pos, | const uint8_t *restrict in, size_t *restrict in_pos, | |||
size_t in_size, uint8_t *restrict out, | size_t in_size, uint8_t *restrict out, | |||
size_t *restrict out_pos, size_t out_size, | size_t *restrict out_pos, size_t out_size, | |||
lzma_action action) | lzma_action action) | |||
{ | { | |||
if (coder->next.code == NULL) | if (coder->next.code == NULL) | |||
return decode_buffer(coder, in, in_pos, in_size, | return decode_buffer(coder, in, in_pos, in_size, | |||
out, out_pos, out_size); | out, out_pos, out_size); | |||
// We aren't the last coder in the chain, we need to decode | // We aren't the last coder in the chain, we need to decode | |||
skipping to change at line 181 | skipping to change at line 181 | |||
else if (ret != LZMA_OK) | else if (ret != LZMA_OK) | |||
return ret; | return ret; | |||
else if (coder->next_finished && *out_pos < out_size) | else if (coder->next_finished && *out_pos < out_size) | |||
return LZMA_DATA_ERROR; | return LZMA_DATA_ERROR; | |||
} | } | |||
return LZMA_OK; | return LZMA_OK; | |||
} | } | |||
static void | static void | |||
lz_decoder_end(lzma_coder *coder, lzma_allocator *allocator) | lz_decoder_end(lzma_coder *coder, const lzma_allocator *allocator) | |||
{ | { | |||
lzma_next_end(&coder->next, allocator); | lzma_next_end(&coder->next, allocator); | |||
lzma_free(coder->dict.buf, allocator); | lzma_free(coder->dict.buf, allocator); | |||
if (coder->lz.end != NULL) | if (coder->lz.end != NULL) | |||
coder->lz.end(coder->lz.coder, allocator); | coder->lz.end(coder->lz.coder, allocator); | |||
else | else | |||
lzma_free(coder->lz.coder, allocator); | lzma_free(coder->lz.coder, allocator); | |||
lzma_free(coder, allocator); | lzma_free(coder, allocator); | |||
return; | return; | |||
} | } | |||
extern lzma_ret | extern lzma_ret | |||
lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, | lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator , | |||
const lzma_filter_info *filters, | const lzma_filter_info *filters, | |||
lzma_ret (*lz_init)(lzma_lz_decoder *lz, | lzma_ret (*lz_init)(lzma_lz_decoder *lz, | |||
lzma_allocator *allocator, const void *options, | const 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. | // Allocate the base structure if it isn't already allocated. | |||
if (next->coder == NULL) { | if (next->coder == NULL) { | |||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator); | next->coder = lzma_alloc(sizeof(lzma_coder), allocator); | |||
if (next->coder == NULL) | if (next->coder == NULL) | |||
return LZMA_MEM_ERROR; | return LZMA_MEM_ERROR; | |||
next->code = &lz_decode; | next->code = &lz_decode; | |||
next->end = &lz_decoder_end; | next->end = &lz_decoder_end; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |