Commit a15c55e6 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add strlwr_s and wcslwr_s.

parent b44ebda3
......@@ -1521,6 +1521,7 @@
@ cdecl _strcmpi(str str) _stricmp
@ cdecl _stricmp(str str)
@ cdecl _strlwr(str)
@ cdecl _strlwr_s(str long)
@ cdecl _strnicmp(str str long)
@ cdecl _strupr(str)
@ cdecl _tolower(long)
......@@ -1536,6 +1537,7 @@
@ cdecl _vswprintf(ptr wstr ptr)
@ cdecl _wcsicmp(wstr wstr)
@ cdecl _wcslwr(wstr)
@ cdecl _wcslwr_s(wstr long)
@ cdecl _wcsnicmp(wstr wstr long)
@ cdecl _wcsupr(wstr)
@ cdecl _wtoi(wstr)
......
......@@ -444,7 +444,7 @@ errno_t __cdecl strncpy_s( char *dst, size_t len, const char *src, size_t count
*/
size_t __cdecl strnlen( const char *str, size_t len )
{
const char *s = str;
const char *s;
for (s = str; len && *s; s++, len--) ;
return s - str;
}
......@@ -620,12 +620,29 @@ LPSTR __cdecl _strupr( LPSTR str )
LPSTR __cdecl _strlwr( LPSTR str )
{
LPSTR ret = str;
for ( ; *str; str++) *str = tolower(*str);
for ( ; *str; str++) if (*str >= 'A' && *str <= 'Z') *str += 'a' - 'A';
return ret;
}
/*********************************************************************
* _strlwr_s (NTDLL.@)
*/
errno_t __cdecl _strlwr_s( char *str, size_t len )
{
if (!str) return EINVAL;
if (strnlen( str, len ) == len)
{
*str = 0;
return EINVAL;
}
_strlwr( str );
return 0;
}
/*********************************************************************
* toupper (NTDLL.@)
*/
int __cdecl toupper( int c )
......
......@@ -108,14 +108,26 @@ int __cdecl _wcsicmp( LPCWSTR str1, LPCWSTR str2 )
LPWSTR __cdecl _wcslwr( LPWSTR str )
{
WCHAR *ret = str;
for ( ; *str; str++) if (*str >= 'A' && *str <= 'Z') *str += 'a' - 'A';
return ret;
}
while (*str)
/*********************************************************************
* _wcslwr_s (NTDLL.@)
*/
errno_t __cdecl _wcslwr_s( wchar_t *str, size_t len )
{
if (!str) return EINVAL;
if (wcsnlen( str, len ) == len)
{
WCHAR ch = *str;
if (ch >= 'A' && ch <= 'Z') ch += 32;
*str++ = ch;
*str = 0;
return EINVAL;
}
return ret;
_wcslwr( str );
return 0;
}
......@@ -380,7 +392,7 @@ errno_t __cdecl wcsncpy_s( wchar_t *dst, size_t len, const wchar_t *src, size_t
*/
size_t __cdecl wcsnlen( const WCHAR *str, size_t len )
{
const WCHAR *s = str;
const WCHAR *s;
for (s = str; len && *s; s++, len--) ;
return s - str;
}
......
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