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
035f8ad8
Commit
035f8ad8
authored
Nov 30, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Export some Unicode string functions for use in other Unix libraries.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a3ef7a13
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
135 deletions
+114
-135
env.c
dlls/ntdll/unix/env.c
+31
-4
unix_private.h
dlls/ntdll/unix/unix_private.h
+0
-97
win32u_private.h
dlls/win32u/win32u_private.h
+0
-34
unixlib.h
include/wine/unixlib.h
+83
-0
No files found.
dlls/ntdll/unix/env.c
View file @
035f8ad8
...
...
@@ -612,7 +612,7 @@ static unsigned int decode_utf8_char( unsigned char ch, const char **str, const
/******************************************************************
* ntdll_umbstowcs
* ntdll_umbstowcs
(ntdll.so)
*/
DWORD
ntdll_umbstowcs
(
const
char
*
src
,
DWORD
srclen
,
WCHAR
*
dst
,
DWORD
dstlen
)
{
...
...
@@ -657,7 +657,7 @@ DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen )
/******************************************************************
* ntdll_wcstoumbs
* ntdll_wcstoumbs
(ntdll.so)
*/
int
ntdll_wcstoumbs
(
const
WCHAR
*
src
,
DWORD
srclen
,
char
*
dst
,
DWORD
dstlen
,
BOOL
strict
)
{
...
...
@@ -758,8 +758,35 @@ int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BO
}
/**********************************************************************
* ntdll_wcsicmp (ntdll.so)
*/
int
ntdll_wcsicmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
int
ret
;
for
(;;)
{
if
((
ret
=
ntdll_towupper
(
*
str1
)
-
ntdll_towupper
(
*
str2
))
||
!*
str1
)
return
ret
;
str1
++
;
str2
++
;
}
}
/**********************************************************************
* ntdll_wcsnicmp (ntdll.so)
*/
int
ntdll_wcsnicmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
,
int
n
)
{
int
ret
;
for
(
ret
=
0
;
n
>
0
;
n
--
,
str1
++
,
str2
++
)
if
((
ret
=
ntdll_towupper
(
*
str1
)
-
ntdll_towupper
(
*
str2
))
||
!*
str1
)
break
;
return
ret
;
}
/***********************************************************************
* ntdll_get_build_dir
* ntdll_get_build_dir
(ntdll.so)
*/
const
char
*
ntdll_get_build_dir
(
void
)
{
...
...
@@ -768,7 +795,7 @@ const char *ntdll_get_build_dir(void)
/***********************************************************************
* ntdll_get_data_dir
* ntdll_get_data_dir
(ntdll.so)
*/
const
char
*
ntdll_get_data_dir
(
void
)
{
...
...
dlls/ntdll/unix/unix_private.h
View file @
035f8ad8
...
...
@@ -411,72 +411,6 @@ enum loadorder
extern
void
set_load_order_app_name
(
const
WCHAR
*
app_name
)
DECLSPEC_HIDDEN
;
extern
enum
loadorder
get_load_order
(
const
UNICODE_STRING
*
nt_name
)
DECLSPEC_HIDDEN
;
static
inline
size_t
ntdll_wcslen
(
const
WCHAR
*
str
)
{
const
WCHAR
*
s
=
str
;
while
(
*
s
)
s
++
;
return
s
-
str
;
}
static
inline
WCHAR
*
ntdll_wcscpy
(
WCHAR
*
dst
,
const
WCHAR
*
src
)
{
WCHAR
*
p
=
dst
;
while
((
*
p
++
=
*
src
++
));
return
dst
;
}
static
inline
WCHAR
*
ntdll_wcscat
(
WCHAR
*
dst
,
const
WCHAR
*
src
)
{
ntdll_wcscpy
(
dst
+
ntdll_wcslen
(
dst
),
src
);
return
dst
;
}
static
inline
int
ntdll_wcscmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
while
(
*
str1
&&
(
*
str1
==
*
str2
))
{
str1
++
;
str2
++
;
}
return
*
str1
-
*
str2
;
}
static
inline
int
ntdll_wcsncmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
,
int
n
)
{
if
(
n
<=
0
)
return
0
;
while
((
--
n
>
0
)
&&
*
str1
&&
(
*
str1
==
*
str2
))
{
str1
++
;
str2
++
;
}
return
*
str1
-
*
str2
;
}
static
inline
WCHAR
*
ntdll_wcschr
(
const
WCHAR
*
str
,
WCHAR
ch
)
{
do
{
if
(
*
str
==
ch
)
return
(
WCHAR
*
)(
ULONG_PTR
)
str
;
}
while
(
*
str
++
);
return
NULL
;
}
static
inline
WCHAR
*
ntdll_wcsrchr
(
const
WCHAR
*
str
,
WCHAR
ch
)
{
WCHAR
*
ret
=
NULL
;
do
{
if
(
*
str
==
ch
)
ret
=
(
WCHAR
*
)(
ULONG_PTR
)
str
;
}
while
(
*
str
++
);
return
ret
;
}
static
inline
WCHAR
*
ntdll_wcspbrk
(
const
WCHAR
*
str
,
const
WCHAR
*
accept
)
{
for
(
;
*
str
;
str
++
)
if
(
ntdll_wcschr
(
accept
,
*
str
))
return
(
WCHAR
*
)(
ULONG_PTR
)
str
;
return
NULL
;
}
static
inline
SIZE_T
ntdll_wcsspn
(
const
WCHAR
*
str
,
const
WCHAR
*
accept
)
{
const
WCHAR
*
ptr
;
for
(
ptr
=
str
;
*
ptr
;
ptr
++
)
if
(
!
ntdll_wcschr
(
accept
,
*
ptr
))
break
;
return
ptr
-
str
;
}
static
inline
SIZE_T
ntdll_wcscspn
(
const
WCHAR
*
str
,
const
WCHAR
*
reject
)
{
const
WCHAR
*
ptr
;
for
(
ptr
=
str
;
*
ptr
;
ptr
++
)
if
(
ntdll_wcschr
(
reject
,
*
ptr
))
break
;
return
ptr
-
str
;
}
static
inline
WCHAR
ntdll_towupper
(
WCHAR
ch
)
{
return
ch
+
uctable
[
uctable
[
uctable
[
ch
>>
8
]
+
((
ch
>>
4
)
&
0x0f
)]
+
(
ch
&
0x0f
)];
...
...
@@ -494,37 +428,6 @@ static inline WCHAR *ntdll_wcsupr( WCHAR *str )
return
ret
;
}
static
inline
int
ntdll_wcsicmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
int
ret
;
for
(;;)
{
if
((
ret
=
ntdll_towupper
(
*
str1
)
-
ntdll_towupper
(
*
str2
))
||
!*
str1
)
return
ret
;
str1
++
;
str2
++
;
}
}
static
inline
int
ntdll_wcsnicmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
,
int
n
)
{
int
ret
;
for
(
ret
=
0
;
n
>
0
;
n
--
,
str1
++
,
str2
++
)
if
((
ret
=
ntdll_towupper
(
*
str1
)
-
ntdll_towupper
(
*
str2
))
||
!*
str1
)
break
;
return
ret
;
}
#define wcslen(str) ntdll_wcslen(str)
#define wcscpy(dst,src) ntdll_wcscpy(dst,src)
#define wcscat(dst,src) ntdll_wcscat(dst,src)
#define wcscmp(s1,s2) ntdll_wcscmp(s1,s2)
#define wcsncmp(s1,s2,n) ntdll_wcsncmp(s1,s2,n)
#define wcschr(str,ch) ntdll_wcschr(str,ch)
#define wcsrchr(str,ch) ntdll_wcsrchr(str,ch)
#define wcspbrk(str,ac) ntdll_wcspbrk(str,ac)
#define wcsspn(str,ac) ntdll_wcsspn(str,ac)
#define wcscspn(str,rej) ntdll_wcscspn(str,rej)
#define wcsicmp(s1, s2) ntdll_wcsicmp(s1,s2)
#define wcsnicmp(s1, s2,n) ntdll_wcsnicmp(s1,s2,n)
#define wcsupr(str) ntdll_wcsupr(str)
#define towupper(c) ntdll_towupper(c)
#define towlower(c) ntdll_towlower(c)
...
...
dlls/win32u/win32u_private.h
View file @
035f8ad8
...
...
@@ -256,41 +256,11 @@ static inline BOOL set_ntstatus( NTSTATUS status )
return
!
status
;
}
static
inline
WCHAR
*
win32u_wcsrchr
(
const
WCHAR
*
str
,
WCHAR
ch
)
{
WCHAR
*
ret
=
NULL
;
do
{
if
(
*
str
==
ch
)
ret
=
(
WCHAR
*
)(
ULONG_PTR
)
str
;
}
while
(
*
str
++
);
return
ret
;
}
static
inline
WCHAR
win32u_towupper
(
WCHAR
ch
)
{
return
RtlUpcaseUnicodeChar
(
ch
);
}
static
inline
WCHAR
*
win32u_wcschr
(
const
WCHAR
*
str
,
WCHAR
ch
)
{
do
{
if
(
*
str
==
ch
)
return
(
WCHAR
*
)(
ULONG_PTR
)
str
;
}
while
(
*
str
++
);
return
NULL
;
}
static
inline
int
win32u_wcsicmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
int
ret
;
for
(;;)
{
if
((
ret
=
win32u_towupper
(
*
str1
)
-
win32u_towupper
(
*
str2
))
||
!*
str1
)
return
ret
;
str1
++
;
str2
++
;
}
}
static
inline
int
win32u_wcscmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
while
(
*
str1
&&
(
*
str1
==
*
str2
))
{
str1
++
;
str2
++
;
}
return
*
str1
-
*
str2
;
}
static
inline
LONG
win32u_wcstol
(
LPCWSTR
s
,
LPWSTR
*
end
,
INT
base
)
{
BOOL
negative
=
FALSE
,
empty
=
TRUE
;
...
...
@@ -385,10 +355,6 @@ static inline ULONG win32u_wcstoul( const WCHAR *s, WCHAR **end, int base )
}
#define towupper(c) win32u_towupper(c)
#define wcschr(s,c) win32u_wcschr(s,c)
#define wcscmp(s1,s2) win32u_wcscmp(s1,s2)
#define wcsicmp(s1,s2) win32u_wcsicmp(s1,s2)
#define wcsrchr(s,c) win32u_wcsrchr(s,c)
#define wcstol(s,e,b) win32u_wcstol(s,e,b)
#define wcstoul(s,e,b) win32u_wcstoul(s,e,b)
...
...
include/wine/unixlib.h
View file @
035f8ad8
...
...
@@ -33,6 +33,8 @@ extern const char *ntdll_get_build_dir(void);
extern
const
char
*
ntdll_get_data_dir
(
void
);
extern
DWORD
ntdll_umbstowcs
(
const
char
*
src
,
DWORD
srclen
,
WCHAR
*
dst
,
DWORD
dstlen
);
extern
int
ntdll_wcstoumbs
(
const
WCHAR
*
src
,
DWORD
srclen
,
char
*
dst
,
DWORD
dstlen
,
BOOL
strict
);
extern
int
ntdll_wcsicmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
);
extern
int
ntdll_wcsnicmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
,
int
n
);
extern
NTSTATUS
ntdll_init_syscalls
(
ULONG
id
,
SYSTEM_SERVICE_TABLE
*
table
,
void
**
dispatcher
);
/* exception handling */
...
...
@@ -78,6 +80,87 @@ extern void ntdll_set_exception_jmp_buf( __wine_jmp_buf *jmp );
} \
} while (0);
/* wide char string functions */
static
inline
size_t
ntdll_wcslen
(
const
WCHAR
*
str
)
{
const
WCHAR
*
s
=
str
;
while
(
*
s
)
s
++
;
return
s
-
str
;
}
static
inline
WCHAR
*
ntdll_wcscpy
(
WCHAR
*
dst
,
const
WCHAR
*
src
)
{
WCHAR
*
p
=
dst
;
while
((
*
p
++
=
*
src
++
));
return
dst
;
}
static
inline
WCHAR
*
ntdll_wcscat
(
WCHAR
*
dst
,
const
WCHAR
*
src
)
{
ntdll_wcscpy
(
dst
+
ntdll_wcslen
(
dst
),
src
);
return
dst
;
}
static
inline
int
ntdll_wcscmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
while
(
*
str1
&&
(
*
str1
==
*
str2
))
{
str1
++
;
str2
++
;
}
return
*
str1
-
*
str2
;
}
static
inline
int
ntdll_wcsncmp
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
,
int
n
)
{
if
(
n
<=
0
)
return
0
;
while
((
--
n
>
0
)
&&
*
str1
&&
(
*
str1
==
*
str2
))
{
str1
++
;
str2
++
;
}
return
*
str1
-
*
str2
;
}
static
inline
WCHAR
*
ntdll_wcschr
(
const
WCHAR
*
str
,
WCHAR
ch
)
{
do
{
if
(
*
str
==
ch
)
return
(
WCHAR
*
)(
ULONG_PTR
)
str
;
}
while
(
*
str
++
);
return
NULL
;
}
static
inline
WCHAR
*
ntdll_wcsrchr
(
const
WCHAR
*
str
,
WCHAR
ch
)
{
WCHAR
*
ret
=
NULL
;
do
{
if
(
*
str
==
ch
)
ret
=
(
WCHAR
*
)(
ULONG_PTR
)
str
;
}
while
(
*
str
++
);
return
ret
;
}
static
inline
WCHAR
*
ntdll_wcspbrk
(
const
WCHAR
*
str
,
const
WCHAR
*
accept
)
{
for
(
;
*
str
;
str
++
)
if
(
ntdll_wcschr
(
accept
,
*
str
))
return
(
WCHAR
*
)(
ULONG_PTR
)
str
;
return
NULL
;
}
static
inline
SIZE_T
ntdll_wcsspn
(
const
WCHAR
*
str
,
const
WCHAR
*
accept
)
{
const
WCHAR
*
ptr
;
for
(
ptr
=
str
;
*
ptr
;
ptr
++
)
if
(
!
ntdll_wcschr
(
accept
,
*
ptr
))
break
;
return
ptr
-
str
;
}
static
inline
SIZE_T
ntdll_wcscspn
(
const
WCHAR
*
str
,
const
WCHAR
*
reject
)
{
const
WCHAR
*
ptr
;
for
(
ptr
=
str
;
*
ptr
;
ptr
++
)
if
(
ntdll_wcschr
(
reject
,
*
ptr
))
break
;
return
ptr
-
str
;
}
#define wcslen(str) ntdll_wcslen(str)
#define wcscpy(dst,src) ntdll_wcscpy(dst,src)
#define wcscat(dst,src) ntdll_wcscat(dst,src)
#define wcscmp(s1,s2) ntdll_wcscmp(s1,s2)
#define wcsncmp(s1,s2,n) ntdll_wcsncmp(s1,s2,n)
#define wcschr(str,ch) ntdll_wcschr(str,ch)
#define wcsrchr(str,ch) ntdll_wcsrchr(str,ch)
#define wcspbrk(str,ac) ntdll_wcspbrk(str,ac)
#define wcsspn(str,ac) ntdll_wcsspn(str,ac)
#define wcscspn(str,rej) ntdll_wcscspn(str,rej)
#define wcsicmp(s1, s2) ntdll_wcsicmp(s1,s2)
#define wcsnicmp(s1, s2,n) ntdll_wcsnicmp(s1,s2,n)
#endif
/* WINE_UNIX_LIB */
#endif
/* __WINE_WINE_UNIXLIB_H */
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