diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-10-26 08:50:37 -0700 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-10-28 23:45:37 +0000 |
commit | 1980923bd3fba57828d8566d47afd4de4b486539 (patch) | |
tree | 49da857907a17009104ba82fc51d26b03117d350 /src/corelib/text/qstring.cpp | |
parent | bc6e0d1e00c7e5b49f1b06a1747da7be34ff3193 (diff) | |
download | qtbase-1980923bd3fba57828d8566d47afd4de4b486539.tar.gz |
QString::asprintf: fix handling of a present-but-empty precision
%.f should be handled like %.0f. You probably don't want it for strings,
though.
Fixes: QTBUG-107991
Change-Id: I07ec23f3cb174fb197c3fffd1721a941fbcf15e1
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bdee2c9760109d8e483c3b0e5c99fabc48bf21f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r-- | src/corelib/text/qstring.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 48a352c3af..157cbdb5fb 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -6872,6 +6872,7 @@ QString QString::vasprintf(const char *cformat, va_list ap) int precision = -1; // -1 means unspecified if (*c == '.') { ++c; + precision = 0; if (qIsDigit(*c)) { precision = parse_field_width(c, formatEnd - c); } else if (*c == '*') { // can't parse this in another function, not portably, at least |