From 4c520112c07de3f5927b08c7727c2755216a0027 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 27 Jan 2021 01:06:22 +0000 Subject: [PATCH] Bug 1686831 - Add support for %F and %G, and properly support %n$E. r=nika,Gankra %F and %G are the same as %f and %g, but using caps for the exponent indicator, and for "inf"/"nan" for infinity and NaN. %n$E is the same as %E, but taking the nth argument. Differential Revision: https://phabricator.services.mozilla.com/D102695 --- mozglue/misc/Printf.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mozglue/misc/Printf.cpp b/mozglue/misc/Printf.cpp index 4d3306e5133a..8cc6da31c449 100644 --- a/mozglue/misc/Printf.cpp +++ b/mozglue/misc/Printf.cpp @@ -491,8 +491,11 @@ static bool BuildArgArray(const char* fmt, va_list ap, NumArgStateVector& nas) { break; case 'e': + case 'E': case 'f': + case 'F': case 'g': + case 'G': nas[cn].type = TYPE_DOUBLE; break; @@ -825,7 +828,9 @@ bool mozilla::PrintfTarget::vprint(const char* fmt, va_list ap) { case 'e': case 'E': case 'f': + case 'F': case 'g': + case 'G': u.d = va_arg(ap, double); if (!nas.empty()) { i = fmt - dolPt;