X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwim.c;h=d833ec75b53cd66dc16055e21604497636fd4609;hb=cbd31ea4e13a4e7479b2a19dc59efd9f2dd86e5e;hp=3d173f9aefa0b38ac721fa8ac8f99aff8cc9b131;hpb=26c7f8bb32e4a32001d409f1693e0df016270ed5;p=wimlib diff --git a/src/wim.c b/src/wim.c index 3d173f9a..d833ec75 100644 --- a/src/wim.c +++ b/src/wim.c @@ -38,6 +38,8 @@ #include "wimlib/security.h" #include "wimlib/wim.h" #include "wimlib/xml.h" +#include "wimlib/compressor_ops.h" +#include "wimlib/decompressor_ops.h" #ifdef __WIN32__ # include "wimlib/win32.h" /* for realpath() replacement */ @@ -151,7 +153,12 @@ wim_chunk_size_valid(u32 chunk_size, int ctype) static u32 wim_default_chunk_size(int ctype) { - return 32768; + switch (ctype) { + case WIMLIB_COMPRESSION_TYPE_LZMS: + return 131072; + default: + return 32768; + } } /* @@ -481,12 +488,15 @@ wimlib_set_output_chunk_size(WIMStruct *wim, uint32_t chunk_size) "32768, 65536, 131072, ..., 2097152."); break; case WIMLIB_COMPRESSION_TYPE_LZMS: - ERROR("Valid chunk sizes for LZMS are 131072."); + ERROR("Valid chunk sizes for LZMS are " + "32768, 65536, 131072, ..., 67108864."); break; } return WIMLIB_ERR_INVALID_CHUNK_SIZE; } - if (chunk_size != 32768) { + if (chunk_size != 32768 && + wim->out_compression_type != WIMLIB_COMPRESSION_TYPE_LZMS) + { WARNING ("Changing the compression chunk size to any value other than\n" " the default of 32768 bytes eliminates compatibility with\n" " Microsoft's software!"); @@ -929,10 +939,10 @@ wimlib_free(WIMStruct *wim) if (filedes_valid(&wim->out_fd)) filedes_close(&wim->out_fd); - wimlib_lzx_free_context(wim->lzx_context); - free_lookup_table(wim->lookup_table); + wimlib_free_decompressor(wim->decompressor); + FREE(wim->filename); free_wim_info(wim->wim_info); if (wim->image_metadata) { @@ -995,4 +1005,6 @@ wimlib_global_cleanup(void) #ifdef __WIN32__ win32_global_cleanup(); #endif + cleanup_decompressor_params(); + cleanup_compressor_params(); }