Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
982f99d3
Commit
982f99d3
authored
Mar 11, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Reimplement remaining string functions to avoid depending on wine/unicode.h.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
295660b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
30 deletions
+54
-30
wcstring.c
dlls/ntdll/wcstring.c
+54
-30
No files found.
dlls/ntdll/wcstring.c
View file @
982f99d3
...
...
@@ -29,8 +29,9 @@
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winternl.h"
#include "wine/unicode.h"
static
const
unsigned
short
wctypes
[
256
]
=
{
...
...
@@ -152,56 +153,65 @@ LPWSTR __cdecl NTDLL__wcsupr( LPWSTR str )
/***********************************************************************
* wcsc
at
(NTDLL.@)
* wcsc
py
(NTDLL.@)
*/
LPWSTR
__cdecl
NTDLL_wcsc
at
(
LPWSTR
dst
,
LPCWSTR
src
)
LPWSTR
__cdecl
NTDLL_wcsc
py
(
LPWSTR
dst
,
LPCWSTR
src
)
{
return
strcatW
(
dst
,
src
);
WCHAR
*
p
=
dst
;
while
((
*
p
++
=
*
src
++
));
return
dst
;
}
/*********************************************************************
* wcs
chr
(NTDLL.@)
/*********************************************************************
**
* wcs
len
(NTDLL.@)
*/
LPWSTR
__cdecl
NTDLL_wcschr
(
LPCWSTR
str
,
WCHAR
ch
)
INT
__cdecl
NTDLL_wcslen
(
LPCWSTR
str
)
{
return
strchrW
(
str
,
ch
);
const
WCHAR
*
s
=
str
;
while
(
*
s
)
s
++
;
return
s
-
str
;
}
/*********************************************************************
* wcsc
mp
(NTDLL.@)
/*********************************************************************
**
* wcsc
at
(NTDLL.@)
*/
INT
__cdecl
NTDLL_wcscmp
(
LPCWSTR
str1
,
LPCWSTR
str2
)
LPWSTR
__cdecl
NTDLL_wcscat
(
LPWSTR
dst
,
LPCWSTR
src
)
{
return
strcmpW
(
str1
,
str2
);
NTDLL_wcscpy
(
dst
+
NTDLL_wcslen
(
dst
),
src
);
return
dst
;
}
/*********************************************************************
**
* wcsc
py
(NTDLL.@)
/*********************************************************************
* wcsc
hr
(NTDLL.@)
*/
LPWSTR
__cdecl
NTDLL_wcsc
py
(
LPWSTR
dst
,
LPCWSTR
src
)
LPWSTR
__cdecl
NTDLL_wcsc
hr
(
LPCWSTR
str
,
WCHAR
ch
)
{
return
strcpyW
(
dst
,
src
);
do
{
if
(
*
str
==
ch
)
return
(
WCHAR
*
)(
ULONG_PTR
)
str
;
}
while
(
*
str
++
);
return
NULL
;
}
/*********************************************************************
* wcsc
spn
(NTDLL.@)
* wcsc
mp
(NTDLL.@)
*/
INT
__cdecl
NTDLL_wcsc
spn
(
LPCWSTR
str
,
LPCWSTR
reject
)
INT
__cdecl
NTDLL_wcsc
mp
(
LPCWSTR
str1
,
LPCWSTR
str2
)
{
return
strcspnW
(
str
,
reject
);
while
(
*
str1
&&
(
*
str1
==
*
str2
))
{
str1
++
;
str2
++
;
}
return
*
str1
-
*
str2
;
}
/*********************************************************************
**
* wcs
le
n (NTDLL.@)
/*********************************************************************
* wcs
csp
n (NTDLL.@)
*/
INT
__cdecl
NTDLL_wcs
len
(
LPCWSTR
str
)
INT
__cdecl
NTDLL_wcs
cspn
(
LPCWSTR
str
,
LPCWSTR
reject
)
{
return
strlenW
(
str
);
const
WCHAR
*
ptr
;
for
(
ptr
=
str
;
*
ptr
;
ptr
++
)
if
(
NTDLL_wcschr
(
reject
,
*
ptr
))
break
;
return
ptr
-
str
;
}
...
...
@@ -223,7 +233,9 @@ LPWSTR __cdecl NTDLL_wcsncat( LPWSTR s1, LPCWSTR s2, INT n )
*/
INT
__cdecl
NTDLL_wcsncmp
(
LPCWSTR
str1
,
LPCWSTR
str2
,
INT
n
)
{
return
strncmpW
(
str1
,
str2
,
n
);
if
(
n
<=
0
)
return
0
;
while
((
--
n
>
0
)
&&
*
str1
&&
(
*
str1
==
*
str2
))
{
str1
++
;
str2
++
;
}
return
*
str1
-
*
str2
;
}
...
...
@@ -244,7 +256,8 @@ LPWSTR __cdecl NTDLL_wcsncpy( LPWSTR s1, LPCWSTR s2, INT n )
*/
LPWSTR
__cdecl
NTDLL_wcspbrk
(
LPCWSTR
str
,
LPCWSTR
accept
)
{
return
strpbrkW
(
str
,
accept
);
for
(
;
*
str
;
str
++
)
if
(
NTDLL_wcschr
(
accept
,
*
str
))
return
(
WCHAR
*
)(
ULONG_PTR
)
str
;
return
NULL
;
}
...
...
@@ -253,7 +266,9 @@ LPWSTR __cdecl NTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept )
*/
LPWSTR
__cdecl
NTDLL_wcsrchr
(
LPWSTR
str
,
WCHAR
ch
)
{
return
strrchrW
(
str
,
ch
);
WCHAR
*
ret
=
NULL
;
do
{
if
(
*
str
==
ch
)
ret
=
(
WCHAR
*
)(
ULONG_PTR
)
str
;
}
while
(
*
str
++
);
return
ret
;
}
...
...
@@ -262,7 +277,9 @@ LPWSTR __cdecl NTDLL_wcsrchr( LPWSTR str, WCHAR ch )
*/
INT
__cdecl
NTDLL_wcsspn
(
LPCWSTR
str
,
LPCWSTR
accept
)
{
return
strspnW
(
str
,
accept
);
const
WCHAR
*
ptr
;
for
(
ptr
=
str
;
*
ptr
;
ptr
++
)
if
(
!
NTDLL_wcschr
(
accept
,
*
ptr
))
break
;
return
ptr
-
str
;
}
...
...
@@ -271,7 +288,14 @@ INT __cdecl NTDLL_wcsspn( LPCWSTR str, LPCWSTR accept )
*/
LPWSTR
__cdecl
NTDLL_wcsstr
(
LPCWSTR
str
,
LPCWSTR
sub
)
{
return
strstrW
(
str
,
sub
);
while
(
*
str
)
{
const
WCHAR
*
p1
=
str
,
*
p2
=
sub
;
while
(
*
p1
&&
*
p2
&&
*
p1
==
*
p2
)
{
p1
++
;
p2
++
;
}
if
(
!*
p2
)
return
(
WCHAR
*
)
str
;
str
++
;
}
return
NULL
;
}
...
...
@@ -305,13 +329,13 @@ INT __cdecl NTDLL_wcstombs( LPSTR dst, LPCWSTR src, INT n )
if
(
!
dst
)
{
RtlUnicodeToMultiByteSize
(
&
len
,
src
,
strlenW
(
src
)
*
sizeof
(
WCHAR
)
);
RtlUnicodeToMultiByteSize
(
&
len
,
src
,
NTDLL_wcslen
(
src
)
*
sizeof
(
WCHAR
)
);
return
len
;
}
else
{
if
(
n
<=
0
)
return
0
;
RtlUnicodeToMultiByteN
(
dst
,
n
,
&
len
,
src
,
strlenW
(
src
)
*
sizeof
(
WCHAR
)
);
RtlUnicodeToMultiByteN
(
dst
,
n
,
&
len
,
src
,
NTDLL_wcslen
(
src
)
*
sizeof
(
WCHAR
)
);
if
(
len
<
n
)
dst
[
len
]
=
0
;
}
return
len
;
...
...
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