aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-09-04 22:46:22 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-09-04 22:46:22 +0200
commit5eff546aea4f15f7c60af40b452661d058bcabf7 (patch)
tree0260bf3797322609020c8a4af13cc949112e9f60 /lib/room.cpp
parent65c60c786dd18553a804e01ac60e5a167cb0a400 (diff)
downloadlibquotient-5eff546aea4f15f7c60af40b452661d058bcabf7.tar.gz
libquotient-5eff546aea4f15f7c60af40b452661d058bcabf7.zip
Fixes of clazy warnings
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp15
1 files changed, 9 insertions, 6 deletions
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<RoomAliasesEvent>(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<User*> 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()) {