X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fsplit.c;h=8370ab3b30a30b136b9ebc7119cec100f1c10691;hb=cfc2cfc859a047e24d002aa149f73d45d4979d24;hp=25cca9f92310d13923b58fc34cc7d62604c6f858;hpb=53d4db68e30bf45b983c59f91e5e2a3e039e1426;p=wimlib diff --git a/src/split.c b/src/split.c index 25cca9f9..8370ab3b 100644 --- a/src/split.c +++ b/src/split.c @@ -49,15 +49,17 @@ static int finish_swm(WIMStruct *w, struct lookup_table_entry *lte_chain_head, off_t lookup_table_offset = ftello(w->out_fp); int ret; - DEBUG("Writing lookup table for SWM (offset %"PRIu64")\n", + DEBUG("Writing lookup table for SWM (offset %"PRIu64")", lookup_table_offset); while (lte_chain_head != NULL) { + print_lookup_table_entry(lte_chain_head); + ret = write_lookup_table_entry(lte_chain_head, w->out_fp); if (ret != 0) return ret; struct lookup_table_entry *prev = lte_chain_head; - lte_chain_head = prev->next_lte_in_swm; + lte_chain_head = lte_chain_head->next_lte_in_swm; prev->next_lte_in_swm = NULL; } off_t xml_data_offset = ftello(w->out_fp); @@ -107,12 +109,12 @@ static int copy_resource_to_swm(struct lookup_table_entry *lte, void *__args) if (args->write_flags & WIMLIB_OPEN_FLAG_SHOW_PROGRESS) printf("Writing `%s' (%"PRIu64" of %"PRIu64" bytes, " - "%.0f%% done)\n", - args->swm_base_name, - args->total_bytes_written, - args->total_bytes, - (double)args->total_bytes_written / - (double)args->total_bytes * 100.0); + "%.0f%% done)\n", + args->swm_base_name, + args->total_bytes_written, + args->total_bytes, + (double)args->total_bytes_written / + (double)args->total_bytes * 100.0); ret = begin_write(w, args->swm_base_name, args->write_flags); if (ret != 0) @@ -184,10 +186,11 @@ WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name, w->write_metadata = true; for (int i = 0; i < w->hdr.image_count; i++) { - struct lookup_table_entry *metadata_lte; - metadata_lte = w->image_metadata[i].lookup_table_entry; + DEBUG("Writing metadata resource %d", i); + + metadata_lte = w->image_metadata[i].metadata_lte; ret = copy_resource(metadata_lte, w); if (ret != 0) return ret; @@ -240,7 +243,7 @@ WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name, FILE *fp = fopen(p, "r+b"); if (!fp) { - ERROR("Failed to open `%s': %m\n", p); + ERROR_WITH_ERRNO("Failed to open `%s'", p); return WIMLIB_ERR_OPEN; } u8 buf[4]; @@ -250,12 +253,13 @@ WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name, if (fseek(fp, 40, SEEK_SET) != 0 || fwrite(buf, 1, sizeof(buf), fp) != sizeof(buf) || fclose(fp) != 0) { - ERROR("Error overwriting header of `%s': %m\n", name); + ERROR_WITH_ERRNO("Error overwriting header of `%s'", + name); return WIMLIB_ERR_WRITE; } } if (write_flags & WIMLIB_OPEN_FLAG_SHOW_PROGRESS) - printf("Done!\n"); + puts("Done!"); wimlib_free(w); return 0; }