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
6c692dc1
Commit
6c692dc1
authored
Feb 09, 2020
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Fix wnsprintfA/wvnsprintfA %S conversion.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
08bf605a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
wsprintf.c
dlls/shlwapi/wsprintf.c
+24
-6
No files found.
dlls/shlwapi/wsprintf.c
View file @
6c692dc1
...
...
@@ -245,7 +245,7 @@ static INT WPRINTF_ParseFormatW( LPCWSTR format, WPRINTF_FORMAT *res )
* WPRINTF_GetLen
*/
static
UINT
WPRINTF_GetLen
(
WPRINTF_FORMAT
*
format
,
WPRINTF_DATA
*
arg
,
LPSTR
number
,
UINT
maxlen
)
LPSTR
number
,
UINT
maxlen
,
BOOL
dst_is_wide
)
{
UINT
len
;
...
...
@@ -264,8 +264,18 @@ static UINT WPRINTF_GetLen( WPRINTF_FORMAT *format, WPRINTF_DATA *arg,
return
(
format
->
precision
=
len
);
case
WPR_WSTRING
:
if
(
!
arg
->
lpcwstr_view
)
arg
->
lpcwstr_view
=
null_stringW
;
for
(
len
=
0
;
!
format
->
precision
||
(
len
<
format
->
precision
);
len
++
)
if
(
!*
(
arg
->
lpcwstr_view
+
len
))
break
;
if
(
dst_is_wide
)
{
for
(
len
=
0
;
!
format
->
precision
||
(
len
<
format
->
precision
);
len
++
)
if
(
!*
(
arg
->
lpcwstr_view
+
len
))
break
;
}
else
{
LPCWSTR
p
=
arg
->
lpcwstr_view
;
for
(
len
=
0
;
(
!
format
->
precision
||
len
<
format
->
precision
)
&&
*
p
;
p
++
)
len
+=
WideCharToMultiByte
(
CP_ACP
,
0
,
p
,
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
format
->
precision
&&
len
>
format
->
precision
)
len
=
format
->
precision
;
}
if
(
len
>
maxlen
)
len
=
maxlen
;
return
(
format
->
precision
=
len
);
case
WPR_SIGNED
:
...
...
@@ -365,7 +375,7 @@ INT WINAPI wvnsprintfA( LPSTR buffer, INT maxlen, LPCSTR spec, __ms_va_list args
break
;
}
len
=
WPRINTF_GetLen
(
&
format
,
&
argData
,
number
,
maxlen
-
1
);
len
=
WPRINTF_GetLen
(
&
format
,
&
argData
,
number
,
maxlen
-
1
,
FALSE
);
sign
=
0
;
if
(
!
(
format
.
flags
&
WPRINTF_LEFTALIGN
))
for
(
i
=
format
.
precision
;
i
<
format
.
width
;
i
++
,
maxlen
--
)
...
...
@@ -385,7 +395,15 @@ INT WINAPI wvnsprintfA( LPSTR buffer, INT maxlen, LPCSTR spec, __ms_va_list args
case
WPR_WSTRING
:
{
LPCWSTR
ptr
=
argData
.
lpcwstr_view
;
for
(
i
=
0
;
i
<
len
;
i
++
)
*
p
++
=
(
CHAR
)
*
ptr
++
;
for
(
i
=
0
;
i
<
len
;
ptr
++
)
{
CHAR
mb
[
5
];
/* 5 is MB_LEN_MAX */
int
ret
=
WideCharToMultiByte
(
CP_ACP
,
0
,
ptr
,
1
,
mb
,
sizeof
(
mb
),
NULL
,
NULL
);
i
+=
ret
;
if
(
i
>
len
)
ret
=
len
-
(
p
-
buffer
);
memcpy
(
p
,
mb
,
ret
);
p
+=
ret
;
}
}
break
;
case
WPR_HEXA
:
...
...
@@ -472,7 +490,7 @@ INT WINAPI wvnsprintfW( LPWSTR buffer, INT maxlen, LPCWSTR spec, __ms_va_list ar
break
;
}
len
=
WPRINTF_GetLen
(
&
format
,
&
argData
,
number
,
maxlen
-
1
);
len
=
WPRINTF_GetLen
(
&
format
,
&
argData
,
number
,
maxlen
-
1
,
TRUE
);
sign
=
0
;
if
(
!
(
format
.
flags
&
WPRINTF_LEFTALIGN
))
for
(
i
=
format
.
precision
;
i
<
format
.
width
;
i
++
,
maxlen
--
)
...
...
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