Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b44ebda3
Commit
b44ebda3
authored
Jun 29, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add strtok_s and wcstok_s.
Implementation copied from msvcrt. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7c70b939
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+2
-0
string.c
dlls/ntdll/string.c
+27
-0
wcstring.c
dlls/ntdll/wcstring.c
+27
-0
No files found.
dlls/ntdll/ntdll.spec
View file @
b44ebda3
...
...
@@ -1604,6 +1604,7 @@
@ cdecl strrchr(str long)
@ cdecl strspn(str str)
@ cdecl strstr(str str)
@ cdecl strtok_s(str str ptr)
@ cdecl strtol(str ptr long)
@ cdecl strtoul(str ptr long)
@ varargs swprintf(ptr wstr) NTDLL_swprintf
...
...
@@ -1637,6 +1638,7 @@
@ cdecl wcsspn(wstr wstr)
@ cdecl wcsstr(wstr wstr)
@ cdecl wcstok(wstr wstr)
@ cdecl wcstok_s(wstr wstr ptr)
@ cdecl wcstol(wstr ptr long)
@ cdecl wcstombs(ptr ptr long)
@ cdecl wcstoul(wstr ptr long)
...
...
dlls/ntdll/string.c
View file @
b44ebda3
...
...
@@ -795,6 +795,33 @@ int CDECL _tolower(int c)
}
/*********************************************************************
* strtok_s (NTDLL.@)
*/
char
*
__cdecl
strtok_s
(
char
*
str
,
const
char
*
delim
,
char
**
ctx
)
{
char
*
next
;
if
(
!
delim
||
!
ctx
)
return
NULL
;
if
(
!
str
)
{
str
=
*
ctx
;
if
(
!
str
)
return
NULL
;
}
while
(
*
str
&&
strchr
(
delim
,
*
str
))
str
++
;
if
(
!*
str
)
{
*
ctx
=
str
;
return
NULL
;
}
next
=
str
+
1
;
while
(
*
next
&&
!
strchr
(
delim
,
*
next
))
next
++
;
if
(
*
next
)
*
next
++
=
0
;
*
ctx
=
next
;
return
str
;
}
static
int
char_to_int
(
char
c
)
{
if
(
'0'
<=
c
&&
c
<=
'9'
)
return
c
-
'0'
;
...
...
dlls/ntdll/wcstring.c
View file @
b44ebda3
...
...
@@ -456,6 +456,33 @@ LPWSTR __cdecl wcstok( LPWSTR str, LPCWSTR delim )
/*********************************************************************
* wcstok_s (NTDLL.@)
*/
wchar_t
*
__cdecl
wcstok_s
(
wchar_t
*
str
,
const
wchar_t
*
delim
,
wchar_t
**
ctx
)
{
wchar_t
*
next
;
if
(
!
delim
||
!
ctx
)
return
NULL
;
if
(
!
str
)
{
str
=
*
ctx
;
if
(
!
str
)
return
NULL
;
}
while
(
*
str
&&
wcschr
(
delim
,
*
str
))
str
++
;
if
(
!*
str
)
{
*
ctx
=
str
;
return
NULL
;
}
next
=
str
+
1
;
while
(
*
next
&&
!
wcschr
(
delim
,
*
next
))
next
++
;
if
(
*
next
)
*
next
++
=
0
;
*
ctx
=
next
;
return
str
;
}
/*********************************************************************
* wcstombs (NTDLL.@)
*/
size_t
__cdecl
wcstombs
(
char
*
dst
,
const
WCHAR
*
src
,
size_t
n
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment