From 12a96aae6d7efa7c567616de8eb3e4f6d879b066 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Wed, 28 Feb 2018 12:12:07 +0200 Subject: Add some missing references --- include/ChatPage.h | 4 ++-- src/AvatarProvider.cc | 2 +- src/Cache.cc | 6 +++--- src/ChatPage.cc | 4 ++-- src/MatrixClient.cc | 1 - src/dialogs/ReadReceipts.cc | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/include/ChatPage.h b/include/ChatPage.h index 5d7d2806..5a6376c9 100644 --- a/include/ChatPage.h +++ b/include/ChatPage.h @@ -206,7 +206,7 @@ ChatPage::updateUserMetadata(const std::vector &collection) { using Member = mtx::events::StateEvent; - for (auto &event : collection) { + for (const auto &event : collection) { if (mpark::holds_alternative(event)) { auto member = mpark::get(event); @@ -224,7 +224,7 @@ ChatPage::getMemberships(const std::vector &collection) const using Member = mtx::events::StateEvent; - for (auto &event : collection) { + for (const auto &event : collection) { if (mpark::holds_alternative(event)) { auto member = mpark::get(event); memberships.emplace(member.state_key, member); diff --git a/src/AvatarProvider.cc b/src/AvatarProvider.cc index 21253ba7..1c509d0a 100644 --- a/src/AvatarProvider.cc +++ b/src/AvatarProvider.cc @@ -36,7 +36,7 @@ AvatarProvider::updateAvatar(const QString &uid, const QImage &img) auto callbacks = toBeResolved_[uid]; // Update all the timeline items with the resolved avatar. - for (const auto callback : callbacks) + for (const auto &callback : callbacks) callback(img); toBeResolved_.erase(uid); diff --git a/src/Cache.cc b/src/Cache.cc index d889f731..8a58b634 100644 --- a/src/Cache.cc +++ b/src/Cache.cc @@ -482,7 +482,7 @@ Cache::readReceipts(const QString &event_id, const QString &room_id) auto json_response = json::parse(std::string(value.data(), value.size())); auto values = json_response.get>(); - for (auto v : values) + for (const auto &v : values) // timestamp, user_id receipts.emplace(v.second, v.first); } @@ -497,7 +497,7 @@ Cache::readReceipts(const QString &event_id, const QString &room_id) void Cache::updateReadReceipt(const std::string &room_id, const Receipts &receipts) { - for (auto receipt : receipts) { + for (const auto &receipt : receipts) { const auto event_id = receipt.first; auto event_receipts = receipt.second; @@ -528,7 +528,7 @@ Cache::updateReadReceipt(const std::string &room_id, const Receipts &receipts) } // Append the new ones. - for (auto event_receipt : event_receipts) + for (const auto &event_receipt : event_receipts) saved_receipts.emplace(event_receipt.first, event_receipt.second); // Save back the merged (or only the new) receipts. diff --git a/src/ChatPage.cc b/src/ChatPage.cc index a3ae7428..2ef4cf47 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -531,7 +531,7 @@ ChatPage::initialSyncCompleted(const mtx::responses::Sync &response) roomSettings_.emplace(room_id, QSharedPointer(new RoomSettings(room_id))); - for (const auto membership : roomState->memberships) { + for (const auto &membership : roomState->memberships) { updateUserDisplayName(membership.second); updateUserAvatarUrl(membership.second); } @@ -791,7 +791,7 @@ ChatPage::updateTypingUsers(const QString &roomid, const std::vectorclear(); - for (auto receipt : receipts) { + for (const auto &receipt : receipts) { auto user = new ReceiptItem(this, QString::fromStdString(receipt.second), receipt.first); auto item = new QListWidgetItem(userList_); -- cgit 1.4.1