| lzma2_decoder.c | lzma2_decoder.c | |||
|---|---|---|---|---|
| skipping to change at line 209 | skipping to change at line 209 | |||
| default: | default: | |||
| assert(0); | assert(0); | |||
| return LZMA_PROG_ERROR; | return LZMA_PROG_ERROR; | |||
| } | } | |||
| return LZMA_OK; | return LZMA_OK; | |||
| } | } | |||
| static void | static void | |||
| lzma2_decoder_end(lzma_coder *coder, lzma_allocator *allocator) | lzma2_decoder_end(lzma_coder *coder, const lzma_allocator *allocator) | |||
| { | { | |||
| assert(coder->lzma.end == NULL); | assert(coder->lzma.end == NULL); | |||
| lzma_free(coder->lzma.coder, allocator); | lzma_free(coder->lzma.coder, allocator); | |||
| lzma_free(coder, allocator); | lzma_free(coder, allocator); | |||
| return; | return; | |||
| } | } | |||
| static lzma_ret | static lzma_ret | |||
| lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, | lzma2_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator, | |||
| const void *opt, lzma_lz_options *lz_options) | const void *opt, lzma_lz_options *lz_options) | |||
| { | { | |||
| if (lz->coder == NULL) { | if (lz->coder == NULL) { | |||
| lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); | lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); | |||
| if (lz->coder == NULL) | if (lz->coder == NULL) | |||
| return LZMA_MEM_ERROR; | return LZMA_MEM_ERROR; | |||
| lz->code = &lzma2_decode; | lz->code = &lzma2_decode; | |||
| lz->end = &lzma2_decoder_end; | lz->end = &lzma2_decoder_end; | |||
| skipping to change at line 246 | skipping to change at line 246 | |||
| lz->coder->sequence = SEQ_CONTROL; | lz->coder->sequence = SEQ_CONTROL; | |||
| lz->coder->need_properties = true; | lz->coder->need_properties = true; | |||
| lz->coder->need_dictionary_reset = options->preset_dict == NULL | lz->coder->need_dictionary_reset = options->preset_dict == NULL | |||
| || options->preset_dict_size == 0; | || options->preset_dict_size == 0; | |||
| return lzma_lzma_decoder_create(&lz->coder->lzma, | return lzma_lzma_decoder_create(&lz->coder->lzma, | |||
| allocator, options, lz_options); | allocator, options, lz_options); | |||
| } | } | |||
| extern lzma_ret | extern lzma_ret | |||
| lzma_lzma2_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, | lzma_lzma2_decoder_init(lzma_next_coder *next, const lzma_allocator *alloca tor, | |||
| const lzma_filter_info *filters) | const lzma_filter_info *filters) | |||
| { | { | |||
| // LZMA2 can only be the last filter in the chain. This is enforced | // LZMA2 can only be the last filter in the chain. This is enforced | |||
| // by the raw_decoder initialization. | // by the raw_decoder initialization. | |||
| assert(filters[1].init == NULL); | assert(filters[1].init == NULL); | |||
| return lzma_lz_decoder_init(next, allocator, filters, | return lzma_lz_decoder_init(next, allocator, filters, | |||
| &lzma2_decoder_init); | &lzma2_decoder_init); | |||
| } | } | |||
| extern uint64_t | extern uint64_t | |||
| lzma_lzma2_decoder_memusage(const void *options) | lzma_lzma2_decoder_memusage(const void *options) | |||
| { | { | |||
| return sizeof(lzma_coder) | return sizeof(lzma_coder) | |||
| + lzma_lzma_decoder_memusage_nocheck(options); | + lzma_lzma_decoder_memusage_nocheck(options); | |||
| } | } | |||
| extern lzma_ret | extern lzma_ret | |||
| lzma_lzma2_props_decode(void **options, lzma_allocator *allocator, | lzma_lzma2_props_decode(void **options, const lzma_allocator *allocator, | |||
| const uint8_t *props, size_t props_size) | const uint8_t *props, size_t props_size) | |||
| { | { | |||
| if (props_size != 1) | if (props_size != 1) | |||
| return LZMA_OPTIONS_ERROR; | return LZMA_OPTIONS_ERROR; | |||
| // Check that reserved bits are unset. | // Check that reserved bits are unset. | |||
| if (props[0] & 0xC0) | if (props[0] & 0xC0) | |||
| return LZMA_OPTIONS_ERROR; | return LZMA_OPTIONS_ERROR; | |||
| // Decode the dictionary size. | // Decode the dictionary size. | |||
| 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/ | ||||