mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Honor variable precision argument when formatting
printf didn't check whether the additional integer variable belongs to the field width specifier or to the precision specifier, and always applied it to the field width instead. Implement the case distinction that we already use in literal width and precision specifiers for the variable version as well so that they are correctly attributed.
This commit is contained in:
parent
d5bf9182dd
commit
8c3e4ccd72
Notes:
sideshowbarker
2024-07-18 17:09:09 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/8c3e4ccd721 Pull-request: https://github.com/SerenityOS/serenity/pull/7597
1 changed files with 7 additions and 1 deletions
|
@ -452,7 +452,13 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fm
|
|||
}
|
||||
}
|
||||
if (*p == '*') {
|
||||
state.field_width = NextArgument<int>()(ap);
|
||||
if (state.dot) {
|
||||
state.has_fraction_length = true;
|
||||
state.fraction_length = NextArgument<int>()(ap);
|
||||
} else {
|
||||
state.field_width = NextArgument<int>()(ap);
|
||||
}
|
||||
|
||||
if (*(p + 1))
|
||||
goto one_more;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue