Jacek Caban : winemac: Directly use wine_unix_to_nt_file_name.
Alexandre Julliard
julliard at winehq.org
Wed May 25 16:51:47 CDT 2022
Module: wine
Branch: master
Commit: 58343b63273402e3a7393cd84ef3a75d2bced3b7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=58343b63273402e3a7393cd84ef3a75d2bced3b7
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon May 23 20:24:12 2022 +0200
winemac: Directly use wine_unix_to_nt_file_name.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
dlls/winemac.drv/clipboard.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c
index b11b56a9ac4..93706680470 100644
--- a/dlls/winemac.drv/clipboard.c
+++ b/dlls/winemac.drv/clipboard.c
@@ -565,6 +565,29 @@ static void *import_html(CFDataRef data, size_t *ret_size)
}
+/* based on wine_get_dos_file_name */
+static WCHAR *get_dos_file_name(const char *path)
+{
+ ULONG len = strlen(path) + 9; /* \??\unix prefix */
+ WCHAR *ret;
+
+ if (!(ret = malloc(len * sizeof(WCHAR)))) return NULL;
+ if (wine_unix_to_nt_file_name(path, ret, &len))
+ {
+ free(ret);
+ return NULL;
+ }
+
+ if (ret[5] == ':')
+ {
+ /* get rid of the \??\ prefix */
+ memmove(ret, ret + 4, (len - 4) * sizeof(WCHAR));
+ }
+ else ret[1] = '\\';
+ return ret;
+}
+
+
/**************************************************************************
* import_nsfilenames_to_hdrop
*
@@ -632,7 +655,7 @@ static void *import_nsfilenames_to_hdrop(CFDataRef data, size_t *ret_size)
WARN("failed to get file-system representation for %s\n", debugstr_cf(name));
goto done;
}
- paths[i] = wine_get_dos_file_name(buffer);
+ paths[i] = get_dos_file_name(buffer);
if (!paths[i])
{
WARN("failed to get DOS path for %s\n", debugstr_a(buffer));
@@ -668,8 +691,7 @@ static void *import_nsfilenames_to_hdrop(CFDataRef data, size_t *ret_size)
done:
if (paths)
{
- for (i = 0; i < count; i++)
- HeapFree(GetProcessHeap(), 0, paths[i]);
+ for (i = 0; i < count; i++) free(paths[i]);
HeapFree(GetProcessHeap(), 0, paths);
}
HeapFree(GetProcessHeap(), 0, buffer);
More information about the wine-cvs
mailing list