Plugins: use const (and const APIs) more

For CoW types, prefer const methods to avoid needless detach()ing.

Change-Id: I625d57c0c19e87ac2de681bb16d0cc5a7a59b366
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Anton Kudryavtsev 2016-10-19 14:27:51 +03:00 committed by Anton Kudryavtsev
parent 26ac91c832
commit c30e62c775
6 changed files with 6 additions and 6 deletions

View File

@ -514,7 +514,7 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para
if (m_applicationParams.length()) {
// Obtain a handle to the main library (the library that contains the main() function).
// This library should already be loaded, and calling dlopen() will just return a reference to it.
m_mainLibraryHnd = dlopen(m_applicationParams.first().data(), 0);
m_mainLibraryHnd = dlopen(m_applicationParams.constFirst().data(), 0);
if (Q_UNLIKELY(!m_mainLibraryHnd)) {
qCritical() << "dlopen failed:" << dlerror();
return false;

View File

@ -199,7 +199,7 @@ void QEglFSDeviceIntegration::screenDestroy()
QEglFSIntegration *platformIntegration = static_cast<QEglFSIntegration *>(
QGuiApplicationPrivate::platformIntegration());
while (!app->screens().isEmpty())
platformIntegration->removeScreen(app->screens().last()->handle());
platformIntegration->removeScreen(app->screens().constLast()->handle());
}
QSizeF QEglFSDeviceIntegration::physicalScreenSize() const

View File

@ -126,7 +126,7 @@ QEglFSKmsDevice *QEglFSKmsGbmIntegration::createDevice(const QString &devicePath
} else {
QDeviceDiscovery *d = QDeviceDiscovery::create(QDeviceDiscovery::Device_VideoMask);
QStringList devices = d->scanConnectedDevices();
const QStringList devices = d->scanConnectedDevices();
qCDebug(qLcEglfsKmsDebug) << "Found the following video devices:" << devices;
d->deleteLater();

View File

@ -569,7 +569,7 @@ void QQnxWindow::requestActivateWindow()
for (int i = 1; i < windowList.size(); ++i)
windowList.at(i-1)->setFocus(windowList.at(i)->nativeHandle());
windowList.last()->setFocus(windowList.last()->nativeHandle());
windowList.last()->setFocus(windowList.constLast()->nativeHandle());
}
screen_flush_context(m_screenContext, 0);

View File

@ -220,7 +220,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
// The atomName variable is not used because mimeAtomToString()
// converts "text/x-moz-url" to "text/uri-list".
if (!list.isEmpty() && connection->atomName(a) == "text/x-moz-url")
return list.first();
return list.constFirst();
return list;
} else {
return str;

View File

@ -146,7 +146,7 @@ static void sm_setProperty(const QString &name, const QStringList &value)
for (QStringList::ConstIterator it = value.begin(); it != value.end(); ++it) {
prop[count].length = (*it).length();
vl.append((*it).toUtf8());
prop[count].value = (char*)vl.last().data();
prop[count].value = (char*)vl.constLast().data();
++count;
}
sm_setProperty(name.toLatin1().data(), SmLISTofARRAY8, count, prop);