From fc938fc3886f0c8cacdbc83148484b55a32ca8e7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 4 Oct 2015 13:23:42 -0500 Subject: [PATCH 1/1] Write raw-copy resources before other resources As another preparation for adding compaction support, always write "raw copy" resources before other resources. In the non-compaction case, any order can be used. --- src/write.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/write.c b/src/write.c index 13ff87a7..aa456e07 100644 --- a/src/write.c +++ b/src/write.c @@ -1505,8 +1505,13 @@ write_blob_list(struct list_head *blob_list, out_ctype, out_chunk_size, &raw_copy_blobs); - if (num_nonraw_bytes == 0) - goto out_write_raw_copy_resources; + /* Copy any compressed resources for which the raw data can be reused + * without decompression. */ + ret = write_raw_copy_resources(&raw_copy_blobs, ctx.out_fd, + &ctx.progress_data); + + if (ret || num_nonraw_bytes == 0) + goto out_destroy_context; /* Unless uncompressed output was required, allocate a chunk_compressor * to do compression. There are serial and parallel implementations of @@ -1606,12 +1611,6 @@ write_blob_list(struct list_head *blob_list, wimlib_assert(offset_in_res == reshdr.uncompressed_size); } -out_write_raw_copy_resources: - /* Copy any compressed resources for which the raw data can be reused - * without decompression. */ - ret = write_raw_copy_resources(&raw_copy_blobs, ctx.out_fd, - &ctx.progress_data); - out_destroy_context: FREE(ctx.chunk_csizes); if (ctx.compressor) -- 2.43.0