mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
AK: Zero-pad automatically if formatting with precision
This commit is contained in:
parent
aad9d0aa51
commit
5c511de4cc
1 changed files with 2 additions and 0 deletions
|
@ -443,6 +443,7 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fm
|
||||||
} else {
|
} else {
|
||||||
if (!state.has_fraction_length) {
|
if (!state.has_fraction_length) {
|
||||||
state.has_fraction_length = true;
|
state.has_fraction_length = true;
|
||||||
|
state.zero_pad = true;
|
||||||
state.fraction_length = 0;
|
state.fraction_length = 0;
|
||||||
}
|
}
|
||||||
state.fraction_length *= 10;
|
state.fraction_length *= 10;
|
||||||
|
@ -454,6 +455,7 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fm
|
||||||
if (*p == '*') {
|
if (*p == '*') {
|
||||||
if (state.dot) {
|
if (state.dot) {
|
||||||
state.has_fraction_length = true;
|
state.has_fraction_length = true;
|
||||||
|
state.zero_pad = true;
|
||||||
state.fraction_length = NextArgument<int>()(ap);
|
state.fraction_length = NextArgument<int>()(ap);
|
||||||
} else {
|
} else {
|
||||||
state.field_width = NextArgument<int>()(ap);
|
state.field_width = NextArgument<int>()(ap);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue