diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-10-19 14:27:51 +0300 |
---|---|---|
committer | Anton Kudryavtsev <antkudr@mail.ru> | 2016-10-25 05:12:29 +0000 |
commit | c30e62c7750b804bfe6f3ed29914ebb42890230d (patch) | |
tree | 7b1ed8128eccae36b574b04586dea8d9cdb791c0 | |
parent | 26ac91c832c2a8db1327e24e6ff88eef82cc4530 (diff) |
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>
6 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index c79198d7fe..370c3426f5 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -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; diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 48e0af5479..3e1e93f1e4 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -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 diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp index a78f445995..38419a55c8 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp @@ -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(); diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 7b3a5ec70c..6fd0191e43 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -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); diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index 3643b3e975..7592eb2887 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -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; diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 8744fcba3e..2303ccf806 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -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); |