Piotr Caban : msvcrt: Use internal tolower implementation.

Alexandre Julliard julliard at winehq.org
Tue Mar 26 16:43:14 CDT 2019


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Mar 26 11:31:01 2019 +0100

msvcrt: Use internal tolower implementation.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/file.c   |  5 +++--
 dlls/msvcrt/mbcs.c   |  6 +++---
 dlls/msvcrt/string.c | 24 +++++++++++++-----------
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index af769dc..4fffd89 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -3020,8 +3020,9 @@ int CDECL MSVCRT_stat64(const char* path, struct MSVCRT__stat64 * buf)
     /* executable? */
     if (plen > 6 && path[plen-4] == '.')  /* shortest exe: "\x.exe" */
     {
-      unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) |
-                                 (tolower(path[plen-3]) << 16);
+      unsigned int ext = MSVCRT__tolower_l(path[plen-1], NULL) |
+          (MSVCRT__tolower_l(path[plen-2], NULL) << 8) |
+          (MSVCRT__tolower_l(path[plen-3], NULL) << 16);
       if (ext == EXE || ext == BAT || ext == CMD || ext == COM)
           mode |= ALL_S_IEXEC;
     }
diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index 1ea8163..4234c06 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -404,7 +404,7 @@ unsigned int CDECL _mbctolower(unsigned int c)
       FIXME("Handle MBC chars\n");
       return c;
     }
-    return tolower(c); /* ASCII CP or SB char */
+    return MSVCRT__tolower_l(c, NULL); /* ASCII CP or SB char */
 }
 
 /*********************************************************************
@@ -1909,7 +1909,7 @@ unsigned char* CDECL _mbslwr(unsigned char* s)
       *s++=c;
     }
   }
-  else for ( ; *s; s++) *s = tolower(*s);
+  else for ( ; *s; s++) *s = MSVCRT__tolower_l(*s, NULL);
   return ret;
 }
 
@@ -1943,7 +1943,7 @@ int CDECL _mbslwr_s(unsigned char* s, MSVCRT_size_t len)
       *s++=c;
     }
   }
-  else for ( ; *s && len > 0; s++, len--) *s = tolower(*s);
+  else for ( ; *s && len > 0; s++, len--) *s = MSVCRT__tolower_l(*s, NULL);
   if (*s)
   {
     *s = '\0';
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c
index 96f67e0..219ce50 100644
--- a/dlls/msvcrt/string.c
+++ b/dlls/msvcrt/string.c
@@ -362,23 +362,25 @@ static double strtod_helper(const char *str, char **end, MSVCRT__locale_t locale
         p++;
 
 #if _MSVCR_VER >= 140
-    if(tolower(p[0]) == 'i' && tolower(p[1]) == 'n' && tolower(p[2]) == 'f') {
+    if(MSVCRT__tolower_l(p[0], locale) == 'i' && MSVCRT__tolower_l(p[1], locale) == 'n'
+            && MSVCRT__tolower_l(p[2], locale) == 'f') {
         if(end)
             *end = (char*) &p[3];
-        if(tolower(p[3]) == 'i' && tolower(p[4]) == 'n' && tolower(p[5]) == 'i' &&
-           tolower(p[6]) == 't' && tolower(p[7]) == 'y' && end)
+        if(MSVCRT__tolower_l(p[3], locale) == 'i' && MSVCRT__tolower_l(p[4], locale) == 'n'
+            && MSVCRT__tolower_l(p[5], locale) == 'i' && MSVCRT__tolower_l(p[6], locale) == 't'
+            && MSVCRT__tolower_l(p[7], locale) == 'y' && end)
             *end = (char*) &p[8];
         return sign*INFINITY;
     }
-    if(tolower(p[0]) == 'n' &&
-       tolower(p[1]) == 'a' &&
-       tolower(p[2]) == 'n') {
+    if(MSVCRT__tolower_l(p[0], locale) == 'n' &&
+       MSVCRT__tolower_l(p[1], locale) == 'a' &&
+       MSVCRT__tolower_l(p[2], locale) == 'n') {
         if(end)
             *end = (char*) &p[3];
         return NAN;
     }
 
-    if(p[0] == '0' && tolower(p[1]) == 'x') {
+    if(p[0] == '0' && MSVCRT__tolower_l(p[1], locale) == 'x') {
         base = 16;
         expcnt = 2;
         p += 2;
@@ -963,7 +965,7 @@ __int64 CDECL MSVCRT_strtoi64_l(const char *nptr, char **endptr, int base, MSVCR
     } else if(*nptr == '+')
         nptr++;
 
-    if((base==0 || base==16) && *nptr=='0' && tolower(*(nptr+1))=='x') {
+    if((base==0 || base==16) && *nptr=='0' && MSVCRT__tolower_l(*(nptr+1), locale)=='x') {
         base = 16;
         nptr += 2;
     }
@@ -976,7 +978,7 @@ __int64 CDECL MSVCRT_strtoi64_l(const char *nptr, char **endptr, int base, MSVCR
     }
 
     while(*nptr) {
-        char cur = tolower(*nptr);
+        char cur = MSVCRT__tolower_l(*nptr, locale);
         int v;
 
         if(cur>='0' && cur<='9') {
@@ -1215,7 +1217,7 @@ unsigned __int64 CDECL MSVCRT_strtoui64_l(const char *nptr, char **endptr, int b
     } else if(*nptr == '+')
         nptr++;
 
-    if((base==0 || base==16) && *nptr=='0' && tolower(*(nptr+1))=='x') {
+    if((base==0 || base==16) && *nptr=='0' && MSVCRT__tolower_l(*(nptr+1), locale)=='x') {
         base = 16;
         nptr += 2;
     }
@@ -1228,7 +1230,7 @@ unsigned __int64 CDECL MSVCRT_strtoui64_l(const char *nptr, char **endptr, int b
     }
 
     while(*nptr) {
-        char cur = tolower(*nptr);
+        char cur = MSVCRT__tolower_l(*nptr, locale);
         int v;
 
         if(cur>='0' && cur<='9') {




More information about the wine-cvs mailing list