]> wimlib.net Git - wimlib/blobdiff - src/lookup_table.c
read_lookup_table(): guard printing by ENABLE_ERROR_MESSAGES
[wimlib] / src / lookup_table.c
index 43f9ca09148867b04ef4234d4b7b003645f3cd6c..7e1155b1ef376a4adbd280de89f2fedecf07981f 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * lookup_table.c
  *
- * Lookup table, implemented as a hash table, that maps dentries to file
- * resources.
+ * Lookup table, implemented as a hash table, that maps SHA1 message digests to
+ * data streams.
  */
 
 /*
@@ -344,12 +344,14 @@ int read_lookup_table(WIMStruct *w)
                    && !((duplicate_entry->resource_entry.flags & WIM_RESHDR_FLAG_METADATA)
                          && cur_entry->resource_entry.flags & WIM_RESHDR_FLAG_METADATA))
                {
+               #ifdef ENABLE_ERROR_MESSAGES
                        ERROR("The WIM lookup table contains two entries with the "
                              "same SHA1 message digest!");
                        ERROR("The first entry is:");
                        print_lookup_table_entry(duplicate_entry);
                        ERROR("The second entry is:");
                        print_lookup_table_entry(cur_entry);
+               #endif
                        ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
                        goto out_free_cur_entry;
                }
@@ -358,18 +360,22 @@ int read_lookup_table(WIMStruct *w)
                    && (cur_entry->resource_entry.size !=
                        cur_entry->resource_entry.original_size))
                {
+               #ifdef ENABLE_ERROR_MESSAGES
                        ERROR("Found uncompressed resource with original size "
                              "not the same as compressed size");
                        ERROR("The lookup table entry for the resource is as follows:");
                        print_lookup_table_entry(cur_entry);
+               #endif
                        ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
                        goto out_free_cur_entry;
                }
                if ((cur_entry->resource_entry.flags & WIM_RESHDR_FLAG_METADATA)
                    && cur_entry->refcnt != 1)
                {
+               #ifdef ENABLE_ERROR_MESSAGES
                        ERROR("Found metadata resource with refcnt != 1:");
                        print_lookup_table_entry(cur_entry);
+               #endif
                        ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
                        goto out_free_cur_entry;
                }
@@ -403,9 +409,11 @@ int write_lookup_table_entry(struct wim_lookup_table_entry *lte, void *__out)
        if (lte->out_refcnt == 0)
                return 0;
 
-       if (lte->output_resource_entry.flags & WIM_RESHDR_FLAG_METADATA)
-               DEBUG("Writing metadata entry at %lu (orig size = %zu)",
+       if (lte->output_resource_entry.flags & WIM_RESHDR_FLAG_METADATA) {
+               DEBUG("Writing metadata entry at %"PRIu64" "
+                     "(orig size = %"PRIu64")",
                      ftello(out), lte->output_resource_entry.original_size);
+       }
 
        p = put_resource_entry(buf, &lte->output_resource_entry);
        p = put_u16(p, lte->part_number);
@@ -593,7 +601,7 @@ int lookup_resource(WIMStruct *w, const char *path,
                return -EISDIR;
 
        if (stream_name) {
-               struct ads_entry *ads_entry;
+               struct wim_ads_entry *ads_entry;
                u16 ads_idx;
                ads_entry = inode_get_ads_entry(inode, stream_name,
                                                &ads_idx);
@@ -640,7 +648,7 @@ void inode_resolve_ltes(struct wim_inode *inode, struct wim_lookup_table *table)
 
                /* Resolve the alternate data streams */
                for (u16 i = 0; i < inode->i_num_ads; i++) {
-                       struct ads_entry *cur_entry = &inode->i_ads_entries[i];
+                       struct wim_ads_entry *cur_entry = &inode->i_ads_entries[i];
                        lte = __lookup_resource(table, cur_entry->hash);
                        cur_entry->lte = lte;
                }