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
d7b5c0b1
Commit
d7b5c0b1
authored
Jul 26, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix %f format handling in printf so it works with big floats.
parent
5e9ee3b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
printf.h
dlls/msvcrt/printf.h
+14
-1
No files found.
dlls/msvcrt/printf.h
View file @
d7b5c0b1
...
...
@@ -535,6 +535,19 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
}
else
if
(
flags
.
Format
&&
strchr
(
"aeEfgG"
,
flags
.
Format
))
{
char
float_fmt
[
20
],
buf_a
[
32
],
*
tmp
=
buf_a
,
*
decimal_point
;
int
max_len
=
(
flags
.
FieldLength
>
flags
.
Precision
?
flags
.
FieldLength
:
flags
.
Precision
)
+
10
;
double
val
=
pf_args
(
args_ctx
,
pos
,
VT_R8
,
valist
).
get_double
;
if
(
flags
.
Format
==
'f'
)
{
if
(
val
>-
10
.
0
&&
val
<
10
.
0
)
i
=
1
;
else
i
=
1
+
log10
(
val
<
0
?
-
val
:
val
);
/* Default precision is 6, additional space for sign, separator and nullbyte is required */
i
+=
(
flags
.
Precision
==-
1
?
6
:
flags
.
Precision
)
+
3
;
if
(
i
>
max_len
)
max_len
=
i
;
}
if
(
max_len
>
sizeof
(
buf_a
))
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
max_len
);
...
...
@@ -543,7 +556,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
FUNC_NAME
(
pf_rebuild_format_string
)(
float_fmt
,
&
flags
);
sprintf
(
tmp
,
float_fmt
,
pf_args
(
args_ctx
,
pos
,
VT_R8
,
valist
).
get_double
);
sprintf
(
tmp
,
float_fmt
,
val
);
if
(
toupper
(
flags
.
Format
)
==
'E'
||
toupper
(
flags
.
Format
)
==
'G'
)
FUNC_NAME
(
pf_fixup_exponent
)(
tmp
);
...
...
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