Commit 52415cab authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Optimize _strupr implementation in C locale.

Don't write to input buffer when there's nothing to change. Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 1184f9d9
......@@ -117,6 +117,7 @@ char* CDECL MSVCRT__strlwr(char *str)
*/
int CDECL MSVCRT__strupr_s_l(char *str, MSVCRT_size_t len, MSVCRT__locale_t locale)
{
MSVCRT_pthreadlocinfo locinfo;
char *ptr = str;
if (!str || !len)
......@@ -138,10 +139,27 @@ int CDECL MSVCRT__strupr_s_l(char *str, MSVCRT_size_t len, MSVCRT__locale_t loca
return MSVCRT_EINVAL;
}
while (*str)
if(!locale)
locinfo = get_locinfo();
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_CTYPE])
{
*str = MSVCRT__toupper_l((unsigned char)*str, locale);
str++;
while (*str)
{
if (*str >= 'a' && *str <= 'z')
*str -= 'a' - 'A';
str++;
}
}
else
{
while (*str)
{
*str = MSVCRT__toupper_l((unsigned char)*str, locale);
str++;
}
}
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment