summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-11-01 17:08:45 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2022-11-11 16:32:53 +0100
commit89c6271af03b7d2b6b6373f185ee4ff3b67319cb (patch)
tree48d393a4b1d5cba865c523b39cde0fb632b143cd
parent23a854c3a68900752cf146a9c758eba51fdee3a3 (diff)
QLocaleData::numberToCLocale(): consolidate two branches
The handling of a digit was done in two parts, separating the case for the first digit from the handling of later digits. Nothing in the else/if chain between involved digits, so the latter can move to the front and be combined with the former. Change-Id: I4c93515f36452721bdef472cc2f0af7ceeb00527 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/text/qlocale.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index 83afa4b5b9..a6ba1931cb 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -3948,9 +3948,10 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o
}
if (!number_options.testFlag(QLocale::RejectGroupSeparator)) {
- if (start_of_digits_idx == -1 && out >= '0' && out <= '9') {
- start_of_digits_idx = idx;
- digitsInGroup++;
+ if (out >= '0' && out <= '9') {
+ if (start_of_digits_idx == -1)
+ start_of_digits_idx = idx;
+ ++digitsInGroup;
} else if (out == ',') {
// Don't allow group chars after the decimal point or exponent
if (decpt_idx != -1 || exponent_idx != -1)
@@ -3979,8 +3980,6 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o
// stop processing separators
last_separator_idx = -1;
- } else if (out >= '0' && out <= '9') {
- digitsInGroup++;
}
} else if (out == ',') {
return false;