index_encoder.c | index_encoder.c | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
/// Position in integers | /// Position in integers | |||
size_t pos; | size_t pos; | |||
/// CRC32 of the List of Records field | /// CRC32 of the List of Records field | |||
uint32_t crc32; | uint32_t crc32; | |||
}; | }; | |||
static lzma_ret | static lzma_ret | |||
index_encode(lzma_coder *coder, | index_encode(lzma_coder *coder, | |||
lzma_allocator *allocator lzma_attribute((__unused__)), | const lzma_allocator *allocator lzma_attribute((__unused__)) , | |||
const uint8_t *restrict in lzma_attribute((__unused__)), | const uint8_t *restrict in lzma_attribute((__unused__)), | |||
size_t *restrict in_pos lzma_attribute((__unused__)), | size_t *restrict in_pos lzma_attribute((__unused__)), | |||
size_t in_size lzma_attribute((__unused__)), | size_t in_size lzma_attribute((__unused__)), | |||
uint8_t *restrict out, size_t *restrict out_pos, | uint8_t *restrict out, size_t *restrict out_pos, | |||
size_t out_size, | size_t out_size, | |||
lzma_action action lzma_attribute((__unused__))) | lzma_action action lzma_attribute((__unused__))) | |||
{ | { | |||
// Position where to start calculating CRC32. The idea is that we | // Position where to start calculating CRC32. The idea is that we | |||
// need to call lzma_crc32() only once per call to index_encode(). | // need to call lzma_crc32() only once per call to index_encode(). | |||
const size_t out_start = *out_pos; | const size_t out_start = *out_pos; | |||
skipping to change at line 159 | skipping to change at line 159 | |||
out: | out: | |||
// Update the CRC32. | // Update the CRC32. | |||
coder->crc32 = lzma_crc32(out + out_start, | coder->crc32 = lzma_crc32(out + out_start, | |||
*out_pos - out_start, coder->crc32); | *out_pos - out_start, coder->crc32); | |||
return ret; | return ret; | |||
} | } | |||
static void | static void | |||
index_encoder_end(lzma_coder *coder, lzma_allocator *allocator) | index_encoder_end(lzma_coder *coder, const lzma_allocator *allocator) | |||
{ | { | |||
lzma_free(coder, allocator); | lzma_free(coder, allocator); | |||
return; | return; | |||
} | } | |||
static void | static void | |||
index_encoder_reset(lzma_coder *coder, const lzma_index *i) | index_encoder_reset(lzma_coder *coder, const lzma_index *i) | |||
{ | { | |||
lzma_index_iter_init(&coder->iter, i); | lzma_index_iter_init(&coder->iter, i); | |||
coder->sequence = SEQ_INDICATOR; | coder->sequence = SEQ_INDICATOR; | |||
coder->index = i; | coder->index = i; | |||
coder->pos = 0; | coder->pos = 0; | |||
coder->crc32 = 0; | coder->crc32 = 0; | |||
return; | return; | |||
} | } | |||
extern lzma_ret | extern lzma_ret | |||
lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, | lzma_index_encoder_init(lzma_next_coder *next, const lzma_allocator *alloca tor, | |||
const lzma_index *i) | const lzma_index *i) | |||
{ | { | |||
lzma_next_coder_init(&lzma_index_encoder_init, next, allocator); | lzma_next_coder_init(&lzma_index_encoder_init, next, allocator); | |||
if (i == NULL) | if (i == NULL) | |||
return LZMA_PROG_ERROR; | return LZMA_PROG_ERROR; | |||
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) | |||
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/ |