From 161fdd6a3cda7e53093314b1efbf8eb14e27db8b Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 14 May 2014 15:45:42 -0500 Subject: [PATCH] write.c: Don't default to solid mode quite as easily --- src/write.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/write.c b/src/write.c index f34481aa..e8f1ee3a 100644 --- a/src/write.c +++ b/src/write.c @@ -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; -- 2.43.0