Alexandre Julliard : ntdll: Use wcslwr() instead of tolowerW().

Alexandre Julliard julliard at winehq.org
Fri Mar 27 16:14:39 CDT 2020


Module: wine
Branch: master
Commit: 59d0ad23c7cf7fcb5696e3893cbf7ab1746b0320
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=59d0ad23c7cf7fcb5696e3893cbf7ab1746b0320

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Mar 27 13:44:03 2020 +0100

ntdll: Use wcslwr() instead of tolowerW().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/directory.c  | 10 ++++++----
 dlls/ntdll/ntdll_misc.h |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index b8a23c4d4d..993a661015 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -2344,7 +2344,7 @@ static NTSTATUS get_dos_device( const WCHAR *name, UINT name_len, ANSI_STRING *u
     strcat( unix_name, "/dosdevices/" );
     dev = unix_name + strlen(unix_name);
 
-    for (i = 0; i < name_len; i++) dev[i] = (char)tolowerW(name[i]);
+    for (i = 0; i < name_len; i++) dev[i] = (name[i] >= 'A' && name[i] <= 'Z' ? name[i] + 32 : name[i]);
     dev[i] = 0;
 
     /* special case for drive devices */
@@ -2755,7 +2755,7 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI
     struct stat st;
     char *unix_name;
     int pos, ret, name_len, unix_len, prefix_len;
-    WCHAR prefix[MAX_DIR_ENTRY_LEN];
+    WCHAR prefix[MAX_DIR_ENTRY_LEN + 1];
     BOOLEAN is_unix = FALSE;
 
     name     = nameW->Buffer;
@@ -2784,8 +2784,10 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI
     if (pos == name_len)  /* no subdir, plain DOS device */
         return get_dos_device( name, name_len, unix_name_ret );
 
-    for (prefix_len = 0; prefix_len < pos; prefix_len++)
-        prefix[prefix_len] = tolowerW(name[prefix_len]);
+    prefix_len = pos;
+    memcpy( prefix, name, prefix_len * sizeof(WCHAR) );
+    prefix[prefix_len] = 0;
+    wcslwr( prefix );
 
     name += prefix_len;
     name_len -= prefix_len;
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 84493bc493..20feabf56b 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -298,6 +298,7 @@ ULONG  __cdecl NTDLL_wcstoul( LPCWSTR s, LPWSTR *end, INT base );
 
 #define wcsicmp(s1,s2) NTDLL__wcsicmp(s1,s2)
 #define wcsnicmp(s1,s2,n) NTDLL__wcsnicmp(s1,s2,n)
+#define wcslwr(s) NTDLL__wcslwr(s)
 #define wcsupr(s) NTDLL__wcsupr(s)
 
 /* convert from straight ASCII to Unicode without depending on the current codepage */




More information about the wine-cvs mailing list