]> wimlib.net Git - wimlib/blobdiff - src/xpress-decompress.c
Comment fixes / cleanups
[wimlib] / src / xpress-decompress.c
index bf2faa1a8ec412f7a7781543df2247d7f6b3f5ac..cf08a836276f9478e20874738c55b290f6a6cb26 100644 (file)
@@ -143,22 +143,22 @@ xpress_decode_match(unsigned huffsym, unsigned window_pos,
         * currently in use, then copy the source of the match to the current
         * position. */
 
-       match_dest = window + window_pos;
-       match_src = match_dest - match_offset;
-
        if (window_pos + match_len > window_len) {
-               ERROR("XPRESS decompression error: match of length %u "
+               DEBUG("XPRESS decompression error: match of length %u "
                      "bytes overflows window", match_len);
                return -1;
        }
 
-       if (match_src < window) {
-               ERROR("XPRESS decompression error: match of length %u bytes "
+       if (match_offset > window_pos) {
+               DEBUG("XPRESS decompression error: match of length %u bytes "
                      "references data before window (match_offset = %u, "
                      "window_pos = %u)", match_len, match_offset, window_pos);
                return -1;
        }
 
+       match_dest = window + window_pos;
+       match_src = match_dest - match_offset;
+
        for (i = 0; i < match_len; i++)
                match_dest[i] = match_src[i];
 
@@ -204,13 +204,14 @@ xpress_decompress_block(struct input_bitstream * restrict istream,
 }
 
 
-/* Documented in wimlib.h */
+/* API function documented in wimlib.h  */
 WIMLIBAPI int
 wimlib_xpress_decompress(const void * restrict _compressed_data, unsigned compressed_len,
                         void * restrict uncompressed_data, unsigned uncompressed_len)
 {
        u8 lens[XPRESS_NUM_SYMBOLS];
-       u16 decode_table[(1 << XPRESS_TABLEBITS) + 2 * XPRESS_NUM_SYMBOLS];
+       u16 decode_table[(1 << XPRESS_TABLEBITS) + 2 * XPRESS_NUM_SYMBOLS]
+                       _aligned_attribute(DECODE_TABLE_ALIGNMENT);
        struct input_bitstream istream;
        u8 *lens_p;
        const u8 *compressed_data;
@@ -228,7 +229,7 @@ wimlib_xpress_decompress(const void * restrict _compressed_data, unsigned compre
         * in the first 256 bytes of the compressed data.
         */
        if (compressed_len < XPRESS_NUM_SYMBOLS / 2) {
-               ERROR("xpress_decompress(): Compressed length too short!");
+               DEBUG("xpress_decompress(): Compressed length too short!");
                return -1;
        }