Piotr Caban : msvcrt: Added _tolower_l implementation.

Alexandre Julliard julliard at winehq.org
Thu May 12 13:57:48 CDT 2011


Module: wine
Branch: master
Commit: 0ea4e668f5576170b7a4eecffb7fe7c9095afd8a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0ea4e668f5576170b7a4eecffb7fe7c9095afd8a

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu May 12 11:38:32 2011 +0200

msvcrt: Added _tolower_l implementation.

---

 dlls/msvcrt/ctype.c     |   43 +++++++++++++++++++++++++++++++++++++++++++
 dlls/msvcrt/msvcrt.spec |    4 ++--
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/ctype.c b/dlls/msvcrt/ctype.c
index 9de24e8..94815b8 100644
--- a/dlls/msvcrt/ctype.c
+++ b/dlls/msvcrt/ctype.c
@@ -380,6 +380,49 @@ int CDECL MSVCRT__toupper(int c)
 }
 
 /*********************************************************************
+ *              _tolower_l (MSVCRT.@)
+ */
+int CDECL MSVCRT__tolower_l(int c, MSVCRT__locale_t locale)
+{
+    if(!locale)
+        locale = get_locale();
+
+    if(c < 256)
+        return locale->locinfo->pclmap[c];
+
+    if(locale->locinfo->pctype[(c>>8)&255] & MSVCRT__LEADBYTE)
+    {
+        WCHAR wide, upper;
+        char str[2], *p = str;
+        *p++ = (c>>8) & 255;
+        *p++ = c & 255;
+
+        if(!MultiByteToWideChar(locale->locinfo->lc_codepage,
+                    MB_ERR_INVALID_CHARS, str, 2, &wide, 1))
+            return c;
+
+        upper = tolowerW(wide);
+        if(upper == wide)
+            return c;
+
+        WideCharToMultiByte(locale->locinfo->lc_codepage, 0,
+                &upper, 1, str, 2, NULL, NULL);
+
+        return str[0] + (str[1]<<8);
+    }
+
+    return c;
+}
+
+/*********************************************************************
+ *              tolower (MSVCRT.@)
+ */
+int CDECL MSVCRT_tolower(int c)
+{
+        return MSVCRT__tolower_l(c, NULL);
+}
+
+/*********************************************************************
  *		_tolower (MSVCRT.@)
  */
 int CDECL MSVCRT__tolower(int c)
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index ebef717..84b0194 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -977,7 +977,7 @@
 @ cdecl _time64(ptr) MSVCRT__time64
 @ extern _timezone MSVCRT___timezone
 @ cdecl _tolower(long) MSVCRT__tolower
-# stub _tolower_l(long ptr)
+@ cdecl _tolower_l(long ptr) MSVCRT__tolower_l
 @ cdecl _toupper(long) MSVCRT__toupper
 @ cdecl _toupper_l(long ptr) MSVCRT__toupper_l
 @ cdecl _towlower_l(long ptr) MSVCRT__towlower_l
@@ -1425,7 +1425,7 @@
 # stub tmpfile_s(ptr)
 @ cdecl tmpnam(ptr) MSVCRT_tmpnam
 # stub tmpnam_s(ptr long)
-@ cdecl tolower(long) ntdll.tolower
+@ cdecl tolower(long) MSVCRT_tolower
 @ cdecl toupper(long) MSVCRT_toupper
 @ cdecl towlower(long) ntdll.towlower
 @ cdecl towupper(long) ntdll.towupper




More information about the wine-cvs mailing list