зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1686831 - Still apply fillers when no numbers are printed. r=Gankra
The standard for printf says that for integers, the result of converting zero with an explicit precision of zero shall be no characters. But flags and width still need to apply. Differential Revision: https://phabricator.services.mozilla.com/D102696
This commit is contained in:
Родитель
4c520112c0
Коммит
c776e2a4de
|
@ -227,7 +227,9 @@ bool mozilla::PrintfTarget::cvt_l(long num, int width, int prec, int radix,
|
|||
int digits;
|
||||
|
||||
// according to the man page this needs to happen
|
||||
if ((prec == 0) && (num == 0)) return true;
|
||||
if ((prec == 0) && (num == 0)) {
|
||||
return fill_n("", 0, width, prec, type, flags);
|
||||
}
|
||||
|
||||
// Converting decimal is a little tricky. In the unsigned case we
|
||||
// need to stop when we hit 10 digits. In the signed case, we can
|
||||
|
@ -254,7 +256,9 @@ bool mozilla::PrintfTarget::cvt_l(long num, int width, int prec, int radix,
|
|||
bool mozilla::PrintfTarget::cvt_ll(int64_t num, int width, int prec, int radix,
|
||||
int type, int flags, const char* hexp) {
|
||||
// According to the man page, this needs to happen.
|
||||
if (prec == 0 && num == 0) return true;
|
||||
if (prec == 0 && num == 0) {
|
||||
return fill_n("", 0, width, prec, type, flags);
|
||||
}
|
||||
|
||||
// Converting decimal is a little tricky. In the unsigned case we
|
||||
// need to stop when we hit 10 digits. In the signed case, we can
|
||||
|
|
Загрузка…
Ссылка в новой задаче