QtCore: fix a few more char/int/uint -> QChar conversions
They were masked by all QChar ctors being made explicit, except the char16_t one, which was left as the only viable choice. Change-Id: I5632795f3c7dd1de3830285d5446d9b994613466 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
2e41a46690
commit
915e756a42
|
|
@ -281,7 +281,7 @@ bool QMimeBinaryProvider::matchSuffixTree(QMimeGlobMatchResult &result, QMimeBin
|
|||
while (min <= max) {
|
||||
const int mid = (min + max) / 2;
|
||||
const int off = firstOffset + 12 * mid;
|
||||
const QChar ch = cacheFile->getUint32(off);
|
||||
const QChar ch = char16_t(cacheFile->getUint32(off));
|
||||
if (ch < fileChar)
|
||||
min = mid + 1;
|
||||
else if (ch > fileChar)
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ static QString makeFpString(double d)
|
|||
s.prepend(QLatin1Char('-'));
|
||||
} else {
|
||||
s = QString::number(d, 'g', QLocale::FloatingPointShortest);
|
||||
if (!s.contains(QLatin1Char('.')) && !s.contains('e'))
|
||||
if (!s.contains(u'.') && !s.contains(u'e'))
|
||||
s += QLatin1Char('.');
|
||||
}
|
||||
return s;
|
||||
|
|
@ -171,14 +171,17 @@ void DiagnosticNotation::appendString(const QString &s)
|
|||
buf[1] = QChar(uc);
|
||||
|
||||
if (buf[1] == QChar::Null) {
|
||||
using QtMiscUtils::toHexUpper;
|
||||
const auto toHexUpper = [](char32_t value) -> QChar {
|
||||
// QtMiscUtils::toHexUpper() returns char, we need QChar, so wrap
|
||||
return char16_t(QtMiscUtils::toHexUpper(value));
|
||||
};
|
||||
if (ptr->isHighSurrogate() && (ptr + 1) != end && ptr[1].isLowSurrogate()) {
|
||||
// properly-paired surrogates
|
||||
++ptr;
|
||||
char32_t ucs4 = QChar::surrogateToUcs4(uc, ptr->unicode());
|
||||
buf[1] = 'U';
|
||||
buf[2] = '0'; // toHexUpper(ucs4 >> 28);
|
||||
buf[3] = '0'; // toHexUpper(ucs4 >> 24);
|
||||
buf[1] = u'U';
|
||||
buf[2] = u'0'; // toHexUpper(ucs4 >> 28);
|
||||
buf[3] = u'0'; // toHexUpper(ucs4 >> 24);
|
||||
buf[4] = toHexUpper(ucs4 >> 20);
|
||||
buf[5] = toHexUpper(ucs4 >> 16);
|
||||
buf[6] = toHexUpper(ucs4 >> 12);
|
||||
|
|
@ -187,7 +190,7 @@ void DiagnosticNotation::appendString(const QString &s)
|
|||
buf[9] = toHexUpper(ucs4);
|
||||
buflen = 10;
|
||||
} else {
|
||||
buf[1] = 'u';
|
||||
buf[1] = u'u';
|
||||
buf[2] = toHexUpper(uc >> 12);
|
||||
buf[3] = toHexUpper(uc >> 8);
|
||||
buf[4] = toHexUpper(uc >> 4);
|
||||
|
|
|
|||
|
|
@ -1663,9 +1663,9 @@ QDateTimeParser::findTimeZone(QStringRef str, const QDateTime &when,
|
|||
|
||||
// Collect up plausibly-valid characters; let QTimeZone work out what's truly valid.
|
||||
while (index < size) {
|
||||
QChar here = str[index];
|
||||
const auto here = str[index].unicode();
|
||||
if (here < 127
|
||||
&& (here.isLetterOrNumber()
|
||||
&& (QChar::isLetterOrNumber(here)
|
||||
|| here == '/' || here == '-'
|
||||
|| here == '_' || here == '.'
|
||||
|| here == '+' || here == ':'))
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ static QTzTimeZoneHash loadTzTimeZones()
|
|||
while (!ts.atEnd()) {
|
||||
const QString line = ts.readLine();
|
||||
// Comment lines are prefixed with a #
|
||||
if (!line.isEmpty() && line.at(0) != '#') {
|
||||
if (!line.isEmpty() && line.at(0) != u'#') {
|
||||
// Data rows are tab-separated columns Region, Coordinates, ID, Optional Comments
|
||||
const auto parts = line.splitRef(QLatin1Char('\t'));
|
||||
QTzTimeZone zone;
|
||||
|
|
|
|||
Loading…
Reference in New Issue