QtNetwork: add qMove() to QSharedPointer uses where applicable

QSharedPointers here are passed by value - good, since it enabled C++11 move semantics,
transparently.

However, when passing such parameters on to assignment operators or other functions,
copies were made where moves would have been sufficient. Thus, add some qMove()s.

Change-Id: Ied1a5edf1bfbb16108dfeefbe85e58ab3d4ef92f
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Marc Mutz 2014-02-22 23:38:21 +01:00 committed by The Qt Project
parent e3db3c4d78
commit bcea86b7da
2 changed files with 4 additions and 4 deletions

View File

@ -1131,7 +1131,7 @@ QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16
: QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt)), parent)
{
Q_D(QHttpNetworkConnection);
d->networkSession = networkSession;
d->networkSession = qMove(networkSession);
d->init();
}
@ -1139,7 +1139,7 @@ QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QS
: QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt)), parent)
{
Q_D(QHttpNetworkConnection);
d->networkSession = networkSession;
d->networkSession = qMove(networkSession);
d->init();
}
#else
@ -1248,7 +1248,7 @@ QSharedPointer<QSslContext> QHttpNetworkConnection::sslContext()
void QHttpNetworkConnection::setSslContext(QSharedPointer<QSslContext> context)
{
Q_D(QHttpNetworkConnection);
d->sslContext = context;
d->sslContext = qMove(context);
}
void QHttpNetworkConnection::ignoreSslErrors(int channel)

View File

@ -184,7 +184,7 @@ public:
: QHttpNetworkConnection(hostName, port, encrypt)
#else
QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, QSharedPointer<QNetworkSession> networkSession)
: QHttpNetworkConnection(hostName, port, encrypt, /*parent=*/0, networkSession)
: QHttpNetworkConnection(hostName, port, encrypt, /*parent=*/0, qMove(networkSession))
#endif
{
setExpires(true);