QtCore: use new QChar::fromUcs{2,4}()
Also replace one case of QChar(0) with QChar::Null. These were errors in my local tree, which means they're included in bootstrap builds (incl. qmake). Change-Id: I3dffa9383fd1a30aa43fe2491ad95bb2b1869b40 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
1a8916cc4f
commit
e9005608ea
@ -821,7 +821,7 @@ QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::Convert
|
||||
endian = BigEndianness;
|
||||
} else {
|
||||
endian = LittleEndianness;
|
||||
ch = QChar((ch.unicode() >> 8) | ((ch.unicode() & 0xff) << 8));
|
||||
ch = QChar::fromUcs2((ch.unicode() >> 8) | ((ch.unicode() & 0xff) << 8));
|
||||
}
|
||||
*qch++ = ch;
|
||||
}
|
||||
@ -951,12 +951,8 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert
|
||||
}
|
||||
}
|
||||
uint code = (endian == BigEndianness) ? qFromBigEndian<quint32>(tuple) : qFromLittleEndian<quint32>(tuple);
|
||||
if (QChar::requiresSurrogates(code)) {
|
||||
*qch++ = QChar(QChar::highSurrogate(code));
|
||||
*qch++ = QChar(QChar::lowSurrogate(code));
|
||||
} else {
|
||||
*qch++ = QChar(code);
|
||||
}
|
||||
for (char16_t c : QChar::fromUcs4(code))
|
||||
*qch++ = c;
|
||||
num = 0;
|
||||
}
|
||||
}
|
||||
|
@ -525,14 +525,14 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
|
||||
case QMetaType::Short:
|
||||
case QMetaType::Long:
|
||||
case QMetaType::Float:
|
||||
*c = QChar(ushort(qMetaTypeNumber(d)));
|
||||
*c = QChar::fromUcs2(qMetaTypeNumber(d));
|
||||
break;
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
case QMetaType::UChar:
|
||||
case QMetaType::UShort:
|
||||
case QMetaType::ULong:
|
||||
*c = QChar(ushort(qMetaTypeUNumber(d)));
|
||||
*c = QChar::fromUcs2(qMetaTypeUNumber(d));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -922,12 +922,7 @@ bool Parser::parseString()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (QChar::requiresSurrogates(ch)) {
|
||||
ucs4.append(QChar::highSurrogate(ch));
|
||||
ucs4.append(QChar::lowSurrogate(ch));
|
||||
} else {
|
||||
ucs4.append(QChar(ushort(ch)));
|
||||
}
|
||||
ucs4.append(QChar::fromUcs4(ch));
|
||||
}
|
||||
++json;
|
||||
|
||||
|
@ -3897,7 +3897,7 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o
|
||||
|
||||
char out = numericToCLocale(in);
|
||||
if (out == 0) {
|
||||
const QChar simple(in.size() == 1 ? in.front() : QChar(0));
|
||||
const QChar simple = in.size() == 1 ? in.front() : QChar::Null;
|
||||
if (in == listSeparator())
|
||||
out = ';';
|
||||
else if (in == percentSign())
|
||||
|
Loading…
x
Reference in New Issue
Block a user