Use new QBA::assign in QXcbMime::mimeDataForAtom
QByteArray::assign() re-uses existing unshared capacity(), if any, and is therefore potentially more efficient than '= QByteArray(~)' (and never slower). Task-number: QTBUG-106201 Pick-to: 6.6 Change-Id: I5e5114064c8aaa23892e95c235335632d7c5cd0a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
da5f2fc6be
commit
d7d15c1a47
@ -79,8 +79,7 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa
|
|||||||
if (atomName == "text/uri-list"_L1
|
if (atomName == "text/uri-list"_L1
|
||||||
&& connection->atomName(a) == "text/x-moz-url") {
|
&& connection->atomName(a) == "text/x-moz-url") {
|
||||||
const QString mozUri = QLatin1StringView(data->split('\n').constFirst()) + u'\n';
|
const QString mozUri = QLatin1StringView(data->split('\n').constFirst()) + u'\n';
|
||||||
*data = QByteArray(reinterpret_cast<const char *>(mozUri.data()),
|
data->assign({reinterpret_cast<const char *>(mozUri.data()), mozUri.size() * 2});
|
||||||
mozUri.size() * 2);
|
|
||||||
} else if (atomName == "application/x-color"_L1)
|
} else if (atomName == "application/x-color"_L1)
|
||||||
*dataFormat = 16;
|
*dataFormat = 16;
|
||||||
ret = true;
|
ret = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user