diff options
author | Joaquim Rocha <jrocha@igalia.com> | 2010-11-15 12:46:40 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2010-11-15 12:46:40 (GMT) |
commit | 759c0b5ecf84201f36d44b4e6c46da1886d85dee (patch) | |
tree | aea359a16fae284e563accd1994fe971f38e0df6 /src/corelib/tools | |
parent | b36e357b982ba01cbf905fb1d0340e87030b0a95 (diff) | |
download | Qt-759c0b5ecf84201f36d44b4e6c46da1886d85dee.zip Qt-759c0b5ecf84201f36d44b4e6c46da1886d85dee.tar.gz Qt-759c0b5ecf84201f36d44b4e6c46da1886d85dee.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>
Diffstat (limited to 'src/corelib/tools')
-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 6b1de5e..2fb3616 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) |