]> wimlib.net Git - wimlib/blobdiff - src/integrity.c
wim_inode_set_symlink(): Fix typo in comment
[wimlib] / src / integrity.c
index 0af6fdddeb9687f4881e2f352538148cb91addd8..fd656a4e272f1c908dffb522e91884a7da435500 100644 (file)
@@ -30,7 +30,7 @@
 #endif
 
 #include "wimlib/assert.h"
-#include "wimlib/buffer_io.h"
+#include "wimlib/endianness.h"
 #include "wimlib/error.h"
 #include "wimlib/file_io.h"
 #include "wimlib/integrity.h"
@@ -51,8 +51,8 @@ struct integrity_table {
        u32 size;
        u32 num_entries;
        u32 chunk_size;
-       u8  sha1sums[0][20];
-};
+       u8  sha1sums[][20];
+} _packed_attribute;
 
 static int
 calculate_chunk_sha1(int in_fd, size_t this_chunk_size,
@@ -504,7 +504,7 @@ verify_integrity(int in_fd, const tchar *filename,
  * ~10 MiB chunks of the WIM match up with the values given in the integrity
  * table.
  *
- * @w:
+ * @wim:
  *     The WIM, opened for reading, and with the header already read.
  *
  * @progress_func
@@ -520,20 +520,20 @@ verify_integrity(int in_fd, const tchar *filename,
  *     information.
  */
 int
-check_wim_integrity(WIMStruct *w, wimlib_progress_func_t progress_func)
+check_wim_integrity(WIMStruct *wim, wimlib_progress_func_t progress_func)
 {
        int ret;
        u64 bytes_to_check;
        struct integrity_table *table;
        u64 end_lookup_table_offset;
 
-       if (w->hdr.integrity.offset == 0) {
+       if (wim->hdr.integrity.offset == 0) {
                DEBUG("No integrity information.");
                return WIM_INTEGRITY_NONEXISTENT;
        }
 
-       end_lookup_table_offset = w->hdr.lookup_table_res_entry.offset +
-                                 w->hdr.lookup_table_res_entry.size;
+       end_lookup_table_offset = wim->hdr.lookup_table_res_entry.offset +
+                                 wim->hdr.lookup_table_res_entry.size;
 
        if (end_lookup_table_offset < WIM_HEADER_DISK_SIZE) {
                ERROR("WIM lookup table ends before WIM header ends!");
@@ -542,11 +542,11 @@ check_wim_integrity(WIMStruct *w, wimlib_progress_func_t progress_func)
 
        bytes_to_check = end_lookup_table_offset - WIM_HEADER_DISK_SIZE;
 
-       ret = read_integrity_table(&w->hdr.integrity, w->in_fd,
+       ret = read_integrity_table(&wim->hdr.integrity, wim->in_fd,
                                   bytes_to_check, &table);
        if (ret)
                return ret;
-       ret = verify_integrity(w->in_fd, w->filename, table,
+       ret = verify_integrity(wim->in_fd, wim->filename, table,
                               bytes_to_check, progress_func);
        FREE(table);
        return ret;