]> wimlib.net Git - wimlib/blobdiff - src/lzx-decompress.c
Cleanup
[wimlib] / src / lzx-decompress.c
index 06e3e0205d264e5fb20172330a96abed90100736..13b00761eff664eaf4b68b6350c35620c9d12c4e 100644 (file)
@@ -318,7 +318,6 @@ static int lzx_read_block_header(struct input_bitstream *istream,
        unsigned s;
        unsigned i;
        unsigned len;
-       u32 R[3];
 
        ret = bitstream_ensure_bits(istream, 4);
        if (ret != 0) {
@@ -747,32 +746,32 @@ static int lzx_decompress_block(int block_type, unsigned block_size,
 {
        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;
@@ -873,7 +872,7 @@ int lzx_decompress(const void *compressed_data, unsigned compressed_len,
                        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;