From 322ce004aea9d6419db53b9bb77c20d6803fd009 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Wed, 23 Dec 2009 10:56:54 +0000 Subject: [PATCH] [crt] import _wcsupr_s from wine 1.1.35 svn path=/trunk/; revision=44725 --- reactos/dll/win32/msvcrt/msvcrt.def | 1 + reactos/lib/sdk/crt/string/wcs.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/reactos/dll/win32/msvcrt/msvcrt.def b/reactos/dll/win32/msvcrt/msvcrt.def index bcf3fe378c8..a78d2cc87ef 100644 --- a/reactos/dll/win32/msvcrt/msvcrt.def +++ b/reactos/dll/win32/msvcrt/msvcrt.def @@ -852,6 +852,7 @@ EXPORTS _mbsnbcpy_s wcscpy_s wcsncpy_s + _wcsupr_s _ftol2=_ftol _ftol2_sse=_ftol strcat_s diff --git a/reactos/lib/sdk/crt/string/wcs.c b/reactos/lib/sdk/crt/string/wcs.c index 145fc9ce187..00941292911 100644 --- a/reactos/lib/sdk/crt/string/wcs.c +++ b/reactos/lib/sdk/crt/string/wcs.c @@ -109,6 +109,35 @@ wchar_t* CDECL _wcsset( wchar_t* str, wchar_t c ) return ret; } +/****************************************************************** + * _wcsupr_s (MSVCRT.@) + * + */ +INT CDECL _wcsupr_s( wchar_t* str, size_t n ) +{ + wchar_t* ptr = str; + + if (!str || !n) + { + if (str) *str = '\0'; + __set_errno(EINVAL); + return EINVAL; + } + + while (n--) + { + if (!*ptr) return 0; + *ptr = toupperW(*ptr); + ptr++; + } + + /* MSDN claims that the function should return and set errno to + * ERANGE, which doesn't seem to be true based on the tests. */ + *str = '\0'; + __set_errno(EINVAL); + return EINVAL; +} + /********************************************************************* * wcstod (MSVCRT.@) */