delta_decoder.c | delta_decoder.c | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
{ | { | |||
const size_t distance = coder->distance; | const size_t distance = coder->distance; | |||
for (size_t i = 0; i < size; ++i) { | for (size_t i = 0; i < size; ++i) { | |||
buffer[i] += coder->history[(distance + coder->pos) & 0xFF]; | buffer[i] += coder->history[(distance + coder->pos) & 0xFF]; | |||
coder->history[coder->pos-- & 0xFF] = buffer[i]; | coder->history[coder->pos-- & 0xFF] = buffer[i]; | |||
} | } | |||
} | } | |||
static lzma_ret | static lzma_ret | |||
delta_decode(lzma_coder *coder, lzma_allocator *allocator, | delta_decode(lzma_coder *coder, const lzma_allocator *allocator, | |||
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, lzma_action actio n) | size_t *restrict out_pos, size_t out_size, lzma_action actio n) | |||
{ | { | |||
assert(coder->next.code != NULL); | assert(coder->next.code != NULL); | |||
const size_t out_start = *out_pos; | const size_t out_start = *out_pos; | |||
const lzma_ret ret = coder->next.code(coder->next.coder, allocator, | const lzma_ret ret = coder->next.code(coder->next.coder, allocator, | |||
in, in_pos, in_size, out, out_pos, out_size, | in, in_pos, in_size, out, out_pos, out_size, | |||
action); | action); | |||
decode_buffer(coder, out + out_start, *out_pos - out_start); | decode_buffer(coder, out + out_start, *out_pos - out_start); | |||
return ret; | return ret; | |||
} | } | |||
extern lzma_ret | extern lzma_ret | |||
lzma_delta_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, | lzma_delta_decoder_init(lzma_next_coder *next, const lzma_allocator *alloca tor, | |||
const lzma_filter_info *filters) | const lzma_filter_info *filters) | |||
{ | { | |||
next->code = &delta_decode; | next->code = &delta_decode; | |||
return lzma_delta_coder_init(next, allocator, filters); | return lzma_delta_coder_init(next, allocator, filters); | |||
} | } | |||
extern lzma_ret | extern lzma_ret | |||
lzma_delta_props_decode(void **options, lzma_allocator *allocator, | lzma_delta_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; | |||
lzma_options_delta *opt | lzma_options_delta *opt | |||
= lzma_alloc(sizeof(lzma_options_delta), allocator); | = lzma_alloc(sizeof(lzma_options_delta), allocator); | |||
if (opt == NULL) | if (opt == NULL) | |||
return LZMA_MEM_ERROR; | return LZMA_MEM_ERROR; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 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/ |