Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit core collection
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
30
Issues
30
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit core collection
Commits
dc5b0465
Commit
dc5b0465
authored
Feb 01, 2017
by
Adam Wujek
💬
Committed by
Grzegorz Daniluk
Feb 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pp-printf: add support for precision greather than 9
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
cbe72cab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
vsprintf-xint.c
pp_printf/vsprintf-xint.c
+14
-7
No files found.
pp_printf/vsprintf-xint.c
View file @
dc5b0465
...
...
@@ -13,6 +13,9 @@ static int number(char *out, unsigned value, int base, int lead, int wid)
char
tmp
[
16
];
int
i
=
16
,
ret
,
negative
=
0
;
if
(
wid
==
0
)
wid
=
1
;
/* No error checking at all: it is as ugly as possible */
if
((
signed
)
value
<
0
&&
base
==
10
)
{
negative
=
1
;
...
...
@@ -51,23 +54,27 @@ int pp_vsprintf(char *buf, const char *fmt, va_list args)
base
=
10
;
lead
=
' '
;
wid
=
1
;
wid
=
0
;
repeat:
fmt
++
;
/* Skip '%' initially, other stuff later */
switch
(
*
fmt
)
{
case
'\0'
:
goto
ret
;
case
'0'
:
lead
=
'0'
;
goto
repeat
;
case
'*'
:
/* should be precision, just eat it */
base
=
va_arg
(
args
,
int
);
/* fall through: discard unknown stuff */
case
'0'
:
if
(
wid
==
0
)
{
lead
=
'0'
;
goto
repeat
;
}
/* else go to default */
default:
if
(
*
fmt
>=
'1'
&&
*
fmt
<=
'9'
)
wid
=
*
fmt
-
'0'
;
if
(
*
fmt
>=
'0'
&&
*
fmt
<=
'9'
)
{
/* decimal shift left */
wid
*=
10
;
wid
+=
*
fmt
-
'0'
;
}
goto
repeat
;
/* Special cases for conversions */
...
...
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