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
3861c1e3
Commit
3861c1e3
authored
Oct 19, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add support for multi-byte characters in _mbctolower_l.
parent
cbcbaf36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
4 deletions
+35
-4
mbcs.c
dlls/msvcrt/mbcs.c
+26
-4
string.c
dlls/msvcrt/tests/string.c
+9
-0
No files found.
dlls/msvcrt/mbcs.c
View file @
3861c1e3
...
...
@@ -451,12 +451,34 @@ unsigned int CDECL _mbsnextc(const unsigned char* str)
*/
unsigned
int
CDECL
_mbctolower_l
(
unsigned
int
c
,
_locale_t
locale
)
{
if
(
_ismbblead_l
(
c
,
locale
))
unsigned
char
str
[
2
],
ret
[
2
];
pthreadmbcinfo
mbcinfo
;
if
(
!
locale
)
mbcinfo
=
get_mbcinfo
();
else
mbcinfo
=
locale
->
mbcinfo
;
if
(
c
>
0xff
)
{
FIXME
(
"Handle MBC chars
\n
"
);
return
c
;
if
(
!
_ismbblead_l
((
c
>>
8
)
&
0xff
,
locale
))
return
c
;
str
[
0
]
=
c
>>
8
;
str
[
1
]
=
c
;
switch
(
__crtLCMapStringA
(
mbcinfo
->
mblcid
,
LCMAP_LOWERCASE
,
(
char
*
)
str
,
2
,
(
char
*
)
ret
,
2
,
mbcinfo
->
mbcodepage
,
0
))
{
case
0
:
return
c
;
case
1
:
return
ret
[
0
];
default:
return
ret
[
1
]
+
(
ret
[
0
]
<<
8
);
}
}
return
_tolower_l
(
c
,
locale
);
/* ASCII CP or SB char */
return
mbcinfo
->
mbctype
[
c
+
1
]
&
_SBUP
?
mbcinfo
->
mbcasemap
[
c
]
:
c
;
}
/*********************************************************************
...
...
dlls/msvcrt/tests/string.c
View file @
3861c1e3
...
...
@@ -2896,6 +2896,7 @@ static void test__mbslwr_s(void)
{
errno_t
ret
;
unsigned
char
buffer
[
20
];
int
cp
=
_getmbcp
();
if
(
!
p_mbslwr_s
)
{
...
...
@@ -2946,6 +2947,14 @@ static void test__mbslwr_s(void)
ok
(
!
memcmp
(
buffer
,
"abcdefgh
\0
IJKLMNOP"
,
sizeof
(
"abcdefgh
\0
IJKLMNOP"
)),
"Expected the output buffer to be
\"
abcdefgh
\\
0IJKLMNOP
\"
, got
\"
%s
\"\n
"
,
buffer
);
_setmbcp
(
936
);
memcpy
(
buffer
,
"
\xa2\xf1\xa2\xf2
Q"
,
sizeof
(
"
\xa2\xf1\xa2\xf2
Q"
));
ret
=
p_mbslwr_s
(
buffer
,
sizeof
(
buffer
));
ok
(
ret
==
0
,
"Expected _mbsupr_s to return 0, got %d
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"
\xa2\xa1\xa2\xa2
q"
,
sizeof
(
"
\xa2\xa1\xa2\xa2
q"
)),
"got %s
\n
"
,
debugstr_a
((
char
*
)
buffer
));
_setmbcp
(
cp
);
}
static
void
test__mbstok
(
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