mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-25 00:11:07 +00:00
Remove support for '%b' in 'printf'. ref #76
Also adapt according buffer sizes in 'Format_command'.
This commit is contained in:
parent
3ea9467343
commit
2313393e88
@ -125,7 +125,6 @@ class Format_command
|
|||||||
case 'x': type = UINT; base = 16; break;
|
case 'x': type = UINT; base = 16; break;
|
||||||
case 'X': type = UINT; base = 16; uppercase = 1; break;
|
case 'X': type = UINT; base = 16; uppercase = 1; break;
|
||||||
case 'p': type = PTR; base = 16; break;
|
case 'p': type = PTR; base = 16; break;
|
||||||
case 'b': type = UINT; base = 2; break;
|
|
||||||
case 'c': type = CHAR; break;
|
case 'c': type = CHAR; break;
|
||||||
case 's': type = STRING; break;
|
case 's': type = STRING; break;
|
||||||
case '%': type = PERCENT; break;
|
case '%': type = PERCENT; break;
|
||||||
@ -163,8 +162,12 @@ static char ascii(int digit, int uppercase = 0)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void Console::_out_signed(T value, unsigned base)
|
void Console::_out_signed(T value, unsigned base)
|
||||||
{
|
{
|
||||||
/* for base 2, the number of digits is the number of value bits */
|
/**
|
||||||
char buf[sizeof(value)*8];
|
* for base 8, the number of digits is the number of value bytes times 3
|
||||||
|
* at a max, because 0xff is 0o377 and accumulating this implies a
|
||||||
|
* strictly decreasing factor
|
||||||
|
*/
|
||||||
|
char buf[sizeof(value)*3];
|
||||||
|
|
||||||
/* set flag if value is negative */
|
/* set flag if value is negative */
|
||||||
int neg = value < 0 ? 1 : 0;
|
int neg = value < 0 ? 1 : 0;
|
||||||
@ -199,8 +202,12 @@ void Console::_out_signed(T value, unsigned base)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void Console::_out_unsigned(T value, unsigned base, int pad)
|
void Console::_out_unsigned(T value, unsigned base, int pad)
|
||||||
{
|
{
|
||||||
/* for base 2, the number of digits is the number of value bits */
|
/**
|
||||||
char buf[sizeof(value)*8];
|
* for base 8, the number of digits is the number of value bytes times 3
|
||||||
|
* at a max, because 0xff is 0o377 and accumulating this implies a
|
||||||
|
* strictly decreasing factor
|
||||||
|
*/
|
||||||
|
char buf[sizeof(value)*3];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user