diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/corelib/global/qtenvironmentvariables.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/global/qtenvironmentvariables.cpp b/src/corelib/global/qtenvironmentvariables.cpp index ae213aa1e39..ffafbdf4180 100644 --- a/src/corelib/global/qtenvironmentvariables.cpp +++ b/src/corelib/global/qtenvironmentvariables.cpp @@ -10,6 +10,7 @@ #include <QtCore/qstring.h> #include <QtCore/qvarlengtharray.h> +#include <QtCore/private/qlocale_p.h> #include <QtCore/private/qlocking_p.h> QT_BEGIN_NAMESPACE @@ -253,11 +254,10 @@ std::optional<int> qEnvironmentVariableIntegerValue(const char *varName) noexcep if (!buffer || (size = strlen(buffer)) > MaxDigitsForOctalInt) return std::nullopt; #endif - bool ok; - int value = QByteArrayView(buffer, size).toInt(&ok, 0); - if (!ok) + auto r = QLocaleData::bytearrayToLongLong(QByteArrayView(buffer, size), 0); + if (!r.ok() || int(r.result) != r.result) return std::nullopt; - return value; + return r.result; } /*! |
