1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

Take advantage of return_if_error() in block_decoder.c.

This commit is contained in:
Lasse Collin 2008-01-08 23:11:59 +02:00
parent 97d5fa8207
commit 379fbbe84d

View file

@ -152,7 +152,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
const size_t in_start = *in_pos; const size_t in_start = *in_pos;
const size_t out_start = *out_pos; const size_t out_start = *out_pos;
lzma_ret ret = coder->next.code(coder->next.coder, const lzma_ret ret = coder->next.code(coder->next.coder,
allocator, in, in_pos, in_size, allocator, in, in_pos, in_size,
out, out_pos, out_size, action); out, out_pos, out_size, action);
@ -174,9 +174,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
if (ret != LZMA_STREAM_END) if (ret != LZMA_STREAM_END)
return ret; return ret;
ret = update_sequence(coder); return_if_error(update_sequence(coder));
if (ret != LZMA_OK)
return ret;
break; break;
} }
@ -213,10 +211,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
++*in_pos; ++*in_pos;
if (++coder->pos == lzma_check_sizes[coder->options->check]) { if (++coder->pos == lzma_check_sizes[coder->options->check]) {
const lzma_ret ret = update_sequence(coder); return_if_error(update_sequence(coder));
if (ret != LZMA_OK)
return ret;
coder->pos = 0; coder->pos = 0;
} }
@ -225,7 +220,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
case SEQ_UNCOMPRESSED_SIZE: { case SEQ_UNCOMPRESSED_SIZE: {
const size_t in_start = *in_pos; const size_t in_start = *in_pos;
lzma_ret ret = lzma_vli_decode(&coder->tmp, const lzma_ret ret = lzma_vli_decode(&coder->tmp,
&coder->pos, in, in_pos, in_size); &coder->pos, in, in_pos, in_size);
if (update_size(&coder->total_size, *in_pos - in_start, if (update_size(&coder->total_size, *in_pos - in_start,
@ -241,9 +236,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
coder->pos = 0; coder->pos = 0;
coder->tmp = 0; coder->tmp = 0;
ret = update_sequence(coder); return_if_error(update_sequence(coder));
if (ret != LZMA_OK)
return ret;
break; break;
} }
@ -251,7 +244,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
case SEQ_BACKWARD_SIZE: { case SEQ_BACKWARD_SIZE: {
const size_t in_start = *in_pos; const size_t in_start = *in_pos;
lzma_ret ret = lzma_vli_decode(&coder->tmp, const lzma_ret ret = lzma_vli_decode(&coder->tmp,
&coder->pos, in, in_pos, in_size); &coder->pos, in, in_pos, in_size);
const size_t in_used = *in_pos - in_start; const size_t in_used = *in_pos - in_start;
@ -269,9 +262,7 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
- coder->size_of_backward_size) - coder->size_of_backward_size)
return LZMA_DATA_ERROR; return LZMA_DATA_ERROR;
ret = update_sequence(coder); return_if_error(update_sequence(coder));
if (ret != LZMA_OK)
return ret;
break; break;
} }