From 7a8b277d5bcfd3597b6634e0402ac5f7202d9b71 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 27 Apr 2020 11:17:31 +0200 Subject: [PATCH] QtGui: fix a few more char/int/uint -> QChar conversions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: I343269b61d555c259b5780011e99f85f5375ef78 Reviewed-by: MÃ¥rten Nordheim --- src/gui/kernel/qplatformtheme.cpp | 2 +- src/gui/painting/qrangecollection.cpp | 4 ++-- src/gui/text/qfontengine.cpp | 4 ++-- src/gui/text/qtexthtmlparser.cpp | 2 +- src/gui/util/qhexstring_p.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 93fd59e53f..04eaddd6df 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -750,7 +750,7 @@ QString QPlatformTheme::defaultStandardButtonText(int button) QString QPlatformTheme::removeMnemonics(const QString &original) { - QString returnText(original.size(), 0); + QString returnText(original.size(), u'\0'); int finalDest = 0; int currPos = 0; int l = original.length(); diff --git a/src/gui/painting/qrangecollection.cpp b/src/gui/painting/qrangecollection.cpp index 9acb36a000..5fd4ebaa4b 100644 --- a/src/gui/painting/qrangecollection.cpp +++ b/src/gui/painting/qrangecollection.cpp @@ -156,7 +156,7 @@ void QRangeCollection::clear() bool QRangeCollection::parse(const QString &ranges) { Q_D(QRangeCollection); - const QStringList items = ranges.split(','); + const QStringList items = ranges.split(u','); for (const QString &item : items) { if (item.isEmpty()) { d->intervals.clear(); @@ -164,7 +164,7 @@ bool QRangeCollection::parse(const QString &ranges) } if (item.contains(QLatin1Char('-'))) { - const QStringList rangeItems = item.split('-'); + const QStringList rangeItems = item.split(u'-'); if (rangeItems.count() != 2) { d->intervals.clear(); return false; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 1269aefbf2..c260c06fe4 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1834,12 +1834,12 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, int lastFallback = -1; while (it.hasNext()) { - const uint ucs4 = it.peekNext(); + const char32_t ucs4 = it.peekNext(); // If we applied a fallback font to previous glyph, and the current is either // ZWJ or ZWNJ, we should also try applying the same fallback font to that, in order // to get the correct shaping rules applied. - if (lastFallback >= 0 && (ucs4 == QChar(0x200d) || ucs4 == QChar(0x200c))) { + if (lastFallback >= 0 && (ucs4 == 0x200d || ucs4 == 0x200c)) { QFontEngine *engine = m_engines.at(lastFallback); glyph_t glyph = engine->glyphIndex(ucs4); if (glyph != 0) { diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 76ff99aae0..0c8a29c6be 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE // see also tst_qtextdocumentfragment.cpp #define MAX_ENTITY 258 -static const struct QTextHtmlEntity { const char name[9]; quint16 code; } entities[]= { +static const struct QTextHtmlEntity { const char name[9]; char16_t code; } entities[]= { { "AElig", 0x00c6 }, { "AMP", 38 }, { "Aacute", 0x00c1 }, diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h index d30a8eeee8..2afbf3a42b 100644 --- a/src/gui/util/qhexstring_p.h +++ b/src/gui/util/qhexstring_p.h @@ -69,7 +69,7 @@ template inline void write(QChar *&dest) const { - const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + const char16_t hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; const char *c = reinterpret_cast(&val); for (uint i = 0; i < sizeof(T); ++i) { *dest++ = hexChars[*c & 0xf];