msvcrt: Implemented wcstok_s.

This commit is contained in:
Eric Pouech 2010-11-02 22:03:59 +01:00 committed by Alexandre Julliard
parent 5437c72fe1
commit 4b6d5fd583
5 changed files with 22 additions and 10 deletions

View File

@ -1653,7 +1653,7 @@
@ cdecl wcsstr(wstr wstr) msvcrt.wcsstr
@ cdecl wcstod(wstr ptr) msvcrt.wcstod
@ cdecl wcstok(wstr wstr) msvcrt.wcstok
@ stub wcstok_s
@ cdecl wcstok_s(ptr wstr ptr) msvcrt.wcstok_s
@ cdecl wcstol(wstr ptr long) msvcrt.wcstol
@ cdecl wcstombs(ptr ptr long) msvcrt.wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) msvcrt.wcstombs_s

View File

@ -1507,7 +1507,7 @@
@ cdecl wcsstr(wstr wstr) msvcrt.wcsstr
@ cdecl wcstod(wstr ptr) msvcrt.wcstod
@ cdecl wcstok(wstr wstr) msvcrt.wcstok
@ stub wcstok_s
@ cdecl wcstok_s(ptr wstr ptr) msvcrt.wcstok_s
@ cdecl wcstol(wstr ptr long) msvcrt.wcstol
@ cdecl wcstombs(ptr ptr long) msvcrt.wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) msvcrt.wcstombs_s

View File

@ -1491,7 +1491,7 @@
@ cdecl wcsstr(wstr wstr) msvcrt.wcsstr
@ cdecl wcstod(wstr ptr) msvcrt.wcstod
@ cdecl wcstok(wstr wstr) msvcrt.wcstok
@ stub wcstok_s
@ cdecl wcstok_s(ptr wstr ptr) msvcrt.wcstok_s
@ cdecl wcstol(wstr ptr long) msvcrt.wcstol
@ cdecl wcstombs(ptr ptr long) msvcrt.wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) msvcrt.wcstombs_s

View File

@ -1457,7 +1457,7 @@
@ cdecl wcsstr(wstr wstr) ntdll.wcsstr
@ cdecl wcstod(wstr ptr) MSVCRT_wcstod
@ cdecl wcstok(wstr wstr) MSVCRT_wcstok
# stub wcstok_s
@ cdecl wcstok_s(ptr wstr ptr)
@ cdecl wcstol(wstr ptr long) ntdll.wcstol
@ cdecl wcstombs(ptr ptr long) MSVCRT_wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) MSVCRT_wcstombs_s

View File

@ -1368,25 +1368,37 @@ MSVCRT_wchar_t* CDECL MSVCRT_wcspbrk( const MSVCRT_wchar_t* str, const MSVCRT_wc
}
/*********************************************************************
* wcstok (MSVCRT.@)
* wcstok_s (MSVCRT.@)
*/
MSVCRT_wchar_t * CDECL MSVCRT_wcstok( MSVCRT_wchar_t *str, const MSVCRT_wchar_t *delim )
MSVCRT_wchar_t * CDECL wcstok_s( MSVCRT_wchar_t *str, const MSVCRT_wchar_t *delim,
MSVCRT_wchar_t **next_token )
{
thread_data_t *data = msvcrt_get_thread_data();
MSVCRT_wchar_t *ret;
if (!str)
if (!(str = data->wcstok_next)) return NULL;
if (!MSVCRT_CHECK_PMT(delim != NULL) || !MSVCRT_CHECK_PMT(next_token != NULL) ||
!MSVCRT_CHECK_PMT(str != NULL || *next_token != NULL))
{
*MSVCRT__errno() = MSVCRT_EINVAL;
return NULL;
}
if (!str) str = *next_token;
while (*str && strchrW( delim, *str )) str++;
if (!*str) return NULL;
ret = str++;
while (*str && !strchrW( delim, *str )) str++;
if (*str) *str++ = 0;
data->wcstok_next = str;
*next_token = str;
return ret;
}
/*********************************************************************
* wcstok (MSVCRT.@)
*/
MSVCRT_wchar_t * CDECL MSVCRT_wcstok( MSVCRT_wchar_t *str, const MSVCRT_wchar_t *delim )
{
return wcstok_s(str, delim, &msvcrt_get_thread_data()->wcstok_next);
}
/*********************************************************************
* wctomb (MSVCRT.@)