summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qlocale.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-11-01 17:40:33 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2022-11-11 16:32:53 +0100
commit23a854c3a68900752cf146a9c758eba51fdee3a3 (patch)
tree08119bff5260cbf77ec299c1d31d8f00410749db /src/corelib/text/qlocale.cpp
parentdf8d26f30943610b84183a7edac64f74de4571c0 (diff)
QLocaleData::validateChars(): exploit last to detect first iteration
Checking the value of last, instead of the index, prepares the way for using QStringIterator here. Change-Id: Ided0530413211e918acd406ebdb37f16006ef07d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qlocale.cpp')
-rw-r--r--src/corelib/text/qlocale.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index b9aaa5b338..83afa4b5b9 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -4022,7 +4022,7 @@ bool QLocaleData::validateChars(QStringView str, NumberMode numMode, QByteArray
enum { Whole, Fractional, Exponent } state = Whole;
const bool scientific = numMode == DoubleScientificMode;
- char last = 0;
+ char last = '\0';
for (qsizetype i = 0; i < str.size();) {
const QStringView in = str.mid(i, str.at(i).isHighSurrogate() ? 2 : 1);
@@ -4064,7 +4064,7 @@ bool QLocaleData::validateChars(QStringView str, NumberMode numMode, QByteArray
case '+':
case '-':
// A sign can only appear at the start or after the e of scientific:
- if (i != 0 && !(scientific && last == 'e'))
+ if (last != '\0' && !(scientific && last == 'e'))
return false;
break;