Piotr Caban : msvcrt: Added _strupr_s_l implementation.

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


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

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

msvcrt: Added _strupr_s_l implementation.

---

 dlls/msvcrt/msvcrt.spec |    8 +++---
 dlls/msvcrt/string.c    |   62 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 678a2c9..1766dbf 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -954,10 +954,10 @@
 @ cdecl -ret64 _strtoui64(str ptr long) MSVCRT_strtoui64
 @ cdecl -ret64 _strtoui64_l(str ptr long ptr) MSVCRT_strtoui64_l
 # stub _strtoul_l(str ptr long ptr)
-@ cdecl _strupr(str) ntdll._strupr
-# stub _strupr_l(str ptr)
-# stub _strupr_s(str long)
-# stub _strupr_s_l(str long ptr)
+@ cdecl _strupr(str)
+@ cdecl _strupr_l(str ptr)
+@ cdecl _strupr_s(str long)
+@ cdecl _strupr_s_l(str long ptr)
 # stub _strxfrm_l(ptr str long ptr)
 @ cdecl _swab(str str long) MSVCRT__swab
 @ varargs _swprintf(ptr wstr) MSVCRT_swprintf
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c
index 10a86c5..8316ff7 100644
--- a/dlls/msvcrt/string.c
+++ b/dlls/msvcrt/string.c
@@ -113,6 +113,68 @@ int CDECL _strlwr(char *str)
 }
 
 /*********************************************************************
+ *              _strupr_s_l (MSVCRT.@)
+ */
+int CDECL _strupr_s_l(char *str, MSVCRT_size_t len, MSVCRT__locale_t locale)
+{
+    char *ptr = str;
+
+    if(!locale)
+        locale = get_locale();
+
+    if (!str || !len)
+    {
+        *MSVCRT__errno() = MSVCRT_EINVAL;
+        return MSVCRT_EINVAL;
+    }
+
+    while (len && *ptr)
+    {
+        len--;
+        ptr++;
+    }
+
+    if (!len)
+    {
+        str[0] = '\0';
+        *MSVCRT__errno() = MSVCRT_EINVAL;
+        return MSVCRT_EINVAL;
+    }
+
+    while (*str)
+    {
+        *str = MSVCRT__toupper_l(*str, locale);
+        str++;
+    }
+
+    return 0;
+}
+
+/*********************************************************************
+ *              _strupr_s (MSVCRT.@)
+ */
+int CDECL _strupr_s(char *str, MSVCRT_size_t len)
+{
+    return _strupr_s_l(str, len, NULL);
+}
+
+/*********************************************************************
+ *              _strupr_l (MSVCRT.@)
+ */
+int CDECL _strupr_l(char *str, MSVCRT__locale_t locale)
+{
+    return _strupr_s_l(str, -1, locale);
+}
+
+/*********************************************************************
+ *              _strupr (MSVCRT.@)
+ */
+int CDECL _strupr(char *str)
+{
+    return _strupr_s_l(str, -1, NULL);
+}
+
+/*********************************************************************
  *		_strnset (MSVCRT.@)
  */
 char* CDECL MSVCRT__strnset(char* str, int value, MSVCRT_size_t len)




More information about the wine-cvs mailing list