block_encoder.c   block_encoder.c 
skipping to change at line 46 skipping to change at line 46
lzma_vli uncompressed_size; lzma_vli uncompressed_size;
/// Position in the Check field /// Position in the Check field
size_t pos; size_t pos;
/// Check of the uncompressed data /// Check of the uncompressed data
lzma_check_state check; lzma_check_state check;
}; };
static lzma_ret static lzma_ret
block_encode(lzma_coder *coder, lzma_allocator *allocator, block_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)
{ {
// Check that our amount of input stays in proper limits. // Check that our amount of input stays in proper limits.
if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos) if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos)
return LZMA_DATA_ERROR; return LZMA_DATA_ERROR;
switch (coder->sequence) { switch (coder->sequence) {
case SEQ_CODE: { case SEQ_CODE: {
skipping to change at line 134 skipping to change at line 134
memcpy(coder->block->raw_check, coder->check.buffer.u8, memcpy(coder->block->raw_check, coder->check.buffer.u8,
check_size); check_size);
return LZMA_STREAM_END; return LZMA_STREAM_END;
} }
} }
return LZMA_PROG_ERROR; return LZMA_PROG_ERROR;
} }
static void static void
block_encoder_end(lzma_coder *coder, lzma_allocator *allocator) block_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
{ {
lzma_next_end(&coder->next, allocator); lzma_next_end(&coder->next, allocator);
lzma_free(coder, allocator); lzma_free(coder, allocator);
return; return;
} }
static lzma_ret static lzma_ret
block_encoder_update(lzma_coder *coder, lzma_allocator *allocator, block_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
const lzma_filter *filters lzma_attribute((__unused__)), const lzma_filter *filters lzma_attribute((__unused__)),
const lzma_filter *reversed_filters) const lzma_filter *reversed_filters)
{ {
if (coder->sequence != SEQ_CODE) if (coder->sequence != SEQ_CODE)
return LZMA_PROG_ERROR; return LZMA_PROG_ERROR;
return lzma_next_filter_update( return lzma_next_filter_update(
&coder->next, allocator, reversed_filters); &coder->next, allocator, reversed_filters);
} }
extern lzma_ret extern lzma_ret
lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, lzma_block_encoder_init(lzma_next_coder *next, const lzma_allocator *alloca tor,
lzma_block *block) lzma_block *block)
{ {
lzma_next_coder_init(&lzma_block_encoder_init, next, allocator); lzma_next_coder_init(&lzma_block_encoder_init, next, allocator);
if (block == NULL) if (block == NULL)
return LZMA_PROG_ERROR; return LZMA_PROG_ERROR;
// The contents of the structure may depend on the version so // The contents of the structure may depend on the version so
// check the version first. // check the version first.
if (block->version != 0) if (block->version > 1)
return LZMA_OPTIONS_ERROR; return LZMA_OPTIONS_ERROR;
// If the Check ID is not supported, we cannot calculate the check a nd // If the Check ID is not supported, we cannot calculate the check a nd
// thus not create a proper Block. // thus not create a proper Block.
if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX) if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX)
return LZMA_PROG_ERROR; return LZMA_PROG_ERROR;
if (!lzma_check_is_supported(block->check)) if (!lzma_check_is_supported(block->check))
return LZMA_UNSUPPORTED_CHECK; return LZMA_UNSUPPORTED_CHECK;
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 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/