diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-01-04 15:14:21 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-01-05 11:29:29 +0000 |
commit | 9d6a4e70946105e6af2ff4dde281297627881928 (patch) | |
tree | 64f35e9ae5c59bdd6a43cb58644580103faa9ba2 /src/corelib/tools/qlocale_tools_p.h | |
parent | 8b2f133822a22379cbbaa33fe600c30b95dc0044 (diff) |
QLocale: Accept trailing junk in qstrtod()
qstrtod() used to accept trailing junk until libdouble-conversion was
introduced and we need this behavior in order to implement EcmaScript's
parseFloat() correctly. The QString and QByteArray methods should not
accept trailing junk, though.
Task-number: QTBUG-50131
Change-Id: Ide922da0d65b2576be2c9f47f6053057eff77994
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib/tools/qlocale_tools_p.h')
-rw-r--r-- | src/corelib/tools/qlocale_tools_p.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/corelib/tools/qlocale_tools_p.h b/src/corelib/tools/qlocale_tools_p.h index 3a8036c642..f28b3dffcd 100644 --- a/src/corelib/tools/qlocale_tools_p.h +++ b/src/corelib/tools/qlocale_tools_p.h @@ -66,7 +66,13 @@ QT_BEGIN_NAMESPACE -double asciiToDouble(const char *num, int numLen, bool &ok, int &processed); +enum TrailingJunkMode { + TrailingJunkProhibited, + TrailingJunkAllowed +}; + +double asciiToDouble(const char *num, int numLen, bool &ok, int &processed, + TrailingJunkMode trailingJunkMode = TrailingJunkProhibited); void doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, char *buf, int bufSize, bool &sign, int &length, int &decpt); |