ntdll: Update some string functions prototypes to match msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-03-27 13:36:05 +01:00
parent fd7e5741ae
commit 6226be3656
2 changed files with 36 additions and 12 deletions

View File

@ -271,6 +271,29 @@ NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR); void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
/* string functions */ /* string functions */
int __cdecl NTDLL_tolower( int c ); int __cdecl NTDLL_tolower( int c );
int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 ); int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 );
int __cdecl NTDLL__wcsicmp( LPCWSTR str1, LPCWSTR str2 );
int __cdecl NTDLL__wcsnicmp( LPCWSTR str1, LPCWSTR str2, size_t n );
int __cdecl NTDLL_wcscmp( LPCWSTR str1, LPCWSTR str2 );
int __cdecl NTDLL_wcsncmp( LPCWSTR str1, LPCWSTR str2, size_t n );
WCHAR __cdecl NTDLL_towlower( WCHAR ch );
WCHAR __cdecl NTDLL_towupper( WCHAR ch );
LPWSTR __cdecl NTDLL__wcslwr( LPWSTR str );
LPWSTR __cdecl NTDLL__wcsupr( LPWSTR str );
LPWSTR __cdecl NTDLL_wcscpy( LPWSTR dst, LPCWSTR src );
LPWSTR __cdecl NTDLL_wcscat( LPWSTR dst, LPCWSTR src );
LPWSTR __cdecl NTDLL_wcschr( LPCWSTR str, WCHAR ch );
size_t __cdecl NTDLL_wcslen( LPCWSTR str );
size_t __cdecl NTDLL_wcscspn( LPCWSTR str, LPCWSTR reject );
LPWSTR __cdecl NTDLL_wcsncat( LPWSTR s1, LPCWSTR s2, size_t n );
LPWSTR __cdecl NTDLL_wcsncpy( LPWSTR s1, LPCWSTR s2, size_t n );
LPWSTR __cdecl NTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept );
LPWSTR __cdecl NTDLL_wcsrchr( LPCWSTR str, WCHAR ch );
size_t __cdecl NTDLL_wcsspn( LPCWSTR str, LPCWSTR accept );
LPWSTR __cdecl NTDLL_wcsstr( LPCWSTR str, LPCWSTR sub );
LPWSTR __cdecl NTDLL_wcstok( LPWSTR str, LPCWSTR delim );
LONG __cdecl NTDLL_wcstol( LPCWSTR s, LPWSTR *end, INT base );
ULONG __cdecl NTDLL_wcstoul( LPCWSTR s, LPWSTR *end, INT base );
#endif #endif

View File

@ -32,6 +32,7 @@
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "winternl.h" #include "winternl.h"
#include "ntdll_misc.h"
static const unsigned short wctypes[256] = static const unsigned short wctypes[256] =
{ {
@ -89,7 +90,7 @@ static const unsigned short wctypes[256] =
/********************************************************************* /*********************************************************************
* _wcsicmp (NTDLL.@) * _wcsicmp (NTDLL.@)
*/ */
INT __cdecl NTDLL__wcsicmp( LPCWSTR str1, LPCWSTR str2 ) int __cdecl NTDLL__wcsicmp( LPCWSTR str1, LPCWSTR str2 )
{ {
for (;;) for (;;)
{ {
@ -122,7 +123,7 @@ LPWSTR __cdecl NTDLL__wcslwr( LPWSTR str )
/********************************************************************* /*********************************************************************
* _wcsnicmp (NTDLL.@) * _wcsnicmp (NTDLL.@)
*/ */
INT __cdecl NTDLL__wcsnicmp( LPCWSTR str1, LPCWSTR str2, INT n ) int __cdecl NTDLL__wcsnicmp( LPCWSTR str1, LPCWSTR str2, size_t n )
{ {
int ret = 0; int ret = 0;
for ( ; n > 0; n--, str1++, str2++) for ( ; n > 0; n--, str1++, str2++)
@ -166,7 +167,7 @@ LPWSTR __cdecl NTDLL_wcscpy( LPWSTR dst, LPCWSTR src )
/*********************************************************************** /***********************************************************************
* wcslen (NTDLL.@) * wcslen (NTDLL.@)
*/ */
INT __cdecl NTDLL_wcslen( LPCWSTR str ) size_t __cdecl NTDLL_wcslen( LPCWSTR str )
{ {
const WCHAR *s = str; const WCHAR *s = str;
while (*s) s++; while (*s) s++;
@ -197,7 +198,7 @@ LPWSTR __cdecl NTDLL_wcschr( LPCWSTR str, WCHAR ch )
/********************************************************************* /*********************************************************************
* wcscmp (NTDLL.@) * wcscmp (NTDLL.@)
*/ */
INT __cdecl NTDLL_wcscmp( LPCWSTR str1, LPCWSTR str2 ) int __cdecl NTDLL_wcscmp( LPCWSTR str1, LPCWSTR str2 )
{ {
while (*str1 && (*str1 == *str2)) { str1++; str2++; } while (*str1 && (*str1 == *str2)) { str1++; str2++; }
return *str1 - *str2; return *str1 - *str2;
@ -207,7 +208,7 @@ INT __cdecl NTDLL_wcscmp( LPCWSTR str1, LPCWSTR str2 )
/********************************************************************* /*********************************************************************
* wcscspn (NTDLL.@) * wcscspn (NTDLL.@)
*/ */
INT __cdecl NTDLL_wcscspn( LPCWSTR str, LPCWSTR reject ) size_t __cdecl NTDLL_wcscspn( LPCWSTR str, LPCWSTR reject )
{ {
const WCHAR *ptr; const WCHAR *ptr;
for (ptr = str; *ptr; ptr++) if (NTDLL_wcschr( reject, *ptr )) break; for (ptr = str; *ptr; ptr++) if (NTDLL_wcschr( reject, *ptr )) break;
@ -218,7 +219,7 @@ INT __cdecl NTDLL_wcscspn( LPCWSTR str, LPCWSTR reject )
/********************************************************************* /*********************************************************************
* wcsncat (NTDLL.@) * wcsncat (NTDLL.@)
*/ */
LPWSTR __cdecl NTDLL_wcsncat( LPWSTR s1, LPCWSTR s2, INT n ) LPWSTR __cdecl NTDLL_wcsncat( LPWSTR s1, LPCWSTR s2, size_t n )
{ {
LPWSTR ret = s1; LPWSTR ret = s1;
while (*s1) s1++; while (*s1) s1++;
@ -231,7 +232,7 @@ LPWSTR __cdecl NTDLL_wcsncat( LPWSTR s1, LPCWSTR s2, INT n )
/********************************************************************* /*********************************************************************
* wcsncmp (NTDLL.@) * wcsncmp (NTDLL.@)
*/ */
INT __cdecl NTDLL_wcsncmp( LPCWSTR str1, LPCWSTR str2, INT n ) int __cdecl NTDLL_wcsncmp( LPCWSTR str1, LPCWSTR str2, size_t n )
{ {
if (n <= 0) return 0; if (n <= 0) return 0;
while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; } while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
@ -242,7 +243,7 @@ INT __cdecl NTDLL_wcsncmp( LPCWSTR str1, LPCWSTR str2, INT n )
/********************************************************************* /*********************************************************************
* wcsncpy (NTDLL.@) * wcsncpy (NTDLL.@)
*/ */
LPWSTR __cdecl NTDLL_wcsncpy( LPWSTR s1, LPCWSTR s2, INT n ) LPWSTR __cdecl NTDLL_wcsncpy( LPWSTR s1, LPCWSTR s2, size_t n )
{ {
WCHAR *ret = s1; WCHAR *ret = s1;
while (n-- > 0) if (!(*s1++ = *s2++)) break; while (n-- > 0) if (!(*s1++ = *s2++)) break;
@ -264,7 +265,7 @@ LPWSTR __cdecl NTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept )
/********************************************************************* /*********************************************************************
* wcsrchr (NTDLL.@) * wcsrchr (NTDLL.@)
*/ */
LPWSTR __cdecl NTDLL_wcsrchr( LPWSTR str, WCHAR ch ) LPWSTR __cdecl NTDLL_wcsrchr( LPCWSTR str, WCHAR ch )
{ {
WCHAR *ret = NULL; WCHAR *ret = NULL;
do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++); do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++);
@ -275,7 +276,7 @@ LPWSTR __cdecl NTDLL_wcsrchr( LPWSTR str, WCHAR ch )
/********************************************************************* /*********************************************************************
* wcsspn (NTDLL.@) * wcsspn (NTDLL.@)
*/ */
INT __cdecl NTDLL_wcsspn( LPCWSTR str, LPCWSTR accept ) size_t __cdecl NTDLL_wcsspn( LPCWSTR str, LPCWSTR accept )
{ {
const WCHAR *ptr; const WCHAR *ptr;
for (ptr = str; *ptr; ptr++) if (!NTDLL_wcschr( accept, *ptr )) break; for (ptr = str; *ptr; ptr++) if (!NTDLL_wcschr( accept, *ptr )) break;