chartype2 *out);
extern utf16lechar *
-utf16le_dupz(const utf16lechar *ustr, size_t usize);
+utf16le_dupz(const void *ustr, size_t usize);
#if !TCHAR_IS_UTF16LE
DECLARE_CHAR_CONVERSION_FUNCTIONS(utf16le, tstr, utf16lechar, tchar);
/* Read the filename if present. Note: if the filename is empty, there
* is no null terminator following it. */
if (file_name_nbytes) {
- dentry->file_name = utf16le_dupz((const utf16lechar *)p,
- file_name_nbytes);
+ dentry->file_name = utf16le_dupz(p, file_name_nbytes);
if (dentry->file_name == NULL) {
ret = WIMLIB_ERR_NOMEM;
goto err_free_dentry;
/* Read the short filename if present. Note: if there is no short
* filename, there is no null terminator following it. */
if (short_name_nbytes) {
- dentry->short_name = utf16le_dupz((const utf16lechar *)p,
- short_name_nbytes);
+ dentry->short_name = utf16le_dupz(p, short_name_nbytes);
if (dentry->short_name == NULL) {
ret = WIMLIB_ERR_NOMEM;
goto err_free_dentry;
return (n1 < n2) ? -1 : 1;
}
-/* Duplicate a UTF16-LE string which may not be null-terminated. */
+/* Duplicate a UTF16-LE string. The input string might not be null terminated
+ * and might be misaligned, but the returned string is guaranteed to be null
+ * terminated and properly aligned. */
utf16lechar *
-utf16le_dupz(const utf16lechar *ustr, size_t usize)
+utf16le_dupz(const void *ustr, size_t usize)
{
utf16lechar *dup = MALLOC(usize + sizeof(utf16lechar));
if (dup) {
if (dentry->is_win32_name) {
node = lookup_dos_name(map, dentry->d_inode->i_ino);
if (node) {
- dentry->short_name = utf16le_dupz((const utf16lechar *)node->dos_name,
+ dentry->short_name = utf16le_dupz(node->dos_name,
node->name_nbytes);
if (!dentry->short_name)
return WIMLIB_ERR_NOMEM;