delta_encoder.c | delta_encoder.c | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
for (size_t i = 0; i < size; ++i) { | for (size_t i = 0; i < size; ++i) { | |||
const uint8_t tmp = coder->history[ | const uint8_t tmp = coder->history[ | |||
(distance + coder->pos) & 0xFF]; | (distance + coder->pos) & 0xFF]; | |||
coder->history[coder->pos-- & 0xFF] = buffer[i]; | coder->history[coder->pos-- & 0xFF] = buffer[i]; | |||
buffer[i] -= tmp; | buffer[i] -= tmp; | |||
} | } | |||
} | } | |||
static lzma_ret | static lzma_ret | |||
delta_encode(lzma_coder *coder, lzma_allocator *allocator, | delta_encode(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) | |||
{ | { | |||
lzma_ret ret; | lzma_ret ret; | |||
if (coder->next.code == NULL) { | if (coder->next.code == NULL) { | |||
const size_t in_avail = in_size - *in_pos; | const size_t in_avail = in_size - *in_pos; | |||
const size_t out_avail = out_size - *out_pos; | const size_t out_avail = out_size - *out_pos; | |||
const size_t size = my_min(in_avail, out_avail); | const size_t size = my_min(in_avail, out_avail); | |||
skipping to change at line 83 | skipping to change at line 83 | |||
in, in_pos, in_size, out, out_pos, out_size, | in, in_pos, in_size, out, out_pos, out_size, | |||
action); | action); | |||
encode_in_place(coder, out + out_start, *out_pos - out_start ); | encode_in_place(coder, out + out_start, *out_pos - out_start ); | |||
} | } | |||
return ret; | return ret; | |||
} | } | |||
static lzma_ret | static lzma_ret | |||
delta_encoder_update(lzma_coder *coder, lzma_allocator *allocator, | delta_encoder_update(lzma_coder *coder, const lzma_allocator *allocator, | |||
const lzma_filter *filters_null lzma_attribute((__unused__)) , | const lzma_filter *filters_null lzma_attribute((__unused__)) , | |||
const lzma_filter *reversed_filters) | const lzma_filter *reversed_filters) | |||
{ | { | |||
// Delta doesn't and will never support changing the options in | // Delta doesn't and will never support changing the options in | |||
// the middle of encoding. If the app tries to change them, we | // the middle of encoding. If the app tries to change them, we | |||
// simply ignore them. | // simply ignore them. | |||
return lzma_next_filter_update( | return lzma_next_filter_update( | |||
&coder->next, allocator, reversed_filters + 1); | &coder->next, allocator, reversed_filters + 1); | |||
} | } | |||
extern lzma_ret | extern lzma_ret | |||
lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, | lzma_delta_encoder_init(lzma_next_coder *next, const lzma_allocator *alloca tor, | |||
const lzma_filter_info *filters) | const lzma_filter_info *filters) | |||
{ | { | |||
next->code = &delta_encode; | next->code = &delta_encode; | |||
next->update = &delta_encoder_update; | next->update = &delta_encoder_update; | |||
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_encode(const void *options, uint8_t *out) | lzma_delta_props_encode(const void *options, uint8_t *out) | |||
{ | { | |||
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/ |