summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qlocale_tools.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-08-04 10:18:43 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-08-28 21:27:40 +0200
commite7db401b48a8b0793ec04c98558ebea0c7bfe515 (patch)
tree2c55d857e2ff1b9ac75dc9acc8a1e7b3c473e7bc /src/corelib/text/qlocale_tools.cpp
parent2d6705575cfcd5abb0d66f2aa94df92f4dda3e81 (diff)
Use char32_t for QLocaleData::zeroUcs() and friends
Also catch some stray ushort that should be char16_t by now, use unicode character values for some constants and rename a UCS2 variable to not claim it's UCS4. Change-Id: I374b791947f5c965eaa22ad5b16060b475081c9d Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qlocale_tools.cpp')
-rw-r--r--src/corelib/text/qlocale_tools.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/text/qlocale_tools.cpp b/src/corelib/text/qlocale_tools.cpp
index cc34d3149a..cad2ce7353 100644
--- a/src/corelib/text/qlocale_tools.cpp
+++ b/src/corelib/text/qlocale_tools.cpp
@@ -461,8 +461,8 @@ QString qulltoa(qulonglong number, int base, const QStringView zero)
// per digit. We do not need a terminator.
const unsigned maxlen = 128;
static_assert(CHAR_BIT * sizeof(number) <= maxlen);
- ushort buff[maxlen];
- ushort *const end = buff + maxlen, *p = end;
+ char16_t buff[maxlen];
+ char16_t *const end = buff + maxlen, *p = end;
if (base != 10 || zero == u"0") {
while (number != 0) {
@@ -471,16 +471,16 @@ QString qulltoa(qulonglong number, int base, const QStringView zero)
number /= base;
}
} else if (zero.size() && !zero.at(0).isSurrogate()) {
- const ushort zeroUcs4 = zero.at(0).unicode();
+ const char16_t zeroUcs2 = zero.at(0).unicode();
while (number != 0) {
- *(--p) = unicodeForDigit(number % base, zeroUcs4);
+ *(--p) = unicodeForDigit(number % base, zeroUcs2);
number /= base;
}
} else if (zero.size() == 2 && zero.at(0).isHighSurrogate()) {
- const uint zeroUcs4 = QChar::surrogateToUcs4(zero.at(0), zero.at(1));
+ const char32_t zeroUcs4 = QChar::surrogateToUcs4(zero.at(0), zero.at(1));
while (number != 0) {
- const uint digit = unicodeForDigit(number % base, zeroUcs4);
+ const char32_t digit = unicodeForDigit(number % base, zeroUcs4);
*(--p) = QChar::lowSurrogate(digit);
*(--p) = QChar::highSurrogate(digit);