*/
/*
- * Copyright (C) 2012 Eric Biggers
+ * Copyright (C) 2012, 2013 Eric Biggers
*
* This file is part of wimlib, a library for working with WIM files.
*
unsigned s;
unsigned i;
unsigned len;
- u32 R[3];
ret = bitstream_ensure_bits(istream, 4);
if (ret != 0) {
{
unsigned main_element;
unsigned end;
+ int ret;
int match_len;
- int ret = 0;
end = window_pos + block_size;
while (window_pos < end) {
ret = read_huffsym_using_maintree(istream, tables,
&main_element);
if (ret != 0)
- break;
+ return ret;
if (main_element < LZX_NUM_CHARS) {
/* literal: 0 to LZX_NUM_CHARS - 1 */
window[window_pos++] = main_element;
} else {
/* match: LZX_NUM_CHARS to LZX_MAINTREE_NUM_SYMBOLS - 1 */
- ret = lzx_decode_match(main_element,
- block_type,
- end - window_pos,
- window,
- window_pos,
- tables,
- queue,
- istream);
- if (ret < 0)
- break;
- window_pos += ret;
+ match_len = lzx_decode_match(main_element,
+ block_type,
+ end - window_pos,
+ window,
+ window_pos,
+ tables,
+ queue,
+ istream);
+ if (match_len < 0)
+ return match_len;
+ window_pos += match_len;
}
}
return 0;
LZX_DEBUG("LZX_BLOCKTYPE_UNCOMPRESSED");
if (istream.data_bytes_left < block_size) {
ERROR("Unexpected end of input when "
- "reading %zu bytes from LZX bitstream "
+ "reading %u bytes from LZX bitstream "
"(only have %u bytes left)",
block_size, istream.data_bytes_left);
return -1;