1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 12:17:36 +00:00

AK: Implement printf's "period without precision value" correctly

This commit is contained in:
Tim Schumacher 2023-10-03 17:34:28 +02:00 committed by Andreas Kling
parent 0068e91aad
commit 87bcaa6151
2 changed files with 31 additions and 6 deletions

View file

@ -503,6 +503,8 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, IdentityType<CharType>* buffe
++p;
if (*p == '.') {
state.dot = true;
state.has_precision = true;
state.precision = 0;
if (*(p + 1))
goto one_more;
}
@ -528,10 +530,6 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, IdentityType<CharType>* buffe
if (*(p + 1))
goto one_more;
} else {
if (!state.has_precision) {
state.has_precision = true;
state.precision = 0;
}
state.precision *= 10;
state.precision += *p - '0';
if (*(p + 1))
@ -540,7 +538,6 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, IdentityType<CharType>* buffe
}
if (*p == '*') {
if (state.dot) {
state.has_precision = true;
state.zero_pad = true;
state.precision = NextArgument<int>()(ap);
} else {