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
bbd0e56a
Commit
bbd0e56a
authored
Apr 24, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Handle NULL arguments in _mbscmp.
parent
07520fbf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
mbcs.c
dlls/msvcrt/mbcs.c
+3
-0
string.c
dlls/msvcrt/tests/string.c
+31
-0
No files found.
dlls/msvcrt/mbcs.c
View file @
bbd0e56a
...
...
@@ -24,6 +24,7 @@
*/
#include <stdio.h>
#include <limits.h>
#include "msvcrt.h"
#include "wine/unicode.h"
...
...
@@ -769,6 +770,8 @@ unsigned char* CDECL _mbsnbcpy(unsigned char* dst, const unsigned char* src, MSV
*/
int
CDECL
_mbscmp
(
const
unsigned
char
*
str
,
const
unsigned
char
*
cmp
)
{
if
(
!
str
||
!
cmp
)
return
INT_MAX
;
if
(
get_mbcinfo
()
->
ismbcodepage
)
{
unsigned
int
strc
,
cmpc
;
...
...
dlls/msvcrt/tests/string.c
View file @
bbd0e56a
...
...
@@ -2874,6 +2874,36 @@ static void test__wcsset_s(void)
ok
(
str
[
2
]
==
'b'
,
"str[2] = %d
\n
"
,
str
[
2
]);
}
static
void
test__mbscmp
(
void
)
{
static
const
unsigned
char
a
[]
=
{
'a'
,
0
},
b
[]
=
{
'b'
,
0
};
int
ret
;
if
(
!
p_mbrlen
)
{
win_skip
(
"_mbscmp tests
\n
"
);
return
;
}
ret
=
_mbscmp
(
NULL
,
NULL
);
ok
(
ret
==
INT_MAX
,
"got %d
\n
"
,
ret
);
ret
=
_mbscmp
(
a
,
NULL
);
ok
(
ret
==
INT_MAX
,
"got %d
\n
"
,
ret
);
ret
=
_mbscmp
(
NULL
,
a
);
ok
(
ret
==
INT_MAX
,
"got %d
\n
"
,
ret
);
ret
=
_mbscmp
(
a
,
a
);
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
ret
=
_mbscmp
(
a
,
b
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ret
=
_mbscmp
(
b
,
a
);
ok
(
ret
==
1
,
"got %d
\n
"
,
ret
);
}
START_TEST
(
string
)
{
char
mem
[
100
];
...
...
@@ -2981,4 +3011,5 @@ START_TEST(string)
test_strxfrm
();
test__strnset_s
();
test__wcsset_s
();
test__mbscmp
();
}
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