Write raw-copy resources before other resources
authorEric Biggers <ebiggers3@gmail.com>
Sun, 4 Oct 2015 18:23:42 +0000 (13:23 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 4 Oct 2015 19:40:05 +0000 (14:40 -0500)
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

index 13ff87a..aa456e0 100644 (file)
@@ -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)