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
19863285
Commit
19863285
authored
Mar 09, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Don't handle the full Unicode character range in wcsicmp/wcsnicmp.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5a4cc97a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
string.c
dlls/ntdll/tests/string.c
+27
-0
wcstring.c
dlls/ntdll/wcstring.c
+16
-2
No files found.
dlls/ntdll/tests/string.c
View file @
19863285
...
...
@@ -57,6 +57,8 @@ static LPWSTR (__cdecl *p_wcslwr)(LPWSTR);
static
LPWSTR
(
__cdecl
*
p_wcsupr
)(
LPWSTR
);
static
WCHAR
(
__cdecl
*
ptowlower
)(
WCHAR
);
static
WCHAR
(
__cdecl
*
ptowupper
)(
WCHAR
);
static
int
(
__cdecl
*
p_wcsicmp
)(
LPCWSTR
,
LPCWSTR
);
static
int
(
__cdecl
*
p_wcsnicmp
)(
LPCWSTR
,
LPCWSTR
,
int
);
static
LPWSTR
(
__cdecl
*
pwcschr
)(
LPCWSTR
,
WCHAR
);
static
LPWSTR
(
__cdecl
*
pwcsrchr
)(
LPCWSTR
,
WCHAR
);
...
...
@@ -102,6 +104,8 @@ static void InitFunctionPtrs(void)
X
(
_wcsupr
);
X
(
towlower
);
X
(
towupper
);
X
(
_wcsicmp
);
X
(
_wcsnicmp
);
X
(
wcschr
);
X
(
wcsrchr
);
X
(
qsort
);
...
...
@@ -1196,6 +1200,28 @@ static void test_wcslwrupr(void)
ok
(
buffer
[
i
-
1
]
==
(
i
>=
'a'
&&
i
<=
'z'
?
i
-
32
:
i
),
"%04x: got %04x
\n
"
,
i
,
buffer
[
i
-
1
]
);
}
static
void
test_wcsicmp
(
void
)
{
WCHAR
buf_a
[
2
],
buf_b
[
2
];
int
i
,
j
,
ret
;
buf_a
[
1
]
=
buf_b
[
1
]
=
0
;
for
(
i
=
0
;
i
<
0x300
;
i
++
)
{
int
lwr_a
=
(
i
>=
'A'
&&
i
<=
'Z'
)
?
i
+
32
:
i
;
buf_a
[
0
]
=
i
;
for
(
j
=
0
;
j
<
0x300
;
j
++
)
{
int
lwr_b
=
(
j
>=
'A'
&&
j
<=
'Z'
)
?
j
+
32
:
j
;
buf_b
[
0
]
=
j
;
ret
=
p_wcsicmp
(
buf_a
,
buf_b
);
ok
(
ret
==
lwr_a
-
lwr_b
,
"%04x:%04x: strings differ %d
\n
"
,
i
,
j
,
ret
);
ret
=
p_wcsnicmp
(
buf_a
,
buf_b
,
2
);
ok
(
ret
==
lwr_a
-
lwr_b
,
"%04x:%04x: strings differ %d
\n
"
,
i
,
j
,
ret
);
}
}
}
static
int
__cdecl
intcomparefunc
(
const
void
*
a
,
const
void
*
b
)
{
const
int
*
p
=
a
,
*
q
=
b
;
...
...
@@ -1567,5 +1593,6 @@ START_TEST(string)
test_tolower
();
test_toupper
();
test__strnicmp
();
test_wcsicmp
();
test_sscanf
();
}
dlls/ntdll/wcstring.c
View file @
19863285
...
...
@@ -38,7 +38,14 @@
*/
INT
__cdecl
NTDLL__wcsicmp
(
LPCWSTR
str1
,
LPCWSTR
str2
)
{
return
strcmpiW
(
str1
,
str2
);
for
(;;)
{
WCHAR
ch1
=
(
*
str1
>=
'A'
&&
*
str1
<=
'Z'
)
?
*
str1
+
32
:
*
str1
;
WCHAR
ch2
=
(
*
str2
>=
'A'
&&
*
str2
<=
'Z'
)
?
*
str2
+
32
:
*
str2
;
if
(
ch1
!=
ch2
||
!*
str1
)
return
ch1
-
ch2
;
str1
++
;
str2
++
;
}
}
...
...
@@ -64,7 +71,14 @@ LPWSTR __cdecl NTDLL__wcslwr( LPWSTR str )
*/
INT
__cdecl
NTDLL__wcsnicmp
(
LPCWSTR
str1
,
LPCWSTR
str2
,
INT
n
)
{
return
strncmpiW
(
str1
,
str2
,
n
);
int
ret
=
0
;
for
(
;
n
>
0
;
n
--
,
str1
++
,
str2
++
)
{
WCHAR
ch1
=
(
*
str1
>=
'A'
&&
*
str1
<=
'Z'
)
?
*
str1
+
32
:
*
str1
;
WCHAR
ch2
=
(
*
str2
>=
'A'
&&
*
str2
<=
'Z'
)
?
*
str2
+
32
:
*
str2
;
if
((
ret
=
ch1
-
ch2
)
||
!*
str1
)
break
;
}
return
ret
;
}
...
...
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