From 5eff546aea4f15f7c60af40b452661d058bcabf7 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 4 Sep 2020 22:46:22 +0200 Subject: Fixes of clazy warnings --- lib/room.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/room.cpp') diff --git a/lib/room.cpp b/lib/room.cpp index 7f76d8df..eff3d144 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -296,8 +296,8 @@ public: void dropDuplicateEvents(RoomEvents& events) const; Changes setLastReadEvent(User* u, QString eventId); - void updateUnreadCount(rev_iter_t from, rev_iter_t to); - Changes promoteReadMarker(User* u, rev_iter_t newMarker, bool force = false); + void updateUnreadCount(const rev_iter_t& from, const rev_iter_t& to); + Changes promoteReadMarker(User* u, const rev_iter_t& newMarker, bool force = false); Changes markMessagesAsRead(rev_iter_t upToMarker); @@ -553,7 +553,7 @@ QStringList Room::localAliases() const QStringList Room::remoteAliases() const { QStringList result; - for (const auto& s : d->aliasServers) + for (const auto& s : std::as_const(d->aliasServers)) result += d->getCurrentState(s)->aliases(); return result; } @@ -640,7 +640,8 @@ Room::Changes Room::Private::setLastReadEvent(User* u, QString eventId) return Change::NoChange; } -void Room::Private::updateUnreadCount(rev_iter_t from, rev_iter_t to) +void Room::Private::updateUnreadCount(const rev_iter_t& from, + const rev_iter_t& to) { Q_ASSERT(from >= timeline.crbegin() && from <= timeline.crend()); Q_ASSERT(to >= from && to <= timeline.crend()); @@ -682,7 +683,8 @@ void Room::Private::updateUnreadCount(rev_iter_t from, rev_iter_t to) } } -Room::Changes Room::Private::promoteReadMarker(User* u, rev_iter_t newMarker, +Room::Changes Room::Private::promoteReadMarker(User* u, + const rev_iter_t& newMarker, bool force) { Q_ASSERT_X(u, __FUNCTION__, "User* should not be nullptr"); @@ -1242,6 +1244,7 @@ QList Room::users() const { return d->membersMap.values(); } QStringList Room::memberNames() const { QStringList res; + res.reserve(d->membersMap.size()); for (auto u : qAsConst(d->membersMap)) res.append(roomMembername(u)); @@ -1686,7 +1689,7 @@ QString Room::postFile(const QString& plainText, const QUrl& localPath, uploadFile(txnId, localPath); // Below, the upload job is used as a context object to clean up connections connect(this, &Room::fileTransferCompleted, d->fileTransfers[txnId].job, - [this, txnId](const QString& id, QUrl, const QUrl& mxcUri) { + [this, txnId](const QString& id, const QUrl&, const QUrl& mxcUri) { if (id == txnId) { auto it = findPendingEvent(txnId); if (it != d->unsyncedEvents.end()) { -- cgit v1.2.3