X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwim.c;h=a5044c68b2200e694c8afcde4688dac9a403f3ef;hp=25b5c3367d9e2bd7421b6889a2234f22333756a4;hb=cf373e59a7f6ff7d1fd007c1f22defe508aa67d4;hpb=394c5bd3292c0f3168416c0a5f25989e557b3cfc diff --git a/src/wim.c b/src/wim.c index 25b5c336..a5044c68 100644 --- a/src/wim.c +++ b/src/wim.c @@ -65,7 +65,7 @@ static WIMStruct * new_wim_struct() { WIMStruct *w = CALLOC(1, sizeof(WIMStruct)); -#ifdef WITH_FUSE +#if defined(WITH_FUSE) || defined(ENABLE_MULTITHREADED_COMPRESSION) if (pthread_mutex_init(&w->fp_tab_mutex, NULL) != 0) { ERROR_WITH_ERRNO("Failed to initialize mutex"); FREE(w); @@ -627,10 +627,8 @@ wim_checksum_unhashed_streams(WIMStruct *w) int ret; for (int i = 0; i < w->hdr.image_count; i++) { struct wim_lookup_table_entry *lte, *tmp; - list_for_each_entry_safe(lte, tmp, - &w->image_metadata[i]->unhashed_streams, - unhashed_list) - { + struct wim_image_metadata *imd = w->image_metadata[i]; + image_for_each_unhashed_stream_safe(lte, tmp, imd) { ret = hash_unhashed_stream(lte, w->lookup_table, NULL); if (ret) return ret; @@ -692,16 +690,17 @@ test_locale_ctype_utf8() #endif } -/* Get global memory allocations out of the way, - * single-threaded programs like 'imagex'. */ WIMLIBAPI int -wimlib_global_init() +wimlib_global_init(int init_flags) { libxml_global_init(); -#ifdef WITH_NTFS_3G - libntfs3g_global_init(); -#endif - wimlib_mbs_is_utf8 = test_locale_ctype_utf8(); + if (!(init_flags & WIMLIB_INIT_FLAG_ASSUME_UTF8)) { + wimlib_mbs_is_utf8 = test_locale_ctype_utf8(); + #ifdef WITH_NTFS_3G + if (!wimlib_mbs_is_utf8) + libntfs3g_global_init(); + #endif + } #ifdef __WIN32__ win32_global_init(); #endif