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
2693ce1a
Commit
2693ce1a
authored
Mar 20, 2014
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Don't add 0x prefix while printing 0 with printf.
parent
b6db22da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
3 deletions
+39
-3
printf.h
dlls/msvcrt/printf.h
+5
-3
printf.c
dlls/msvcrt/tests/printf.c
+34
-0
No files found.
dlls/msvcrt/printf.h
View file @
2693ce1a
...
...
@@ -265,9 +265,11 @@ static inline void FUNC_NAME(pf_integer_conv)(APICHAR *buf, int buf_len,
}
i
=
0
;
if
(
x
==
0
&&
flags
->
Precision
)
buf
[
i
++
]
=
'0'
;
else
{
if
(
x
==
0
)
{
flags
->
Alternate
=
0
;
if
(
flags
->
Precision
)
buf
[
i
++
]
=
'0'
;
}
else
{
while
(
x
!=
0
)
{
j
=
(
ULONGLONG
)
x
%
base
;
x
=
(
ULONGLONG
)
x
/
base
;
...
...
dlls/msvcrt/tests/printf.c
View file @
2693ce1a
...
...
@@ -329,18 +329,52 @@ static void test_sprintf( void )
format
=
"%#012x"
;
r
=
sprintf
(
buffer
,
format
,
1
);
ok
(
!
strcmp
(
buffer
,
"0x0000000001"
),
"Hexadecimal zero-padded
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
12
,
"return count wrong
\n
"
);
r
=
sprintf
(
buffer
,
format
,
0
);
ok
(
!
strcmp
(
buffer
,
"000000000000"
),
"Hexadecimal zero-padded
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
12
,
"return count wrong
\n
"
);
format
=
"%#04.8x"
;
r
=
sprintf
(
buffer
,
format
,
1
);
ok
(
!
strcmp
(
buffer
,
"0x00000001"
),
"Hexadecimal zero-padded precision
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
10
,
"return count wrong
\n
"
);
r
=
sprintf
(
buffer
,
format
,
0
);
ok
(
!
strcmp
(
buffer
,
"00000000"
),
"Hexadecimal zero-padded precision
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
8
,
"return count wrong
\n
"
);
format
=
"%#-08.2x"
;
r
=
sprintf
(
buffer
,
format
,
1
);
ok
(
!
strcmp
(
buffer
,
"0x01 "
),
"Hexadecimal zero-padded not left-adjusted
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
8
,
"return count wrong
\n
"
);
r
=
sprintf
(
buffer
,
format
,
0
);
ok
(
!
strcmp
(
buffer
,
"00 "
),
"Hexadecimal zero-padded not left-adjusted
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
8
,
"return count wrong
\n
"
);
format
=
"%#.0x"
;
r
=
sprintf
(
buffer
,
format
,
1
);
ok
(
!
strcmp
(
buffer
,
"0x1"
),
"Hexadecimal zero-padded zero-precision
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
3
,
"return count wrong
\n
"
);
r
=
sprintf
(
buffer
,
format
,
0
);
ok
(
!
strcmp
(
buffer
,
""
),
"Hexadecimal zero-padded zero-precision
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
0
,
"return count wrong
\n
"
);
format
=
"%#08o"
;
r
=
sprintf
(
buffer
,
format
,
1
);
ok
(
!
strcmp
(
buffer
,
"00000001"
),
"Octal zero-padded
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
8
,
"return count wrong
\n
"
);
format
=
"%#o"
;
r
=
sprintf
(
buffer
,
format
,
1
);
ok
(
!
strcmp
(
buffer
,
"01"
),
"Octal zero-padded
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
2
,
"return count wrong
\n
"
);
r
=
sprintf
(
buffer
,
format
,
0
);
ok
(
!
strcmp
(
buffer
,
"0"
),
"Octal zero-padded
\"
%s
\"\n
"
,
buffer
);
ok
(
r
==
1
,
"return count wrong
\n
"
);
if
(
sizeof
(
void
*
)
==
8
)
{
...
...
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