diff options
author | Joaquim Rocha <jrocha@igalia.com> | 2010-11-15 12:46:40 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-11-22 05:20:28 (GMT) |
commit | ea440d1897c7c9d69401ac293663fbc4f2866d08 (patch) | |
tree | 0422cadbca2e9040474f35fb995db86795df2ab3 /src/corelib/tools/qlocale.cpp | |
parent | 0cfa6daa4776cd78370e644fae3005ae432b83c7 (diff) | |
download | Qt-ea440d1897c7c9d69401ac293663fbc4f2866d08.zip Qt-ea440d1897c7c9d69401ac293663fbc4f2866d08.tar.gz Qt-ea440d1897c7c9d69401ac293663fbc4f2866d08.tar.bz2 |
Fix wrong error assumption when converting "0.0" to double
The function qstrtod calls strtod without first resetting the errno
but verifying it nonetheless. This could lead to situations where
the errno was already set to ERANGE and hence it would mistakenly
assume the conversion could not be done right.
Merge-request: 2507
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
(cherry picked from commit 759c0b5ecf84201f36d44b4e6c46da1886d85dee)
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index d152682..83d6dcd 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -7308,6 +7308,7 @@ Q_CORE_EXPORT char *qdtoa( double d, int mode, int ndigits, int *decpt, int *sig Q_CORE_EXPORT double qstrtod(const char *s00, const char **se, bool *ok) { + errno = 0; double ret = strtod((char*)s00, (char**)se); if (ok) { if((ret == 0.0l && errno == ERANGE) |