Fix container detach warnings from clazy

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: apol, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D17164
This commit is contained in:
Nicolas Fella 2018-11-25 23:58:24 +01:00
parent b435ab1f46
commit bd17dc2041
8 changed files with 16 additions and 12 deletions

View file

@ -152,7 +152,8 @@ int main(int argc, char** argv)
urls.append(url);
// Check for more arguments
for (const QString& input : parser.positionalArguments()) {
const auto args = parser.positionalArguments();
for (const QString& input : args) {
QUrl url = QUrl::fromUserInput(input, QDir::currentPath());
urls.append(url);
}

View file

@ -289,7 +289,7 @@ void Daemon::addDevice(Device* device)
QStringList Daemon::pairingRequests() const
{
QStringList ret;
for(Device* dev: d->m_devices) {
for(Device* dev: qAsConst(d->m_devices)) {
if (dev->hasPairingRequests())
ret += dev->id();
}

View file

@ -441,7 +441,7 @@ void Device::cleanUnneededLinks() {
QHostAddress Device::getLocalIpAddress() const
{
for (DeviceLink* dl : d->m_deviceLinks) {
for (DeviceLink* dl : qAsConst(d->m_deviceLinks)) {
LanDeviceLink* ldl = dynamic_cast<LanDeviceLink*>(dl);
if (ldl) {
return ldl->hostAddress();

View file

@ -76,7 +76,7 @@ void RemoteSinksModel::setDeviceId(const QString& deviceId)
this, &RemoteSinksModel::refreshSinkList);
connect(m_dbusInterface, &OrgKdeKdeconnectDeviceRemotesystemvolumeInterface::volumeChanged, this, [this](const QString& name, int volume) {
for (Sink* s: m_sinkList) {
for (Sink* s: qAsConst(m_sinkList)) {
if (s->name == name) {
s->volume = volume;
Q_EMIT dataChanged(index(0,0), index(m_sinkList.size() - 1, 0));
@ -85,7 +85,7 @@ void RemoteSinksModel::setDeviceId(const QString& deviceId)
});
connect(m_dbusInterface, &OrgKdeKdeconnectDeviceRemotesystemvolumeInterface::mutedChanged, this, [this](const QString& name, bool muted) {
for (Sink* s: m_sinkList) {
for (Sink* s: qAsConst(m_sinkList)) {
if (s->name == name) {
s->muted = muted;
Q_EMIT dataChanged(index(0,0), index(m_sinkList.size() - 1, 0));

View file

@ -109,8 +109,9 @@ void SendNotificationsConfig::save()
config()->set(QStringLiteral("generalUrgency"), m_ui->spin_urgency->value());
QVariantList list;
list.reserve(appModel->apps().size());
for (const auto& a: appModel->apps()) {
const auto apps = appModel->apps();
list.reserve(apps.size());
for (const auto& a: apps) {
list.append(QVariant::fromValue<NotifyingApplication>(a));
}
config()->setList(QStringLiteral("applications"), list);

View file

@ -74,7 +74,8 @@ void SystemvolumePlugin::sendSinkList() {
sinksMap.clear();
for (PulseAudioQt::Sink* sink : PulseAudioQt::Context::instance()->sinks()) {
const auto sinks = PulseAudioQt::Context::instance()->sinks();
for (PulseAudioQt::Sink* sink : sinks) {
sinksMap.insert(sink->name(), sink);
connect(sink, &PulseAudioQt::Sink::volumeChanged, this, [this, sink] {
@ -118,7 +119,8 @@ void SystemvolumePlugin::connected()
sendSinkList();
});
for (PulseAudioQt::Sink* sink : PulseAudioQt::Context::instance()->sinks()) {
const auto sinks = PulseAudioQt::Context::instance()->sinks();
for (PulseAudioQt::Sink* sink : sinks) {
sinksMap.insert(sink->name(), sink);
}
}

View file

@ -67,7 +67,7 @@ void TestSocketLineReader::socketLineReader()
{
QList<QByteArray> dataToSend;
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
for (const QByteArray& line : dataToSend) {
for (const QByteArray& line : qAsConst(dataToSend)) {
m_conn->write(line);
}
m_conn->flush();

View file

@ -138,7 +138,7 @@ void TestSslSocketLineReader::testTrustedDevice()
QList<QByteArray> dataToSend;
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
for (const QByteArray& line : dataToSend) {
for (const QByteArray& line : qAsConst(dataToSend)) {
m_clientSocket->write(line);
}
m_clientSocket->flush();
@ -197,7 +197,7 @@ void TestSslSocketLineReader::testUntrustedDevice()
QList<QByteArray> dataToSend;
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
for (const QByteArray& line : dataToSend) {
for (const QByteArray& line : qAsConst(dataToSend)) {
m_clientSocket->write(line);
}
m_clientSocket->flush();