summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qlocale_tools.cpp14
-rw-r--r--src/corelib/tools/qlocale_tools_p.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp
index a6a699fa16..5fd2aa0c59 100644
--- a/src/corelib/tools/qlocale_tools.cpp
+++ b/src/corelib/tools/qlocale_tools.cpp
@@ -535,10 +535,20 @@ QString &exponentForm(QChar zero, QChar decimal, QChar exponential,
double qstrtod(const char *s00, const char **se, bool *ok)
{
+ const int len = static_cast<int>(strlen(s00));
+ Q_ASSERT(len >= 0);
+ return qstrntod(s00, len, se, ok);
+}
+
+/*!
+ \internal
+
+ Converts the initial portion of the string pointed to by \a s00 to a double, using the 'C' locale.
+ */
+double qstrntod(const char *s00, int len, const char **se, bool *ok)
+{
int processed = 0;
bool nonNullOk = false;
- int len = static_cast<int>(strlen(s00));
- Q_ASSERT(len >= 0);
double d = asciiToDouble(s00, len, nonNullOk, processed, TrailingJunkAllowed);
if (se)
*se = s00 + processed;
diff --git a/src/corelib/tools/qlocale_tools_p.h b/src/corelib/tools/qlocale_tools_p.h
index b09ab564bb..6133f67add 100644
--- a/src/corelib/tools/qlocale_tools_p.h
+++ b/src/corelib/tools/qlocale_tools_p.h
@@ -115,6 +115,7 @@ inline bool isZero(double d)
}
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
+Q_CORE_EXPORT double qstrntod(const char *s00, int len, char const **se, bool *ok);
qlonglong qstrtoll(const char *nptr, const char **endptr, int base, bool *ok);
qulonglong qstrtoull(const char *nptr, const char **endptr, int base, bool *ok);