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
fa8a9a81
Commit
fa8a9a81
authored
Feb 09, 2020
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Fix wsprintfW %S conversion.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c8f46313
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
wsprintf.c
dlls/user32/tests/wsprintf.c
+1
-2
wsprintf.c
dlls/user32/wsprintf.c
+24
-3
No files found.
dlls/user32/tests/wsprintf.c
View file @
fa8a9a81
...
@@ -188,12 +188,11 @@ static void wsprintfWTest(void)
...
@@ -188,12 +188,11 @@ static void wsprintfWTest(void)
memset
(
buf
,
0x11
,
sizeof
(
buf
));
memset
(
buf
,
0x11
,
sizeof
(
buf
));
rc
=
wsprintfW
(
buf
,
testcase
[
i
].
fmt
,
testcase
[
i
].
input
);
rc
=
wsprintfW
(
buf
,
testcase
[
i
].
fmt
,
testcase
[
i
].
input
);
todo_wine_if
(
i
==
2
)
ok
(
rc
==
testcase
[
i
].
rc
,
ok
(
rc
==
testcase
[
i
].
rc
,
"%u: expected %d, got %d
\n
"
,
"%u: expected %d, got %d
\n
"
,
i
,
testcase
[
i
].
rc
,
rc
);
i
,
testcase
[
i
].
rc
,
rc
);
todo_wine
ok
(
!
memcmp
(
buf
,
testcase
[
i
].
str
,
(
testcase
[
i
].
rc
+
1
)
*
sizeof
(
WCHAR
)),
ok
(
!
memcmp
(
buf
,
testcase
[
i
].
str
,
(
testcase
[
i
].
rc
+
1
)
*
sizeof
(
WCHAR
)),
"%u: expected %s, got %s
\n
"
,
i
,
"%u: expected %s, got %s
\n
"
,
i
,
wine_dbgstr_wn
(
testcase
[
i
].
str
,
testcase
[
i
].
rc
+
1
),
wine_dbgstr_wn
(
testcase
[
i
].
str
,
testcase
[
i
].
rc
+
1
),
wine_dbgstr_wn
(
buf
,
rc
+
1
));
wine_dbgstr_wn
(
buf
,
rc
+
1
));
...
...
dlls/user32/wsprintf.c
View file @
fa8a9a81
...
@@ -259,8 +259,22 @@ static UINT WPRINTF_GetLen( WPRINTF_FORMAT *format, WPRINTF_DATA *arg,
...
@@ -259,8 +259,22 @@ static UINT WPRINTF_GetLen( WPRINTF_FORMAT *format, WPRINTF_DATA *arg,
return
(
format
->
precision
=
1
);
return
(
format
->
precision
=
1
);
case
WPR_STRING
:
case
WPR_STRING
:
if
(
!
arg
->
lpcstr_view
)
arg
->
lpcstr_view
=
null_stringA
;
if
(
!
arg
->
lpcstr_view
)
arg
->
lpcstr_view
=
null_stringA
;
for
(
len
=
0
;
!
format
->
precision
||
(
len
<
format
->
precision
);
len
++
)
if
(
dst_is_wide
)
if
(
!*
(
arg
->
lpcstr_view
+
len
))
break
;
{
LPCSTR
p
=
arg
->
lpcstr_view
;
for
(
len
=
0
;
(
!
format
->
precision
||
len
<
format
->
precision
)
&&
*
p
;
p
++
)
{
/* This isn't applicable for UTF-8 and UTF-7 */
if
(
IsDBCSLeadByte
(
*
p
))
p
++
;
len
++
;
if
(
!*
p
)
break
;
}
}
else
{
for
(
len
=
0
;
!
format
->
precision
||
(
len
<
format
->
precision
);
len
++
)
if
(
!*
(
arg
->
lpcstr_view
+
len
))
break
;
}
if
(
len
>
maxlen
)
len
=
maxlen
;
if
(
len
>
maxlen
)
len
=
maxlen
;
return
(
format
->
precision
=
len
);
return
(
format
->
precision
=
len
);
case
WPR_WSTRING
:
case
WPR_WSTRING
:
...
@@ -494,7 +508,14 @@ static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, __ms_va_list a
...
@@ -494,7 +508,14 @@ static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, __ms_va_list a
case
WPR_STRING
:
case
WPR_STRING
:
{
{
LPCSTR
ptr
=
argData
.
lpcstr_view
;
LPCSTR
ptr
=
argData
.
lpcstr_view
;
for
(
i
=
0
;
i
<
len
;
i
++
)
*
p
++
=
(
BYTE
)
*
ptr
++
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
WCHAR
buf
[
2
];
/* for LeadByte + NUL case, we need 2 WCHARs. */
int
ret
,
mb_len
=
IsDBCSLeadByte
(
*
ptr
)
?
2
:
1
;
ret
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
,
mb_len
,
buf
,
ARRAY_SIZE
(
buf
));
*
p
++
=
buf
[
ret
-
1
];
ptr
+=
mb_len
;
}
}
}
break
;
break
;
case
WPR_WSTRING
:
case
WPR_WSTRING
:
...
...
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