]> wimlib.net Git - wimlib/blobdiff - src/decomp.c
More timestamp changes: Set timestamp on extracted files
[wimlib] / src / decomp.c
index 20f11030ee1562ae9fdeb80014949ef7be2f2069..c9e0398f74eea5b7f767d9c923635d7d6c8058c7 100644 (file)
@@ -1,24 +1,26 @@
 /*
  * decomp.c
  *
- * Functions too long to declare as inline in decomp.h.
- *
+ * Functions used for decompression.
+ */
+
+/*
  * Copyright (C) 2012 Eric Biggers
  *
- * wimlib - Library for working with WIM files 
+ * This file is part of wimlib, a library for working with WIM files.
  *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option) any
- * later version.
+ * wimlib is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
  *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this library; if not, write to the Free Software Foundation, Inc., 59
- * Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with wimlib; if not, see http://www.gnu.org/licenses/.
  */
 
 #include "decomp.h"
@@ -44,10 +46,9 @@ int bitstream_read_bytes(struct input_bitstream *stream, size_t n, void *dest)
        /* Get the rest directly from the pointer to the data.  Of course, it's
         * necessary to check there are really n bytes available. */
        if (n > stream->data_bytes_left) {
-               ERROR("Unexpected end of input when "
-                               "reading %zu bytes from bitstream "
-                               "(only have %u bytes left)\n", n,
-                               stream->data_bytes_left);
+               ERROR("Unexpected end of input when reading %zu bytes from "
+                     "bitstream (only have %u bytes left)",
+                     n, stream->data_bytes_left);
                return 1;
        }
        memcpy(p, stream->data, n);
@@ -86,7 +87,7 @@ int align_input_bitstream(struct input_bitstream *stream,
                        ret = bitstream_ensure_bits(stream, 16);
                        if (ret != 0) {
                                ERROR("Unexpected end of input when "
-                                               "aligning bitstream!\n");
+                                     "aligning bitstream");
                                return ret;
                        }
                }
@@ -192,9 +193,8 @@ int make_huffman_decode_table(u16 decode_table[],  uint num_syms,
                         * tree.  */
                        if (decode_table_pos >= table_num_entries) {
                                ERROR("Huffman decoding table overrun: "
-                                               "pos = %u, num_entries = %u\n",
-                                               decode_table_pos, 
-                                               table_num_entries);
+                                     "pos = %u, num_entries = %u",
+                                     decode_table_pos, table_num_entries);
                                return 1;
                        }
 
@@ -258,7 +258,7 @@ int make_huffman_decode_table(u16 decode_table[],  uint num_syms,
                        uint i = current_code >> (code_len - num_bits);
 
                        if (i >= (1 << num_bits)) {
-                               ERROR("Invalid canonical Huffman code!\n");
+                               ERROR("Invalid canonical Huffman code");
                                return 1;
                        }
 
@@ -316,11 +316,10 @@ int make_huffman_decode_table(u16 decode_table[],  uint num_syms,
 
                for (uint i = 0; i < num_syms; i++) {
                        if (lens[i] != 0) {
-                               ERROR("Lengths do not form a valid "
-                                               "canonical Huffman tree "
-                                               "(only filled %u of %u decode "
-                                               "table slots)!\n", decode_table_pos, 
-                                               table_num_entries);
+                               ERROR("Lengths do not form a valid canonical "
+                                     "Huffman tree (only filled %u of %u "
+                                     "decode table slots)",
+                                     decode_table_pos, table_num_entries);
                                return 1;
                        }
                }
@@ -358,7 +357,7 @@ static int read_huffsym_near_end_of_input(struct input_bitstream *istream,
                bitstream_remove_bits(istream, key_size);
                do {
                        if (bitsleft == 0) {
-                               ERROR("Input stream exhausted!\n");
+                               ERROR("Input stream exhausted");
                                return 1;
                        }
                        key_bits = sym + bitstream_peek_bits(istream, 1);