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
b49dd456
Commit
b49dd456
authored
Jun 02, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: Provide iswspace, wcstol and wcstoul in unixlib.h.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
parent
f30332fe
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
145 deletions
+101
-145
win32u_private.h
dlls/win32u/win32u_private.h
+0
-95
x11drv.h
dlls/winex11.drv/x11drv.h
+0
-50
unixlib.h
include/wine/unixlib.h
+101
-0
No files found.
dlls/win32u/win32u_private.h
View file @
b49dd456
...
...
@@ -525,99 +525,6 @@ static inline WCHAR win32u_towupper( WCHAR ch )
return
RtlUpcaseUnicodeChar
(
ch
);
}
static
inline
LONG
win32u_wcstol
(
LPCWSTR
s
,
LPWSTR
*
end
,
INT
base
)
{
BOOL
negative
=
FALSE
,
empty
=
TRUE
;
LONG
ret
=
0
;
if
(
base
<
0
||
base
==
1
||
base
>
36
)
return
0
;
if
(
end
)
*
end
=
(
WCHAR
*
)
s
;
while
(
*
s
==
' '
||
*
s
==
'\t'
)
s
++
;
if
(
*
s
==
'-'
)
{
negative
=
TRUE
;
s
++
;
}
else
if
(
*
s
==
'+'
)
s
++
;
if
((
base
==
0
||
base
==
16
)
&&
s
[
0
]
==
'0'
&&
(
s
[
1
]
==
'x'
||
s
[
1
]
==
'X'
))
{
base
=
16
;
s
+=
2
;
}
if
(
base
==
0
)
base
=
s
[
0
]
!=
'0'
?
10
:
8
;
while
(
*
s
)
{
int
v
;
if
(
'0'
<=
*
s
&&
*
s
<=
'9'
)
v
=
*
s
-
'0'
;
else
if
(
'A'
<=
*
s
&&
*
s
<=
'Z'
)
v
=
*
s
-
'A'
+
10
;
else
if
(
'a'
<=
*
s
&&
*
s
<=
'z'
)
v
=
*
s
-
'a'
+
10
;
else
break
;
if
(
v
>=
base
)
break
;
if
(
negative
)
v
=
-
v
;
s
++
;
empty
=
FALSE
;
if
(
!
negative
&&
(
ret
>
MAXLONG
/
base
||
ret
*
base
>
MAXLONG
-
v
))
ret
=
MAXLONG
;
else
if
(
negative
&&
(
ret
<
(
LONG
)
MINLONG
/
base
||
ret
*
base
<
(
LONG
)(
MINLONG
-
v
)))
ret
=
MINLONG
;
else
ret
=
ret
*
base
+
v
;
}
if
(
end
&&
!
empty
)
*
end
=
(
WCHAR
*
)
s
;
return
ret
;
}
static
inline
ULONG
win32u_wcstoul
(
const
WCHAR
*
s
,
WCHAR
**
end
,
int
base
)
{
BOOL
negative
=
FALSE
,
empty
=
TRUE
;
ULONG
ret
=
0
;
if
(
base
<
0
||
base
==
1
||
base
>
36
)
return
0
;
if
(
end
)
*
end
=
(
WCHAR
*
)
s
;
while
(
*
s
==
' '
||
*
s
==
'\t'
)
s
++
;
if
(
*
s
==
'-'
)
{
negative
=
TRUE
;
s
++
;
}
else
if
(
*
s
==
'+'
)
s
++
;
if
((
base
==
0
||
base
==
16
)
&&
s
[
0
]
==
'0'
&&
(
s
[
1
]
==
'x'
||
s
[
1
]
==
'X'
))
{
base
=
16
;
s
+=
2
;
}
if
(
base
==
0
)
base
=
s
[
0
]
!=
'0'
?
10
:
8
;
while
(
*
s
)
{
int
v
;
if
(
'0'
<=
*
s
&&
*
s
<=
'9'
)
v
=
*
s
-
'0'
;
else
if
(
'A'
<=
*
s
&&
*
s
<=
'Z'
)
v
=
*
s
-
'A'
+
10
;
else
if
(
'a'
<=
*
s
&&
*
s
<=
'z'
)
v
=
*
s
-
'a'
+
10
;
else
break
;
if
(
v
>=
base
)
break
;
s
++
;
empty
=
FALSE
;
if
(
ret
>
MAXDWORD
/
base
||
ret
*
base
>
MAXDWORD
-
v
)
ret
=
MAXDWORD
;
else
ret
=
ret
*
base
+
v
;
}
if
(
end
&&
!
empty
)
*
end
=
(
WCHAR
*
)
s
;
return
negative
?
-
ret
:
ret
;
}
extern
CPTABLEINFO
ansi_cp
DECLSPEC_HIDDEN
;
DWORD
win32u_mbtowc
(
CPTABLEINFO
*
info
,
WCHAR
*
dst
,
DWORD
dstlen
,
const
char
*
src
,
...
...
@@ -643,8 +550,6 @@ static inline WCHAR *towstr( const char *str )
#define towupper(c) win32u_towupper(c)
#define wcsdup(s) win32u_wcsdup(s)
#define wcstol(s,e,b) win32u_wcstol(s,e,b)
#define wcstoul(s,e,b) win32u_wcstoul(s,e,b)
static
inline
void
ascii_to_unicode
(
WCHAR
*
dst
,
const
char
*
src
,
size_t
len
)
{
...
...
dlls/winex11.drv/x11drv.h
View file @
b49dd456
...
...
@@ -928,54 +928,4 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src )
return
(
p
-
dst
)
*
sizeof
(
WCHAR
);
}
static
inline
LONG
x11drv_wcstol
(
LPCWSTR
s
,
LPWSTR
*
end
,
INT
base
)
{
BOOL
negative
=
FALSE
,
empty
=
TRUE
;
LONG
ret
=
0
;
if
(
base
<
0
||
base
==
1
||
base
>
36
)
return
0
;
if
(
end
)
*
end
=
(
WCHAR
*
)
s
;
while
(
*
s
==
' '
||
*
s
==
'\t'
)
s
++
;
if
(
*
s
==
'-'
)
{
negative
=
TRUE
;
s
++
;
}
else
if
(
*
s
==
'+'
)
s
++
;
if
((
base
==
0
||
base
==
16
)
&&
s
[
0
]
==
'0'
&&
(
s
[
1
]
==
'x'
||
s
[
1
]
==
'X'
))
{
base
=
16
;
s
+=
2
;
}
if
(
base
==
0
)
base
=
s
[
0
]
!=
'0'
?
10
:
8
;
while
(
*
s
)
{
int
v
;
if
(
'0'
<=
*
s
&&
*
s
<=
'9'
)
v
=
*
s
-
'0'
;
else
if
(
'A'
<=
*
s
&&
*
s
<=
'Z'
)
v
=
*
s
-
'A'
+
10
;
else
if
(
'a'
<=
*
s
&&
*
s
<=
'z'
)
v
=
*
s
-
'a'
+
10
;
else
break
;
if
(
v
>=
base
)
break
;
if
(
negative
)
v
=
-
v
;
s
++
;
empty
=
FALSE
;
if
(
!
negative
&&
(
ret
>
MAXLONG
/
base
||
ret
*
base
>
MAXLONG
-
v
))
ret
=
MAXLONG
;
else
if
(
negative
&&
(
ret
<
(
LONG
)
MINLONG
/
base
||
ret
*
base
<
(
LONG
)(
MINLONG
-
v
)))
ret
=
MINLONG
;
else
ret
=
ret
*
base
+
v
;
}
if
(
end
&&
!
empty
)
*
end
=
(
WCHAR
*
)
s
;
return
ret
;
}
#define wcstol x11drv_wcstol
#endif
/* __WINE_X11DRV_H */
include/wine/unixlib.h
View file @
b49dd456
...
...
@@ -84,6 +84,11 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
/* wide char string functions */
static
inline
int
ntdll_iswspace
(
WCHAR
wc
)
{
return
(
'\t'
<=
wc
&&
wc
<=
'\r'
)
||
wc
==
' '
||
wc
==
0xa0
;
}
static
inline
size_t
ntdll_wcslen
(
const
WCHAR
*
str
)
{
const
WCHAR
*
s
=
str
;
...
...
@@ -150,6 +155,100 @@ static inline SIZE_T ntdll_wcscspn( const WCHAR *str, const WCHAR *reject )
return
ptr
-
str
;
}
static
inline
LONG
ntdll_wcstol
(
const
WCHAR
*
s
,
WCHAR
**
end
,
int
base
)
{
BOOL
negative
=
FALSE
,
empty
=
TRUE
;
LONG
ret
=
0
;
if
(
base
<
0
||
base
==
1
||
base
>
36
)
return
0
;
if
(
end
)
*
end
=
(
WCHAR
*
)
s
;
while
(
ntdll_iswspace
(
*
s
))
s
++
;
if
(
*
s
==
'-'
)
{
negative
=
TRUE
;
s
++
;
}
else
if
(
*
s
==
'+'
)
s
++
;
if
((
base
==
0
||
base
==
16
)
&&
s
[
0
]
==
'0'
&&
(
s
[
1
]
==
'x'
||
s
[
1
]
==
'X'
))
{
base
=
16
;
s
+=
2
;
}
if
(
base
==
0
)
base
=
s
[
0
]
!=
'0'
?
10
:
8
;
while
(
*
s
)
{
int
v
;
if
(
'0'
<=
*
s
&&
*
s
<=
'9'
)
v
=
*
s
-
'0'
;
else
if
(
'A'
<=
*
s
&&
*
s
<=
'Z'
)
v
=
*
s
-
'A'
+
10
;
else
if
(
'a'
<=
*
s
&&
*
s
<=
'z'
)
v
=
*
s
-
'a'
+
10
;
else
break
;
if
(
v
>=
base
)
break
;
if
(
negative
)
v
=
-
v
;
s
++
;
empty
=
FALSE
;
if
(
!
negative
&&
(
ret
>
MAXLONG
/
base
||
ret
*
base
>
MAXLONG
-
v
))
ret
=
MAXLONG
;
else
if
(
negative
&&
(
ret
<
(
LONG
)
MINLONG
/
base
||
ret
*
base
<
(
LONG
)(
MINLONG
-
v
)))
ret
=
MINLONG
;
else
ret
=
ret
*
base
+
v
;
}
if
(
end
&&
!
empty
)
*
end
=
(
WCHAR
*
)
s
;
return
ret
;
}
static
inline
ULONG
ntdll_wcstoul
(
const
WCHAR
*
s
,
WCHAR
**
end
,
int
base
)
{
BOOL
negative
=
FALSE
,
empty
=
TRUE
;
ULONG
ret
=
0
;
if
(
base
<
0
||
base
==
1
||
base
>
36
)
return
0
;
if
(
end
)
*
end
=
(
WCHAR
*
)
s
;
while
(
ntdll_iswspace
(
*
s
))
s
++
;
if
(
*
s
==
'-'
)
{
negative
=
TRUE
;
s
++
;
}
else
if
(
*
s
==
'+'
)
s
++
;
if
((
base
==
0
||
base
==
16
)
&&
s
[
0
]
==
'0'
&&
(
s
[
1
]
==
'x'
||
s
[
1
]
==
'X'
))
{
base
=
16
;
s
+=
2
;
}
if
(
base
==
0
)
base
=
s
[
0
]
!=
'0'
?
10
:
8
;
while
(
*
s
)
{
int
v
;
if
(
'0'
<=
*
s
&&
*
s
<=
'9'
)
v
=
*
s
-
'0'
;
else
if
(
'A'
<=
*
s
&&
*
s
<=
'Z'
)
v
=
*
s
-
'A'
+
10
;
else
if
(
'a'
<=
*
s
&&
*
s
<=
'z'
)
v
=
*
s
-
'a'
+
10
;
else
break
;
if
(
v
>=
base
)
break
;
s
++
;
empty
=
FALSE
;
if
(
ret
>
MAXDWORD
/
base
||
ret
*
base
>
MAXDWORD
-
v
)
ret
=
MAXDWORD
;
else
ret
=
ret
*
base
+
v
;
}
if
(
end
&&
!
empty
)
*
end
=
(
WCHAR
*
)
s
;
return
negative
?
-
ret
:
ret
;
}
#define iswspace(ch) ntdll_iswspace(ch)
#define wcslen(str) ntdll_wcslen(str)
#define wcscpy(dst,src) ntdll_wcscpy(dst,src)
#define wcscat(dst,src) ntdll_wcscat(dst,src)
...
...
@@ -162,6 +261,8 @@ static inline SIZE_T ntdll_wcscspn( const WCHAR *str, const WCHAR *reject )
#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 wcstol(str,e,b) ntdll_wcstol(str,e,b)
#define wcstoul(str,e,b) ntdll_wcstoul(str,e,b)
#endif
/* WINE_UNIX_LIB */
...
...
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