summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-02-04 14:14:23 -0800
committerThiago Macieira <thiago.macieira@intel.com>2015-03-26 06:11:14 +0000
commite1c99e15b6bc3363b748e3845cfb0c5f96f8fe90 (patch)
treee51a91ad0476c27c774ab1761b6bc190261a33b2 /src/corelib/global
parentf43a624ab840c387c6e26dc6e9259200d0b1a3b7 (diff)
Update strtoll and strtoull from upstream FreeBSD
There appears to be at least one fix, related to sign- or zero-extension in the call to isspace(). So it's a good idea to update again. This also brings the behavior to match strtoll and strtoull on Linux, including the fact that strtoull will parse negative numbers. For that reason, qstrtoll and qstrtoull are now wrappers that try and keep the behavior that we used to have. This update also changes the code from a 4-clause BSD license (bad) to a 3-clause BSD license (good). Change-Id: I73b01b02ebd1551bf924599d52284ad25cc1def0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 7913af3103..ac2f72d573 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -3127,11 +3127,14 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT
return 0;
}
#endif
- const qlonglong value = qstrtoll(buffer, Q_NULLPTR, 0, ok);
+ bool ok_ = true;
+ const qlonglong value = qstrtoll(buffer, Q_NULLPTR, 0, &ok_);
if (int(value) != value) { // this is the check in QByteArray::toInt(), keep it in sync
if (ok)
*ok = false;
return 0;
+ } else if (ok) {
+ *ok = ok_;
}
return int(value);
}