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
47217f59
Commit
47217f59
authored
Nov 19, 2019
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix _mbstowcs_s_l return value on truncate.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a9c4b309
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
mbcs.c
dlls/msvcrt/mbcs.c
+5
-3
string.c
dlls/msvcrt/tests/string.c
+5
-0
No files found.
dlls/msvcrt/mbcs.c
View file @
47217f59
...
...
@@ -2425,6 +2425,7 @@ int CDECL MSVCRT__mbstowcs_s_l(MSVCRT_size_t *ret, MSVCRT_wchar_t *wcstr,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
MSVCRT_size_t
conv
;
int
err
=
0
;
if
(
!
wcstr
&&
!
size
)
{
conv
=
MSVCRT__mbstowcs_l
(
NULL
,
mbstr
,
0
,
locale
);
...
...
@@ -2447,9 +2448,10 @@ int CDECL MSVCRT__mbstowcs_s_l(MSVCRT_size_t *ret, MSVCRT_wchar_t *wcstr,
conv
=
MSVCRT__mbstowcs_l
(
wcstr
,
mbstr
,
conv
,
locale
);
if
(
conv
<
size
)
wcstr
[
conv
++
]
=
'\0'
;
else
if
(
conv
==
size
&&
(
count
==
MSVCRT__TRUNCATE
||
wcstr
[
conv
-
1
]
==
'\0'
))
else
if
(
conv
==
size
&&
count
==
MSVCRT__TRUNCATE
&&
wcstr
[
conv
-
1
]
!=
'\0'
)
{
wcstr
[
conv
-
1
]
=
'\0'
;
else
{
err
=
MSVCRT_STRUNCATE
;
}
else
if
(
conv
==
size
&&
wcstr
[
conv
-
1
]
!=
'\0'
)
{
MSVCRT_INVALID_PMT
(
"wcstr[size] is too small"
,
MSVCRT_ERANGE
);
if
(
size
)
wcstr
[
0
]
=
'\0'
;
...
...
@@ -2458,7 +2460,7 @@ int CDECL MSVCRT__mbstowcs_s_l(MSVCRT_size_t *ret, MSVCRT_wchar_t *wcstr,
if
(
ret
)
*
ret
=
conv
;
return
0
;
return
err
;
}
/*********************************************************************
...
...
dlls/msvcrt/tests/string.c
View file @
47217f59
...
...
@@ -2080,6 +2080,11 @@ static void test_mbstowcs(void)
return
;
}
err
=
pmbstowcs_s
(
&
ret
,
wOut
,
1
,
mSimple
,
_TRUNCATE
);
ok
(
err
==
STRUNCATE
,
"err = %d
\n
"
,
err
);
ok
(
ret
==
1
,
"mbstowcs_s did not return 0
\n
"
);
ok
(
!
wOut
[
0
],
"wOut[0] = %d
\n
"
,
wOut
[
0
]);
err
=
pmbstowcs_s
(
&
ret
,
wOut
,
6
,
mSimple
,
_TRUNCATE
);
ok
(
err
==
0
,
"err = %d
\n
"
,
err
);
ok
(
ret
==
5
,
"mbstowcs_s did not return 5
\n
"
);
...
...
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