mirror of
https://github.com/reactos/reactos.git
synced 2024-07-12 15:45:20 +00:00
[CRT] Sync strtok_s() with Wine Staging 1.9.16 and mark strtok() as synced. CORE-11866
svn path=/trunk/; revision=72405
This commit is contained in:
parent
c7c1b36949
commit
f6aaf58005
|
@ -292,6 +292,8 @@ msvcrt -
|
|||
reactos/lib/sdk/crt/signal/xcptinfo.c # Synced to WineStaging-1.7.37
|
||||
reactos/lib/sdk/crt/string/scanf.c/h # Synced to Wine-1.7.17
|
||||
reactos/lib/sdk/crt/string/strtoi64.c # Synced to WineStaging-1.9.9
|
||||
reactos/lib/sdk/crt/string/strtok.c # Synced to WineStaging-1.9.16
|
||||
reactos/lib/sdk/crt/string/strtok_s.c # Synced to WineStaging-1.9.16
|
||||
reactos/lib/sdk/crt/string/strtoul.c # Synced to WineStaging-1.9.9
|
||||
reactos/lib/sdk/crt/strings/wcs.c # Synced at 20080611
|
||||
reactos/lib/sdk/crt/wine/heap.c # Synced at 20080529
|
||||
|
|
|
@ -294,6 +294,7 @@ list(APPEND CRT_SOURCE
|
|||
string/strtod.c
|
||||
string/strtoi64.c
|
||||
string/strtok.c
|
||||
#string/strtok_s.c
|
||||
string/strtol.c
|
||||
string/strtoul.c
|
||||
string/strtoull.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* taken from wine string.c */
|
||||
/* Taken from Wine Staging msvcrt/string.c */
|
||||
|
||||
#include <precomp.h>
|
||||
#include <internal/wine/msvcrt.h>
|
||||
|
@ -22,31 +22,3 @@ char * CDECL strtok( char *str, const char *delim )
|
|||
data->strtok_next = str;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* strtok_s (MSVCRT.@)
|
||||
*/
|
||||
char * CDECL strtok_s(char *str, const char *delim, char **ctx)
|
||||
{
|
||||
if (!MSVCRT_CHECK_PMT(delim != NULL) || !MSVCRT_CHECK_PMT(ctx != NULL) ||
|
||||
!MSVCRT_CHECK_PMT(str != NULL || *ctx != NULL)) {
|
||||
*_errno() = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!str)
|
||||
str = *ctx;
|
||||
|
||||
while(*str && strchr(delim, *str))
|
||||
str++;
|
||||
if(!*str)
|
||||
return NULL;
|
||||
|
||||
*ctx = str+1;
|
||||
while(**ctx && !strchr(delim, **ctx))
|
||||
(*ctx)++;
|
||||
if(**ctx)
|
||||
*(*ctx)++ = 0;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
30
reactos/sdk/lib/crt/string/strtok_s.c
Normal file
30
reactos/sdk/lib/crt/string/strtok_s.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* Taken from Wine Staging msvcrt/string.c */
|
||||
|
||||
#include <precomp.h>
|
||||
#include <internal/wine/msvcrt.h>
|
||||
|
||||
/*********************************************************************
|
||||
* strtok_s (MSVCRT.@)
|
||||
*/
|
||||
char * CDECL strtok_s(char *str, const char *delim, char **ctx)
|
||||
{
|
||||
if (!MSVCRT_CHECK_PMT(delim != NULL)) return NULL;
|
||||
if (!MSVCRT_CHECK_PMT(ctx != NULL)) return NULL;
|
||||
if (!MSVCRT_CHECK_PMT(str != NULL || *ctx != NULL)) return NULL;
|
||||
|
||||
if(!str)
|
||||
str = *ctx;
|
||||
|
||||
while(*str && strchr(delim, *str))
|
||||
str++;
|
||||
if(!*str)
|
||||
return NULL;
|
||||
|
||||
*ctx = str+1;
|
||||
while(**ctx && !strchr(delim, **ctx))
|
||||
(*ctx)++;
|
||||
if(**ctx)
|
||||
*(*ctx)++ = 0;
|
||||
|
||||
return str;
|
||||
}
|
Loading…
Reference in a new issue