diff options
Diffstat (limited to 'src/corelib/tools/qlocale_tools.cpp')
-rw-r--r-- | src/corelib/tools/qlocale_tools.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp index cdc654904e..f766a301c5 100644 --- a/src/corelib/tools/qlocale_tools.cpp +++ b/src/corelib/tools/qlocale_tools.cpp @@ -267,6 +267,8 @@ void doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, char * } } #endif // QT_NO_DOUBLECONVERSION || QT_BOOTSTRAPPED + while (length > 1 && buf[length - 1] == '0') // drop trailing zeroes + --length; } double asciiToDouble(const char *num, int numLen, bool &ok, int &processed) @@ -546,10 +548,6 @@ QString qdtoa(qreal d, int *decpt, int *sign) doubleToAscii(d, QLocaleData::DFSignificantDigits, QLocale::FloatingPointShortest, result, QLocaleData::DoubleMaxSignificant + 1, nonNullSign, length, nonNullDecpt); - // Skip trailing zeroes. The DoubleMaxSignificant precision is the worst case. - while (length > 0 && result[length - 1] == '0') - --length; - if (sign) *sign = nonNullSign ? 1 : 0; if (decpt) |