array_size = num_streams * sizeof(array[0]);
array = MALLOC(array_size);
- if (!array)
+ if (array == NULL)
return WIMLIB_ERR_NOMEM;
cur = stream_list->next;
for (i = 0; i < num_streams; i++) {
#define WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE 50
static int
-validate_resource(const struct wim_resource_spec *rspec,
- u64 offset_save, u64 size_save)
+validate_resource(const struct wim_resource_spec *rspec)
{
struct wim_lookup_table_entry *lte;
if (!list_is_singular(&rspec->lte_list)) {
else
lte->flags &= ~WIM_RESHDR_FLAG_COMPRESSED;
- if (!(lte->flags & WIM_RESHDR_FLAG_CONCAT)) {
- lte->offset_in_res = offset_save;
- lte->size = size_save;
- }
-
if (lte->offset_in_res + lte->size < lte->size ||
lte->offset_in_res + lte->size > rspec->uncompressed_size)
{
struct wim_lookup_table *table;
struct wim_lookup_table_entry *cur_entry, *duplicate_entry;
struct wim_resource_spec *cur_rspec;
- u64 size_save;
- u64 offset_save;
void *buf;
BUILD_BUG_ON(sizeof(struct wim_lookup_table_entry_disk) !=
* simply a single normal entry by itself. */
if (cur_rspec != NULL) {
- ret = validate_resource(cur_rspec, offset_save,
- size_save);
+ ret = validate_resource(cur_rspec);
if (ret)
goto out_free_cur_entry;
}
ret = WIMLIB_ERR_NOMEM;
goto out_free_cur_entry;
}
- offset_save = reshdr.offset_in_wim;
- size_save = reshdr.size_in_wim;
wim_res_hdr_to_spec(&reshdr, wim, cur_rspec);
+ if (reshdr.flags & WIM_RESHDR_FLAG_CONCAT) {
+ cur_rspec->size_in_wim = 0;
+ cur_rspec->uncompressed_size = 0;
+ }
} else if (is_zero_hash(cur_entry->hash)) {
/* Found the resource specification for the run. */
cur_rspec->offset_in_wim = reshdr.offset_in_wim;
cur_rspec->flags);
free_lookup_table_entry(cur_entry);
continue;
- } else {
+ }
+
+ if (reshdr.flags & WIM_RESHDR_FLAG_CONCAT) {
/* Continuing the run with another stream. */
DEBUG("Continuing concat run with stream: "
"%"PRIu64" uncompressed bytes @ resource offset %"PRIu64")",
cur_entry->size = reshdr.size_in_wim;
cur_entry->flags = reshdr.flags;
} else {
- /* These may be overwritten in validate_resource() if
- * the run turns out to be a concatenation. */
cur_entry->offset_in_res = 0;
cur_entry->size = reshdr.uncompressed_size;
cur_entry->flags = reshdr.flags;
+ cur_rspec = NULL;
}
if (is_zero_hash(cur_entry->hash)) {
}
if (cur_rspec != NULL) {
- ret = validate_resource(cur_rspec, offset_save, size_save);
+ ret = validate_resource(cur_rspec);
if (ret)
goto out_free_cur_entry;
}