summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstringconverter.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-07-06 09:36:32 +0200
committerLars Knoll <lars.knoll@qt.io>2020-07-06 11:31:43 +0200
commita5025efccfa877426dcdf31d91cacb1a6c52b276 (patch)
tree24de4172a1ddcb92258fbe64b89d68e061f2a145 /src/corelib/text/qstringconverter.cpp
parentcd67fe582142b308f98eab30d057eceaee8d6d88 (diff)
Fix a crash in QClipBoard when copying utf16 data
Properly use the new QStringConverter API and not an internal qFromUtfEncoded method that was buggy after the changes. Take the oppportunity to clean up and remove qFromUtfEncoded, as QClipboard was its only user. Fixes: QTBUG-85417 Change-Id: I8540d12056bf3f448c1f628ce0bd0ad462a6447d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/corelib/text/qstringconverter.cpp')
-rw-r--r--src/corelib/text/qstringconverter.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp
index 30da0add8f..511f2d7810 100644
--- a/src/corelib/text/qstringconverter.cpp
+++ b/src/corelib/text/qstringconverter.cpp
@@ -1067,26 +1067,6 @@ QChar *QUtf32::convertToUnicode(QChar *out, const char *chars, qsizetype len, QS
return out;
}
-QString qFromUtfEncoded(const QByteArray &ba)
-{
- const qsizetype arraySize = ba.size();
- const uchar *buf = reinterpret_cast<const uchar *>(ba.constData());
- const uint bom = 0xfeff;
-
- if (arraySize > 3) {
- uint uc = qFromUnaligned<uint>(buf);
- if (uc == qToBigEndian(bom) || uc == qToLittleEndian(bom))
- return QUtf32::convertToUnicode(ba.constData(), ba.length(), nullptr); // utf-32
- }
-
- if (arraySize > 1) {
- ushort uc = qFromUnaligned<ushort>(buf);
- if (uc == qToBigEndian(ushort(bom)) || qToLittleEndian(ushort(bom)))
- return QUtf16::convertToUnicode(ba.constData(), ba.length(), nullptr); // utf-16
- }
- return QUtf8::convertToUnicode(ba.constData(), ba.length());
-}
-
#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
static QString convertToUnicodeCharByChar(const char *chars, qsizetype length, QStringConverter::State *state)
{