diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-04 10:18:43 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-28 21:27:40 +0200 |
commit | e7db401b48a8b0793ec04c98558ebea0c7bfe515 (patch) | |
tree | 2c55d857e2ff1b9ac75dc9acc8a1e7b3c473e7bc /src/corelib/text/qlocale.cpp | |
parent | 2d6705575cfcd5abb0d66f2aa94df92f4dda3e81 (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.cpp')
-rw-r--r-- | src/corelib/text/qlocale.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 159cbc0944..152570bc84 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -103,9 +103,9 @@ QLocale::Language QLocalePrivate::codeToLanguage(QStringView code) noexcept const auto len = code.size(); if (len != 2 && len != 3) return QLocale::C; - ushort uc1 = code[0].toLower().unicode(); - ushort uc2 = code[1].toLower().unicode(); - ushort uc3 = len > 2 ? code[2].toLower().unicode() : 0; + char16_t uc1 = code[0].toLower().unicode(); + char16_t uc2 = code[1].toLower().unicode(); + char16_t uc3 = len > 2 ? code[2].toLower().unicode() : 0; const unsigned char *c = language_code_list; for (; *c != 0; c += 3) { @@ -168,9 +168,9 @@ QLocale::Country QLocalePrivate::codeToCountry(QStringView code) noexcept if (len != 2 && len != 3) return QLocale::AnyCountry; - ushort uc1 = code[0].toUpper().unicode(); - ushort uc2 = code[1].toUpper().unicode(); - ushort uc3 = len > 2 ? code[2].toUpper().unicode() : 0; + char16_t uc1 = code[0].toUpper().unicode(); + char16_t uc2 = code[1].toUpper().unicode(); + char16_t uc3 = len > 2 ? code[2].toUpper().unicode() : 0; const unsigned char *c = country_code_list; for (; *c != 0; c += 3) { @@ -879,7 +879,7 @@ QString QLocaleData::zeroDigit() const return zero().getData(single_character_data); } -uint QLocaleData::zeroUcs() const +char32_t QLocaleData::zeroUcs() const { #ifndef QT_NO_SYSTEMLOCALE if (this == systemData()) { @@ -3326,7 +3326,7 @@ QString QLocaleData::doubleToString(double d, int precision, DoubleForm form, QString converted; converted.reserve(2 * digits.size()); for (int i = 0; i < digits.length(); ++i) { - const uint digit = unicodeForDigit(digits.at(i).unicode() - '0', zeroUcs4); + const char32_t digit = unicodeForDigit(digits.at(i).unicode() - '0', zeroUcs4); Q_ASSERT(QChar::requiresSurrogates(digit)); converted.append(QChar::highSurrogate(digit)); converted.append(QChar::lowSurrogate(digit)); @@ -3335,8 +3335,8 @@ QString QLocaleData::doubleToString(double d, int precision, DoubleForm form, } else { Q_ASSERT(zero.size() == 1); Q_ASSERT(!zero.at(0).isSurrogate()); - ushort z = zero.at(0).unicode(); - ushort *const value = reinterpret_cast<ushort *>(digits.data()); + char16_t z = zero.at(0).unicode(); + char16_t *const value = reinterpret_cast<char16_t *>(digits.data()); for (int i = 0; i < digits.length(); ++i) value[i] = unicodeForDigit(value[i] - '0', z); } |