Comment lines that may produce compiler warnings
authorEric Biggers <ebiggers3@gmail.com>
Mon, 31 Dec 2012 23:57:27 +0000 (17:57 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 31 Dec 2012 23:57:27 +0000 (17:57 -0600)
src/decompress.c
src/write.c

index 5c308b2d7bd2cdfba9425fc41c8cdf7abed11219..c5e739110783e5f3921c83e3e14a6f19af649a82 100644 (file)
@@ -167,6 +167,10 @@ int make_huffman_decode_table(u16 decode_table[],  unsigned num_syms,
                const unsigned entries_per_long = sizeof(unsigned long) /
                                                  sizeof(decode_table[0]);
                if (num_entries >= entries_per_long) {
+                       /* Fill in the Huffman decode table entries one unsigned
+                        * long at a time.  On 32-bit systems this is 2 entries
+                        * per store, while on 64-bit systems this is 4 entries
+                        * per store. */
                        wimlib_assert2(decode_table_pos % entries_per_long == 0);
                        BUILD_BUG_ON(sizeof(unsigned long) != 4 &&
                                     sizeof(unsigned long) != 8);
@@ -176,14 +180,21 @@ int make_huffman_decode_table(u16 decode_table[],  unsigned num_syms,
                        unsigned long v = sym;
                        if (sizeof(unsigned long) >= 4)
                                v |= v << 16;
-                       if (sizeof(unsigned long) >= 8)
+                       if (sizeof(unsigned long) >= 8) {
+                               /* This may produce a compiler warning if an
+                                * unsigned long is 32 bits, but this won't be
+                                * executed unless an unsigned long is at least
+                                * 64 bits anyway. */
                                v |= v << 32;
+                       }
                        do {
                                *p++ = v;
                        } while (--n);
 
                        decode_table_pos += num_entries;
                } else {
+                       /* Fill in the Huffman decode table entries one 16-bit
+                        * integer at a time. */
                        do {
                                decode_table[decode_table_pos++] = sym;
                        } while (--num_entries);
index 777fa2c01b7089bfb2c76a5213157e1b4a6e8ab4..86730ff7fec7a1158b6ed8bed305ec784b9375aa 100644 (file)
@@ -1867,7 +1867,9 @@ out_ftruncate:
        if (ret != 0 && !(write_flags & WIMLIB_WRITE_FLAG_NO_LOOKUP_TABLE)) {
                WARNING("Truncating `%s' to its original size (%"PRIu64" bytes)",
                        w->filename, old_wim_end);
-               truncate(w->filename, old_wim_end);
+               /* Return value of truncate() is ignored because this is already
+                * an error path. */
+               (void)truncate(w->filename, old_wim_end);
        }
        w->wim_locked = 0;
        return ret;