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
2af3f320
Commit
2af3f320
authored
Nov 02, 2023
by
Bartosz Kosiorek
Committed by
Alexandre Julliard
Nov 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix _strnicmp and _strnicmp_l implementation.
parent
49d3236d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
string.c
dlls/msvcrt/string.c
+9
-5
string.c
dlls/ucrtbase/tests/string.c
+21
-3
No files found.
dlls/msvcrt/string.c
View file @
2af3f320
...
...
@@ -3313,11 +3313,15 @@ int __cdecl _strnicmp_l(const char *s1, const char *s2,
pthreadlocinfo
locinfo
;
int
c1
,
c2
;
if
(
s1
==
NULL
||
s2
==
NULL
)
return
_NLSCMPERROR
;
if
(
!
count
)
return
0
;
#if _MSVCR_VER>=80
if
(
!
MSVCRT_CHECK_PMT
(
s1
&&
s2
&&
count
<=
INT_MAX
))
#else
/* Old versions of msvcrt.dll didn't have count <= INT_MAX check */
if
(
!
MSVCRT_CHECK_PMT
(
s1
&&
s2
))
#endif
/* _MSVCR_VER>=140 */
return
_NLSCMPERROR
;
if
(
!
locale
)
locinfo
=
get_locinfo
();
...
...
@@ -3349,7 +3353,7 @@ int __cdecl _strnicmp_l(const char *s1, const char *s2,
*/
int
__cdecl
_stricmp_l
(
const
char
*
s1
,
const
char
*
s2
,
_locale_t
locale
)
{
return
_strnicmp_l
(
s1
,
s2
,
-
1
,
locale
);
return
_strnicmp_l
(
s1
,
s2
,
INT_MAX
,
locale
);
}
/*********************************************************************
...
...
@@ -3365,7 +3369,7 @@ int __cdecl _strnicmp(const char *s1, const char *s2, size_t count)
*/
int
__cdecl
_stricmp
(
const
char
*
s1
,
const
char
*
s2
)
{
return
_strnicmp_l
(
s1
,
s2
,
-
1
,
NULL
);
return
_strnicmp_l
(
s1
,
s2
,
INT_MAX
,
NULL
);
}
/*********************************************************************
...
...
dlls/ucrtbase/tests/string.c
View file @
2af3f320
...
...
@@ -482,13 +482,31 @@ static void test__strnicmp(void)
SET_EXPECT
(
invalid_parameter_handler
);
errno
=
0xdeadbeef
;
ret
=
_strnicmp
(
str1
,
NULL
,
2
);
CHECK_CALLED
(
invalid_parameter_handler
);
ok
(
ret
==
_NLSCMPERROR
,
"got %d.
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Unexpected errno %d.
\n
"
,
errno
);
SET_EXPECT
(
invalid_parameter_handler
);
errno
=
0xdeadbeef
;
ret
=
_strnicmp
(
str1
,
str2
,
-
1
);
todo_wine
CHECK_CALLED
(
invalid_parameter_handler
);
todo_wine
ok
(
ret
==
_NLSCMPERROR
,
"got %d.
\n
"
,
ret
);
todo_wine
ok
(
errno
==
EINVAL
,
"Unexpected errno %d.
\n
"
,
errno
);
CHECK_CALLED
(
invalid_parameter_handler
);
ok
(
ret
==
_NLSCMPERROR
,
"got %d.
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Unexpected errno %d.
\n
"
,
errno
);
ret
=
_strnicmp
(
str1
,
str2
,
0
);
ok
(
!
ret
,
"got %d.
\n
"
,
ret
);
ret
=
_strnicmp
(
str1
,
str2
,
0x7fffffff
);
ok
(
!
ret
,
"got %d.
\n
"
,
ret
);
/* If numbers of characters to compare is too big return error */
SET_EXPECT
(
invalid_parameter_handler
);
errno
=
0xdeadbeef
;
ret
=
_strnicmp
(
str1
,
str2
,
0x80000000
);
CHECK_CALLED
(
invalid_parameter_handler
);
ok
(
ret
==
_NLSCMPERROR
,
"got %d.
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Unexpected errno %d.
\n
"
,
errno
);
}
static
void
test_wcsnicmp
(
void
)
...
...
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