#include <errno.h>
#include <fcntl.h>
-#ifndef __WIN32__
-# include <langinfo.h>
-#endif
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include "wimlib/file_io.h"
#include "wimlib/integrity.h"
#include "wimlib/metadata.h"
-#include "wimlib/ntfs_3g.h" /* for libntfs3g_global_init() */
#include "wimlib/security.h"
#include "wimlib/wim.h"
#include "wimlib/xml.h"
int ret;
WIMStruct *wim;
- ret = wimlib_global_init(WIMLIB_INIT_FLAG_ASSUME_UTF8);
+ ret = wimlib_global_init(0);
if (ret)
return ret;
if (!wim)
return WIMLIB_ERR_NOMEM;
- wim->xml_info = xml_new_info_struct();
- wim->blob_table = new_blob_table(64);
- if (!wim->xml_info || !wim->blob_table) {
- wimlib_free(wim);
- return WIMLIB_ERR_NOMEM;
- }
-
- /* Fill in wim->hdr with default values */
+ /* Fill in wim->hdr with default values */
wim->hdr.magic = WIM_MAGIC;
wim->hdr.wim_version = WIM_VERSION_DEFAULT;
- wim->hdr.flags = 0;
- wim->hdr.chunk_size = 0;
- generate_guid(wim->hdr.guid);
wim->hdr.part_number = 1;
wim->hdr.total_parts = 1;
- wim->hdr.image_count = 0;
- wim->hdr.boot_idx = 0;
-
wim->compression_type = WIMLIB_COMPRESSION_TYPE_NONE;
- wim->chunk_size = wim->hdr.chunk_size;
- /* Set the output compression type */
+ /* Set the output compression type */
wim->out_compression_type = ctype;
wim->out_chunk_size = wim_default_nonsolid_chunk_size(ctype);
+ /* Allocate an empty XML info and blob table */
+ wim->xml_info = xml_new_info_struct();
+ wim->blob_table = new_blob_table(64);
+ if (!wim->xml_info || !wim->blob_table) {
+ wimlib_free(wim);
+ return WIMLIB_ERR_NOMEM;
+ }
+
*wim_ret = wim;
return 0;
}
WIMStruct *wim;
int ret;
- ret = wimlib_global_init(WIMLIB_INIT_FLAG_ASSUME_UTF8);
+ ret = wimlib_global_init(0);
if (ret)
return ret;
wim_decrement_refcnt(wim);
}
-static bool
-test_locale_ctype_utf8(void)
-{
-#ifdef __WIN32__
- return false;
-#else
- char *ctype = nl_langinfo(CODESET);
-
- return (strstr(ctype, "UTF-8") ||
- strstr(ctype, "UTF8") ||
- strstr(ctype, "utf8") ||
- strstr(ctype, "utf-8"));
-#endif
-}
-
/* API function documented in wimlib.h */
WIMLIBAPI u32
wimlib_get_version(void)
goto out_unlock;
xml_global_init();
- 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__
ret = win32_global_init(init_flags);
if (ret)
goto out_unlock;
#endif
- iconv_global_init();
init_upcase();
if (init_flags & WIMLIB_INIT_FLAG_DEFAULT_CASE_SENSITIVE)
default_ignore_case = false;
goto out_unlock;
xml_global_cleanup();
- iconv_global_cleanup();
#ifdef __WIN32__
win32_global_cleanup();
#endif