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
702b1e29
Commit
702b1e29
authored
Sep 02, 2019
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Match broken multi-byte character with everything in _mbsspn.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ab525d3f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
mbcs.c
dlls/msvcrt/mbcs.c
+3
-0
string.c
dlls/msvcrt/tests/string.c
+3
-0
string.c
dlls/ucrtbase/tests/string.c
+41
-0
No files found.
dlls/msvcrt/mbcs.c
View file @
702b1e29
...
...
@@ -2035,6 +2035,9 @@ MSVCRT_size_t CDECL _mbsspn(const unsigned char* string, const unsigned char* se
{
if
(
_ismbblead
(
*
q
))
{
/* duplicate a bug in native implementation */
if
(
!
q
[
1
])
break
;
if
(
p
[
0
]
==
q
[
0
]
&&
p
[
1
]
==
q
[
1
])
{
p
++
;
...
...
dlls/msvcrt/tests/string.c
View file @
702b1e29
...
...
@@ -519,6 +519,7 @@ static void test_mbsspn( void)
unsigned
char
mbstr
[]
=
" 2019
\x94\x4e
"
"6
\x8c\x8e
"
"29
\x93\xfa
"
;
unsigned
char
mbset1
[]
=
"0123456789
\x94\x4e
"
;
unsigned
char
mbset2
[]
=
"
\x94\x4e\x8c\x8e
"
;
unsigned
char
mbset3
[]
=
"
\x8e
"
;
int
ret
,
cp
=
_getmbcp
();
ret
=
_mbsspn
(
str1
,
set
);
...
...
@@ -537,6 +538,8 @@ static void test_mbsspn( void)
ok
(
ret
==
0
,
"_mbsspn returns %d should be 0
\n
"
,
ret
);
ret
=
_mbsspn
(
mbstr
+
8
,
mbset2
);
ok
(
ret
==
2
,
"_mbsspn returns %d should be 2
\n
"
,
ret
);
ret
=
_mbsspn
(
mbstr
,
mbset3
);
ok
(
ret
==
14
,
"_mbsspn returns %d should be 14
\n
"
,
ret
);
_setmbcp
(
cp
);
}
...
...
dlls/ucrtbase/tests/string.c
View file @
702b1e29
...
...
@@ -80,6 +80,9 @@ static int (__cdecl *p__towupper_l)(wint_t, _locale_t);
static
char
*
(
__cdecl
*
p_setlocale
)(
int
,
const
char
*
);
static
_locale_t
(
__cdecl
*
p__create_locale
)(
int
,
const
char
*
);
static
void
(
__cdecl
*
p__free_locale
)(
_locale_t
);
static
int
(
__cdecl
*
p__getmbcp
)(
void
);
static
int
(
__cdecl
*
p__setmbcp
)(
int
);
static
size_t
(
__cdecl
*
p__mbsspn
)(
const
unsigned
char
*
,
const
unsigned
char
*
);
static
BOOL
init
(
void
)
{
...
...
@@ -104,6 +107,9 @@ static BOOL init(void)
p_setlocale
=
(
void
*
)
GetProcAddress
(
module
,
"setlocale"
);
p__create_locale
=
(
void
*
)
GetProcAddress
(
module
,
"_create_locale"
);
p__free_locale
=
(
void
*
)
GetProcAddress
(
module
,
"_free_locale"
);
p__getmbcp
=
(
void
*
)
GetProcAddress
(
module
,
"_getmbcp"
);
p__setmbcp
=
(
void
*
)
GetProcAddress
(
module
,
"_setmbcp"
);
p__mbsspn
=
(
void
*
)
GetProcAddress
(
module
,
"_mbsspn"
);
return
TRUE
;
}
...
...
@@ -339,6 +345,40 @@ static void test_C_locale(void)
}
}
static
void
test_mbsspn
(
void
)
{
unsigned
char
str1
[]
=
"cabernet"
;
unsigned
char
str2
[]
=
"shiraz"
;
unsigned
char
set
[]
=
"abc"
;
unsigned
char
empty
[]
=
""
;
unsigned
char
mbstr
[]
=
" 2019
\x94\x4e
"
"6
\x8c\x8e
"
"29
\x93\xfa
"
;
unsigned
char
mbset1
[]
=
"0123456789
\x94\x4e
"
;
unsigned
char
mbset2
[]
=
"
\x94\x4e\x8c\x8e
"
;
unsigned
char
mbset3
[]
=
"
\x8e
"
;
int
ret
,
cp
=
p__getmbcp
();
ret
=
p__mbsspn
(
str1
,
set
);
ok
(
ret
==
3
,
"_mbsspn returns %d should be 3
\n
"
,
ret
);
ret
=
p__mbsspn
(
str2
,
set
);
ok
(
ret
==
0
,
"_mbsspn returns %d should be 0
\n
"
,
ret
);
ret
=
p__mbsspn
(
str1
,
empty
);
ok
(
ret
==
0
,
"_mbsspn returns %d should be 0
\n
"
,
ret
);
p__setmbcp
(
932
);
ret
=
p__mbsspn
(
mbstr
,
mbset1
);
ok
(
ret
==
8
,
"_mbsspn returns %d should be 8
\n
"
,
ret
);
ret
=
p__mbsspn
(
mbstr
,
mbset2
);
ok
(
ret
==
1
,
"_mbsspn returns %d should be 1
\n
"
,
ret
);
ret
=
p__mbsspn
(
mbstr
+
8
,
mbset1
);
ok
(
ret
==
0
,
"_mbsspn returns %d should be 0
\n
"
,
ret
);
ret
=
p__mbsspn
(
mbstr
+
8
,
mbset2
);
ok
(
ret
==
2
,
"_mbsspn returns %d should be 2
\n
"
,
ret
);
ret
=
p__mbsspn
(
mbstr
,
mbset3
);
ok
(
ret
==
14
,
"_mbsspn returns %d should be 14
\n
"
,
ret
);
p__setmbcp
(
cp
);
}
START_TEST
(
string
)
{
if
(
!
init
())
return
;
...
...
@@ -347,4 +387,5 @@ START_TEST(string)
test__memicmp_l
();
test___strncnt
();
test_C_locale
();
test_mbsspn
();
}
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