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
e475d045
Commit
e475d045
authored
Aug 06, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ucrtbase: Fix precision handling in %#g when printing 0.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
120b2209
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
printf.h
dlls/msvcrt/printf.h
+1
-4
printf.c
dlls/ucrtbase/tests/printf.c
+10
-5
No files found.
dlls/msvcrt/printf.h
View file @
e475d045
...
...
@@ -691,10 +691,7 @@ static inline int FUNC_NAME(pf_output_fp)(FUNC_NAME(puts_clbk) pf_puts, void *pu
if
(
flags
->
Format
==
'g'
||
flags
->
Format
==
'G'
)
{
trim_tail
=
TRUE
;
if
(
!
v
)
{
flags
->
Format
-=
1
;
if
(
!
flags
->
Precision
)
flags
->
Precision
++
;
}
else
if
(
radix_pos
>=-
3
&&
radix_pos
<=
flags
->
Precision
)
{
if
(
radix_pos
>=-
3
&&
radix_pos
<=
flags
->
Precision
)
{
flags
->
Format
-=
1
;
if
(
!
flags
->
Precision
)
flags
->
Precision
++
;
flags
->
Precision
-=
radix_pos
;
...
...
dlls/ucrtbase/tests/printf.c
View file @
e475d045
...
...
@@ -661,6 +661,7 @@ static void test_printf_fp(void)
const
char
*
fmt
;
double
d
;
const
char
*
res
[
ARRAY_SIZE
(
flags
)];
const
char
*
broken
[
ARRAY_SIZE
(
flags
)];
}
tests
[]
=
{
{
"%a"
,
NAN
,
{
"nan"
,
"0x1.#QNAN00000000p+0"
,
"nan"
,
"0x1.#QNAN00000000p+0"
}},
{
"%A"
,
NAN
,
{
"NAN"
,
"0X1.#QNAN00000000P+0"
,
"NAN"
,
"0X1.#QNAN00000000P+0"
}},
...
...
@@ -773,7 +774,7 @@ static void test_printf_fp(void)
{
"%.020g"
,
0
,
{
"0"
}},
{
"%#.21f"
,
0
,
{
"0.000000000000000000000"
}},
{
"%#.20e"
,
0
,
{
"0.00000000000000000000e+00"
,
NULL
,
"0.00000000000000000000e+000"
}},
{
"%#.20g"
,
0
,
{
"0.00000000000000000000"
}},
{
"%#.20g"
,
0
,
{
"0.0000000000000000000
"
},
{
"0.0000000000000000000
0"
}},
{
"%f"
,
123
,
{
"123.000000"
}},
{
"%e"
,
123
,
{
"1.230000e+02"
,
NULL
,
"1.230000e+002"
}},
...
...
@@ -812,20 +813,24 @@ static void test_printf_fp(void)
};
const
char
*
res
=
NULL
;
const
char
*
broken_res
;
char
buf
[
100
];
int
i
,
j
,
r
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
{
broken_res
=
NULL
;
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
flags
);
j
++
)
{
if
(
tests
[
i
].
res
[
j
])
res
=
tests
[
i
].
res
[
j
];
if
(
tests
[
i
].
broken
[
j
])
broken_res
=
tests
[
i
].
broken
[
j
];
r
=
vsprintf_wrapper
(
flags
[
j
],
buf
,
sizeof
(
buf
),
tests
[
i
].
fmt
,
tests
[
i
].
d
);
ok
(
r
==
strlen
(
res
)
,
"%d,%d) r = %d, expected %d
\n
"
,
i
,
j
,
r
,
strlen
(
res
));
ok
(
!
strcmp
(
buf
,
res
)
,
"%d,%d) buf = %s, expected %s
\n
"
,
i
,
j
,
buf
,
res
);
ok
(
r
==
strlen
(
res
)
||
broken
(
broken_res
&&
r
==
strlen
(
broken_res
))
,
"%d,%d) r = %d, expected %d
\n
"
,
i
,
j
,
r
,
strlen
(
res
));
ok
(
!
strcmp
(
buf
,
res
)
||
broken
(
broken_res
&&
!
strcmp
(
buf
,
broken_res
))
,
"%d,%d) buf = %s, expected %s
\n
"
,
i
,
j
,
buf
,
res
);
}
}
}
...
...
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