]> wimlib.net Git - wimlib/commitdiff
write.c: Don't default to solid mode quite as easily
authorEric Biggers <ebiggers3@gmail.com>
Wed, 14 May 2014 20:45:42 +0000 (15:45 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Wed, 14 May 2014 20:46:29 +0000 (15:46 -0500)
src/write.c

index f34481aae2525b62274b9d7e9705938fd231319c..e8f1ee3a8af31f59a93e2e920f85d4bcf4d0a398 100644 (file)
@@ -1536,6 +1536,18 @@ out_destroy_context:
        return ret;
 }
 
+static int
+is_stream_packed(struct wim_lookup_table_entry *lte, void *_ignore)
+{
+       return lte_is_partial(lte);
+}
+
+static bool
+wim_has_packed_streams(WIMStruct *wim)
+{
+       return for_lookup_table_entry(wim->lookup_table, is_stream_packed, NULL);
+}
+
 static int
 wim_write_stream_list(WIMStruct *wim,
                      struct list_head *stream_list,
@@ -1550,10 +1562,15 @@ wim_write_stream_list(WIMStruct *wim,
 
        write_resource_flags = write_flags_to_resource_flags(write_flags);
 
-       /* wimlib v1.6.3: pack streams by default if the WIM version number is
-        * that usually used in solid archives.  */
-       if (wim->hdr.wim_version == WIM_VERSION_PACKED_STREAMS)
+       /* wimlib v1.6.3: pack streams by default if the WIM version has been
+        * set to WIM_VERSION_PACKED_STREAMS and at least one stream in the
+        * WIM's lookup table is located in a packed resource (may be the same
+        * WIM, or a different one in the case of export).  */
+       if (wim->hdr.wim_version == WIM_VERSION_PACKED_STREAMS &&
+           wim_has_packed_streams(wim))
+       {
                write_resource_flags |= WRITE_RESOURCE_FLAG_PACK_STREAMS;
+       }
 
        if (write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) {
                out_chunk_size = wim->out_pack_chunk_size;