mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Appended references to const auto types in loop to prevent copying.
Suggested by Apple Clang.
This commit is contained in:
parent
baea762832
commit
900a7d0b2b
67 changed files with 153 additions and 153 deletions
|
@ -28,7 +28,7 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
|
|||
const auto collectInputUsers = [](const auto &peers) {
|
||||
auto result = QVector<MTPInputUser>();
|
||||
result.reserve(peers.size());
|
||||
for (const auto peer : peers) {
|
||||
for (const auto &peer : peers) {
|
||||
if (const auto user = peer->asUser()) {
|
||||
result.push_back(user->inputUser);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
|
|||
const auto collectInputChats = [](const auto &peers) {
|
||||
auto result = QVector<MTPlong>();
|
||||
result.reserve(peers.size());
|
||||
for (const auto peer : peers) {
|
||||
for (const auto &peer : peers) {
|
||||
if (!peer->isUser()) {
|
||||
result.push_back(peerToBareMTPInt(peer->id));
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ UserPrivacy::Rule TLToRules(const TLRules &rules, Data::Session &owner) {
|
|||
}, [&](const MTPDprivacyValueAllowUsers &data) {
|
||||
const auto &users = data.vusers().v;
|
||||
always.reserve(always.size() + users.size());
|
||||
for (const auto userId : users) {
|
||||
for (const auto &userId : users) {
|
||||
const auto user = owner.user(UserId(userId.v));
|
||||
if (!base::contains(never, user)
|
||||
&& !base::contains(always, user)) {
|
||||
|
@ -140,7 +140,7 @@ UserPrivacy::Rule TLToRules(const TLRules &rules, Data::Session &owner) {
|
|||
}, [&](const MTPDprivacyValueDisallowUsers &data) {
|
||||
const auto &users = data.vusers().v;
|
||||
never.reserve(never.size() + users.size());
|
||||
for (const auto userId : users) {
|
||||
for (const auto &userId : users) {
|
||||
const auto user = owner.user(UserId(userId.v));
|
||||
if (!base::contains(always, user)
|
||||
&& !base::contains(never, user)) {
|
||||
|
|
|
@ -1295,7 +1295,7 @@ void ApiWrap::markMediaRead(
|
|||
not_null<ChannelData*>,
|
||||
QVector<MTPint>>();
|
||||
markedIds.reserve(items.size());
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
if ((!item->isUnreadMedia() || item->out())
|
||||
&& !item->isUnreadMention()) {
|
||||
continue;
|
||||
|
@ -2400,7 +2400,7 @@ void ApiWrap::applyAffectedMessages(
|
|||
void ApiWrap::saveCurrentDraftToCloud() {
|
||||
Core::App().saveCurrentDraftsToHistories();
|
||||
|
||||
for (const auto controller : _session->windows()) {
|
||||
for (const auto &controller : _session->windows()) {
|
||||
if (const auto history = controller->activeChatCurrent().history()) {
|
||||
_session->local().writeDrafts(history);
|
||||
|
||||
|
@ -3415,7 +3415,7 @@ void ApiWrap::addChatParticipants(
|
|||
const std::vector<not_null<UserData*>> &users,
|
||||
Fn<void(bool)> done) {
|
||||
if (const auto chat = peer->asChat()) {
|
||||
for (const auto user : users) {
|
||||
for (const auto &user : users) {
|
||||
request(MTPmessages_AddChatUser(
|
||||
chat->inputChat,
|
||||
user->inputUser,
|
||||
|
@ -3450,7 +3450,7 @@ void ApiWrap::addChatParticipants(
|
|||
if (callback) callback(false);
|
||||
}).afterDelay(crl::time(5)).send();
|
||||
};
|
||||
for (const auto user : users) {
|
||||
for (const auto &user : users) {
|
||||
list.push_back(user->inputUser);
|
||||
if (list.size() == kMaxUsersPerInvite) {
|
||||
send();
|
||||
|
|
|
@ -719,7 +719,7 @@ void DeleteMessagesBox::prepare() {
|
|||
}
|
||||
|
||||
bool DeleteMessagesBox::hasScheduledMessages() const {
|
||||
for (const auto fullId : std::as_const(_ids)) {
|
||||
for (const auto &fullId : _ids) {
|
||||
if (const auto item = _session->data().message(fullId)) {
|
||||
if (item->isScheduled()) {
|
||||
return true;
|
||||
|
@ -731,7 +731,7 @@ bool DeleteMessagesBox::hasScheduledMessages() const {
|
|||
|
||||
PeerData *DeleteMessagesBox::checkFromSinglePeer() const {
|
||||
auto result = (PeerData*)nullptr;
|
||||
for (const auto fullId : std::as_const(_ids)) {
|
||||
for (const auto &fullId : _ids) {
|
||||
if (const auto item = _session->data().message(fullId)) {
|
||||
const auto peer = item->history()->peer;
|
||||
if (!result) {
|
||||
|
@ -881,7 +881,7 @@ void DeleteMessagesBox::deleteAndClear() {
|
|||
if (justClear) {
|
||||
peer->session().api().clearHistory(peer, revoke);
|
||||
} else {
|
||||
for (const auto controller : peer->session().windows()) {
|
||||
for (const auto &controller : peer->session().windows()) {
|
||||
if (controller->activeChatCurrent().peer() == peer) {
|
||||
Ui::showChatsList(&peer->session());
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ void SentCodeField::fix() {
|
|||
auto newPos = -1;
|
||||
auto oldLen = now.size();
|
||||
auto digitCount = 0;
|
||||
for (const auto ch : now) {
|
||||
for (const auto &ch : now) {
|
||||
if (ch.isDigit()) {
|
||||
++digitCount;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ void SentCodeField::fix() {
|
|||
|
||||
newText.reserve(oldLen);
|
||||
int i = 0;
|
||||
for (const auto ch : now) {
|
||||
for (const auto &ch : now) {
|
||||
if (i++ == oldPos) {
|
||||
newPos = newText.length();
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ void FilterChatsPreview::updateData(
|
|||
makeButton([=] { removeFlag(flag); }) });
|
||||
}
|
||||
}
|
||||
for (const auto history : peers) {
|
||||
for (const auto &history : peers) {
|
||||
_removePeer.push_back(PeerButton{
|
||||
.history = history,
|
||||
.button = makeButton([=] { removePeer(history); })
|
||||
|
|
|
@ -342,7 +342,7 @@ void EditFilterChatsListController::prepareViewHook() {
|
|||
const auto count = int(_peers.size());
|
||||
const auto rows = std::make_unique<std::optional<ExceptionRow>[]>(count);
|
||||
auto i = 0;
|
||||
for (const auto history : _peers) {
|
||||
for (const auto &history : _peers) {
|
||||
rows[i++].emplace(history);
|
||||
}
|
||||
auto pointers = std::vector<ExceptionRow*>();
|
||||
|
|
|
@ -186,7 +186,7 @@ void PeerListBox::paintEvent(QPaintEvent *e) {
|
|||
const auto &bg = (_controller->listSt()
|
||||
? *_controller->listSt()
|
||||
: st::peerListBox).bg;
|
||||
for (const auto rect : e->region()) {
|
||||
for (const auto &rect : e->region()) {
|
||||
p.fillRect(rect, bg);
|
||||
}
|
||||
}
|
||||
|
@ -1693,7 +1693,7 @@ void PeerListContent::searchQueryChanged(QString query) {
|
|||
};
|
||||
|
||||
_filterResults.reserve(minimalList->size());
|
||||
for (const auto row : *minimalList) {
|
||||
for (const auto &row : *minimalList) {
|
||||
if (!row->special() && allSearchWordsInNames(row->peer())) {
|
||||
_filterResults.push_back(row);
|
||||
}
|
||||
|
@ -1999,4 +1999,4 @@ void PeerListContentDelegate::peerListShowRowMenu(
|
|||
bool highlightRow,
|
||||
Fn<void(not_null<Ui::PopupMenu *>)> destroyed) {
|
||||
_content->showRowMenu(row, highlightRow, std::move(destroyed));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ void ChatsListBoxController::rebuildRows() {
|
|||
auto wasEmpty = !delegate()->peerListFullRowsCount();
|
||||
auto appendList = [this](auto chats) {
|
||||
auto count = 0;
|
||||
for (const auto row : chats->all()) {
|
||||
for (const auto &row : chats->all()) {
|
||||
if (const auto history = row->history()) {
|
||||
if (appendRow(history)) {
|
||||
++count;
|
||||
|
@ -389,7 +389,7 @@ void ContactsBoxController::prepare() {
|
|||
void ContactsBoxController::rebuildRows() {
|
||||
const auto appendList = [&](auto chats) {
|
||||
auto count = 0;
|
||||
for (const auto row : chats->all()) {
|
||||
for (const auto &row : chats->all()) {
|
||||
if (const auto history = row->history()) {
|
||||
if (const auto user = history->peer->asUser()) {
|
||||
if (appendRow(user)) {
|
||||
|
|
|
@ -283,7 +283,7 @@ void PeerListsBox::paintEvent(QPaintEvent *e) {
|
|||
const auto &bg = (firstController()->listSt()
|
||||
? *firstController()->listSt()
|
||||
: st::peerListBox).bg;
|
||||
for (const auto rect : e->region()) {
|
||||
for (const auto &rect : e->region()) {
|
||||
p.fillRect(rect, bg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -429,7 +429,7 @@ void AddSpecialBoxController::rebuildChatRows(not_null<ChatData*> chat) {
|
|||
--count;
|
||||
}
|
||||
}
|
||||
for (const auto user : participants) {
|
||||
for (const auto &user : participants) {
|
||||
if (auto row = createRow(user)) {
|
||||
delegate()->peerListAppendRow(std::move(row));
|
||||
}
|
||||
|
@ -1155,7 +1155,7 @@ void AddSpecialBoxSearchController::addChatMembers(
|
|||
return true;
|
||||
};
|
||||
|
||||
for (const auto user : chat->participants) {
|
||||
for (const auto &user : chat->participants) {
|
||||
if (allWordsAreFound(user->nameWords())) {
|
||||
delegate()->peerListSearchAddRow(user);
|
||||
}
|
||||
|
@ -1210,7 +1210,7 @@ void AddSpecialBoxSearchController::addChatsContacts() {
|
|||
if (!index) {
|
||||
return;
|
||||
}
|
||||
for (const auto row : *index) {
|
||||
for (const auto &row : *index) {
|
||||
if (const auto history = row->history()) {
|
||||
if (const auto user = history->peer->asUser()) {
|
||||
if (allWordsAreFound(user->nameWords())) {
|
||||
|
|
|
@ -702,7 +702,7 @@ void ParticipantsAdditionalData::migrate(
|
|||
_peer = channel;
|
||||
fillFromChannel(channel);
|
||||
|
||||
for (const auto user : _admins) {
|
||||
for (const auto &user : _admins) {
|
||||
_adminRights.emplace(user, chat->defaultAdminRights(user));
|
||||
if (channel->amCreator()) {
|
||||
_adminCanEdit.emplace(user);
|
||||
|
@ -1197,7 +1197,7 @@ void ParticipantsBoxController::rebuildChatParticipants(
|
|||
--count;
|
||||
}
|
||||
}
|
||||
for (const auto user : participants) {
|
||||
for (const auto &user : participants) {
|
||||
if (auto row = createRow(user)) {
|
||||
delegate()->peerListAppendRow(std::move(row));
|
||||
}
|
||||
|
|
|
@ -560,7 +560,7 @@ ShareBox::Inner::Inner(QWidget *parent, const Descriptor &descriptor)
|
|||
_chatsIndexed->addToEnd(self->owner().history(self));
|
||||
}
|
||||
const auto addList = [&](not_null<Dialogs::IndexedList*> list) {
|
||||
for (const auto row : list->all()) {
|
||||
for (const auto &row : list->all()) {
|
||||
if (const auto history = row->history()) {
|
||||
if (!history->peer->isSelf()
|
||||
&& _descriptor.filterCallback(history->peer)) {
|
||||
|
@ -703,7 +703,7 @@ void ShareBox::Inner::repaintChat(not_null<PeerData*> peer) {
|
|||
int ShareBox::Inner::chatIndex(not_null<PeerData*> peer) const {
|
||||
int index = 0;
|
||||
if (_filter.isEmpty()) {
|
||||
for (const auto row : _chatsIndexed->all()) {
|
||||
for (const auto &row : _chatsIndexed->all()) {
|
||||
if (const auto history = row->history()) {
|
||||
if (history->peer == peer) {
|
||||
return index;
|
||||
|
@ -712,7 +712,7 @@ int ShareBox::Inner::chatIndex(not_null<PeerData*> peer) const {
|
|||
++index;
|
||||
}
|
||||
} else {
|
||||
for (const auto row : _filtered) {
|
||||
for (const auto &row : _filtered) {
|
||||
if (const auto history = row->history()) {
|
||||
if (history->peer == peer) {
|
||||
return index;
|
||||
|
|
|
@ -773,7 +773,7 @@ void Panel::paint(QRect clip) {
|
|||
if (!_incoming->widget()->isHidden()) {
|
||||
region = region.subtracted(QRegion(_incoming->widget()->geometry()));
|
||||
}
|
||||
for (const auto rect : region) {
|
||||
for (const auto &rect : region) {
|
||||
p.fillRect(rect, st::callBgOpaque);
|
||||
}
|
||||
if (_incoming && _incoming->widget()->isHidden()) {
|
||||
|
|
|
@ -3157,7 +3157,7 @@ std::variant<int, not_null<UserData*>> GroupCall::inviteUsers(
|
|||
}).send();
|
||||
slice.clear();
|
||||
};
|
||||
for (const auto user : users) {
|
||||
for (const auto &user : users) {
|
||||
if (!count && slice.empty()) {
|
||||
result = user;
|
||||
}
|
||||
|
|
|
@ -481,7 +481,7 @@ void Members::Controller::toggleVideoEndpointActive(
|
|||
|
||||
void Members::Controller::appendInvitedUsers() {
|
||||
if (const auto id = _call->id()) {
|
||||
for (const auto user : _peer->owner().invitedToCallUsers(id)) {
|
||||
for (const auto &user : _peer->owner().invitedToCallUsers(id)) {
|
||||
if (auto row = createInvitedRow(user)) {
|
||||
delegate()->peerListAppendRow(std::move(row));
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ void Members::Controller::showRowMenu(
|
|||
return;
|
||||
}
|
||||
auto saved = base::take(_menu);
|
||||
for (const auto peer : base::take(_menuCheckRowsAfterHidden)) {
|
||||
for (const auto &peer : base::take(_menuCheckRowsAfterHidden)) {
|
||||
if (const auto row = findRow(peer)) {
|
||||
checkRowPosition(row);
|
||||
}
|
||||
|
|
|
@ -2179,7 +2179,7 @@ void Panel::paint(QRect clip) {
|
|||
Painter p(widget());
|
||||
|
||||
auto region = QRegion(clip);
|
||||
for (const auto rect : region) {
|
||||
for (const auto &rect : region) {
|
||||
p.fillRect(rect, st::groupCallBg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ void Viewport::RendererSW::paintFallback(
|
|||
}
|
||||
paintTile(p, tile.get(), bounding, bg);
|
||||
}
|
||||
for (const auto rect : bg) {
|
||||
for (const auto &rect : bg) {
|
||||
p.fillRect(rect, st::groupCallBg);
|
||||
}
|
||||
for (auto i = _tileData.begin(); i != _tileData.end();) {
|
||||
|
|
|
@ -247,7 +247,7 @@ void Row::paintPreview(Painter &p) const {
|
|||
const auto width = st::manageEmojiPreviewWidth;
|
||||
const auto height = st::manageEmojiPreviewWidth;
|
||||
auto &&preview = ranges::views::zip(_preview, ranges::views::ints(0, int(_preview.size())));
|
||||
for (const auto &[pixmap, index] : preview) {
|
||||
for (const auto [pixmap, index] : preview) {
|
||||
const auto row = (index / 2);
|
||||
const auto column = (index % 2);
|
||||
const auto left = x + (column ? width - st::manageEmojiPreview : 0);
|
||||
|
|
|
@ -411,7 +411,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
if (_chat->noParticipantInfo()) {
|
||||
_chat->session().api().requestFullPeer(_chat);
|
||||
} else if (!_chat->participants.empty()) {
|
||||
for (const auto user : _chat->participants) {
|
||||
for (const auto &user : _chat->participants) {
|
||||
if (user->isInaccessible()) continue;
|
||||
if (!listAllSuggestions && filterNotPassedByName(user)) continue;
|
||||
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
|
||||
|
@ -469,7 +469,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
_chat->session().api().requestFullPeer(_chat);
|
||||
} else if (!_chat->participants.empty()) {
|
||||
const auto &commands = _chat->botCommands();
|
||||
for (const auto user : _chat->participants) {
|
||||
for (const auto &user : _chat->participants) {
|
||||
if (!user->isBot()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
}
|
||||
} else {
|
||||
const auto &commands = _channel->mgInfo->botCommands();
|
||||
for (const auto user : _channel->mgInfo->bots) {
|
||||
for (const auto &user : _channel->mgInfo->bots) {
|
||||
if (!user->isBot()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ void InitSpellchecker(
|
|||
|
||||
bool HasSendText(not_null<const Ui::InputField*> field) {
|
||||
const auto &text = field->getTextWithTags().text;
|
||||
for (const auto ch : text) {
|
||||
for (const auto &ch : text) {
|
||||
const auto code = ch.unicode();
|
||||
if (code != ' '
|
||||
&& code != '\n'
|
||||
|
|
|
@ -86,7 +86,7 @@ void DicePack::applySet(const MTPDmessages_stickerSet &data) {
|
|||
if (index < 0 || index > 6) {
|
||||
return;
|
||||
}
|
||||
for (const auto id : data.vdocuments().v) {
|
||||
for (const auto &id : data.vdocuments().v) {
|
||||
if (const auto document = documents.take(id.v)) {
|
||||
_map.emplace(index, *document);
|
||||
}
|
||||
|
|
|
@ -1032,7 +1032,7 @@ void Application::registerLeaveSubscription(not_null<QWidget*> widget) {
|
|||
const auto check = [=](not_null<QEvent*> e) {
|
||||
if (e->type() == QEvent::Leave) {
|
||||
if (const auto taken = _leaveFilters.take(window)) {
|
||||
for (const auto weak : taken->registered) {
|
||||
for (const auto &weak : taken->registered) {
|
||||
if (const auto widget = weak.data()) {
|
||||
QEvent ev(QEvent::Leave);
|
||||
QCoreApplication::sendEvent(widget, &ev);
|
||||
|
|
|
@ -192,7 +192,7 @@ void Changelogs::addLocalLog(const QString &text) {
|
|||
};
|
||||
|
||||
void Changelogs::addBetaLogs() {
|
||||
for (const auto [version, changes] : BetaLogs()) {
|
||||
for (const auto &[version, changes] : BetaLogs()) {
|
||||
addBetaLog(version, changes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ QByteArray Settings::serialize() const {
|
|||
auto recentEmojiPreloadGenerated = std::vector<RecentEmojiId>();
|
||||
if (_recentEmojiPreload.empty()) {
|
||||
recentEmojiPreloadGenerated.reserve(_recentEmoji.size());
|
||||
for (const auto [emoji, rating] : _recentEmoji) {
|
||||
for (const auto &[emoji, rating] : _recentEmoji) {
|
||||
recentEmojiPreloadGenerated.push_back({ emoji->id(), rating });
|
||||
}
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ EmojiPack Settings::recentEmojiSection() const {
|
|||
|
||||
auto result = EmojiPack();
|
||||
result.reserve(recent.size());
|
||||
for (const auto [emoji, rating] : recent) {
|
||||
for (const auto &[emoji, rating] : recent) {
|
||||
result.push_back(emoji);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -78,7 +78,7 @@ rpl::producer<UpdateType> Changes::Manager<DataType, UpdateType>::flagsValue(
|
|||
|
||||
template <typename DataType, typename UpdateType>
|
||||
void Changes::Manager<DataType, UpdateType>::sendNotifications() {
|
||||
for (const auto [data, flags] : base::take(_updates)) {
|
||||
for (const auto &[data, flags] : base::take(_updates)) {
|
||||
_stream.fire({ data, flags });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -664,7 +664,7 @@ QString ChannelData::invitePeekHash() const {
|
|||
void ChannelData::privateErrorReceived() {
|
||||
if (const auto expires = invitePeekExpires()) {
|
||||
const auto hash = invitePeekHash();
|
||||
for (const auto window : session().windows()) {
|
||||
for (const auto &window : session().windows()) {
|
||||
clearInvitePeek();
|
||||
Api::CheckChatInvite(window, hash, this);
|
||||
return;
|
||||
|
|
|
@ -122,18 +122,18 @@ MTPDialogFilter ChatFilter::tl(FilterId replaceId) const {
|
|||
auto always = _always;
|
||||
auto pinned = QVector<MTPInputPeer>();
|
||||
pinned.reserve(_pinned.size());
|
||||
for (const auto history : _pinned) {
|
||||
for (const auto &history : _pinned) {
|
||||
pinned.push_back(history->peer->input);
|
||||
always.remove(history);
|
||||
}
|
||||
auto include = QVector<MTPInputPeer>();
|
||||
include.reserve(always.size());
|
||||
for (const auto history : always) {
|
||||
for (const auto &history : always) {
|
||||
include.push_back(history->peer->input);
|
||||
}
|
||||
auto never = QVector<MTPInputPeer>();
|
||||
never.reserve(_never.size());
|
||||
for (const auto history : _never) {
|
||||
for (const auto &history : _never) {
|
||||
never.push_back(history->peer->input);
|
||||
}
|
||||
return MTP_dialogFilter(
|
||||
|
@ -417,7 +417,7 @@ bool ChatFilters::applyOrder(const QVector<MTPint> &order) {
|
|||
&ChatFilter::id
|
||||
) | ranges::to_vector;
|
||||
auto b = indices.begin(), e = indices.end();
|
||||
for (const auto id : order) {
|
||||
for (const auto &id : order) {
|
||||
const auto i = ranges::find(b, e, id.v);
|
||||
if (i == e) {
|
||||
return false;
|
||||
|
@ -428,7 +428,7 @@ bool ChatFilters::applyOrder(const QVector<MTPint> &order) {
|
|||
}
|
||||
auto changed = false;
|
||||
auto begin = _list.begin(), end = _list.end();
|
||||
for (const auto id : order) {
|
||||
for (const auto &id : order) {
|
||||
const auto i = ranges::find(begin, end, id.v, &ChatFilter::id);
|
||||
Assert(i != end);
|
||||
if (i != begin) {
|
||||
|
@ -526,7 +526,7 @@ bool ChatFilters::loadNextExceptions(bool chatsListLoaded) {
|
|||
const auto i = ranges::find(_list, id, &ChatFilter::id);
|
||||
if (i != end(_list)) {
|
||||
result.reserve(i->always().size());
|
||||
for (const auto history : i->always()) {
|
||||
for (const auto &history : i->always()) {
|
||||
if (!history->folderKnown()) {
|
||||
inputs.push_back(
|
||||
MTP_inputDialogPeer(history->peer->input));
|
||||
|
|
|
@ -49,7 +49,7 @@ CloudTheme CloudTheme::Parse(
|
|||
if (const auto settings = data.vsettings()) {
|
||||
settings->match([&](const MTPDthemeSettings &data) {
|
||||
if (const auto colors = data.vmessage_colors()) {
|
||||
for (const auto color : colors->v) {
|
||||
for (const auto &color : colors->v) {
|
||||
result.push_back(ColorFromSerialized(color));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -388,7 +388,7 @@ void DocumentData::setattributes(
|
|||
0x2066, // LTR Isolate
|
||||
0x2067, // RTL Isolate
|
||||
};
|
||||
for (const auto ch : controls) {
|
||||
for (const auto &ch : controls) {
|
||||
_filename = std::move(_filename).replace(ch, "_");
|
||||
}
|
||||
}, [&](const MTPDdocumentAttributeHasStickers &data) {
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
using HistoryDrafts = base::flat_map<DraftKey, std::unique_ptr<Draft>>;
|
||||
|
||||
inline bool draftStringIsEmpty(const QString &text) {
|
||||
for (const auto ch : text) {
|
||||
for (const auto &ch : text) {
|
||||
if (!ch.isSpace()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ const Group *Groups::find(not_null<const HistoryItem*> item) const {
|
|||
}
|
||||
|
||||
void Groups::refreshViews(const HistoryItemsList &items) {
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
_data->requestItemViewRefresh(item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ void Histories::sendDialogRequests() {
|
|||
}
|
||||
|
||||
const auto finalize = [=] {
|
||||
for (const auto history : histories) {
|
||||
for (const auto &history : histories) {
|
||||
const auto state = lookup(history);
|
||||
if (!state || !state->postponedRequestEntry) {
|
||||
dialogEntryApplied(history);
|
||||
|
@ -667,7 +667,7 @@ void Histories::deleteMessages(const MessageIdsList &ids, bool revoke) {
|
|||
remove.reserve(ids.size());
|
||||
base::flat_map<not_null<History*>, QVector<MTPint>> idsByPeer;
|
||||
base::flat_map<not_null<PeerData*>, QVector<MTPint>> scheduledIdsByPeer;
|
||||
for (const auto itemId : ids) {
|
||||
for (const auto &itemId : ids) {
|
||||
if (const auto item = _owner->message(itemId)) {
|
||||
const auto history = item->history();
|
||||
if (item->isScheduled()) {
|
||||
|
|
|
@ -124,7 +124,7 @@ void RepliesList::appendLocalMessages(MessagesSlice &slice) {
|
|||
return;
|
||||
}
|
||||
slice.ids.reserve(local.size());
|
||||
for (const auto item : local) {
|
||||
for (const auto &item : local) {
|
||||
if (item->replyToTop() != _rootId) {
|
||||
continue;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ void RepliesList::appendLocalMessages(MessagesSlice &slice) {
|
|||
|
||||
dates.push_back(message->date());
|
||||
}
|
||||
for (const auto item : local) {
|
||||
for (const auto &item : local) {
|
||||
if (item->replyToTop() != _rootId) {
|
||||
continue;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ void RepliesList::injectRootMessage(not_null<Viewer*> viewer) {
|
|||
injectRootDivider(root, slice);
|
||||
|
||||
if (const auto group = _history->owner().groups().find(root)) {
|
||||
for (const auto item : ranges::views::reverse(group->items)) {
|
||||
for (const auto &item : ranges::views::reverse(group->items)) {
|
||||
slice->ids.push_back(item->fullId());
|
||||
}
|
||||
viewer->injectedForRoot = group->items.size();
|
||||
|
|
|
@ -495,7 +495,7 @@ void ScheduledMessages::updated(
|
|||
const base::flat_set<not_null<HistoryItem*>> &added,
|
||||
const base::flat_set<not_null<HistoryItem*>> &clear) {
|
||||
if (!clear.empty()) {
|
||||
for (const auto item : clear) {
|
||||
for (const auto &item : clear) {
|
||||
item->destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1162,7 +1162,7 @@ void Session::setupUserIsContactViewer() {
|
|||
}) | rpl::start_with_next([=](not_null<UserData*> user) {
|
||||
const auto i = _contactViews.find(peerToUser(user->id));
|
||||
if (i != _contactViews.end()) {
|
||||
for (const auto view : i->second) {
|
||||
for (const auto &view : i->second) {
|
||||
requestViewResize(view);
|
||||
}
|
||||
}
|
||||
|
@ -1211,7 +1211,7 @@ void Session::documentLoadSettingsChanged() {
|
|||
|
||||
void Session::notifyPhotoLayoutChanged(not_null<const PhotoData*> photo) {
|
||||
if (const auto i = _photoItems.find(photo); i != end(_photoItems)) {
|
||||
for (const auto item : i->second) {
|
||||
for (const auto &item : i->second) {
|
||||
notifyItemLayoutChange(item);
|
||||
}
|
||||
}
|
||||
|
@ -1220,7 +1220,7 @@ void Session::notifyPhotoLayoutChanged(not_null<const PhotoData*> photo) {
|
|||
void Session::requestPhotoViewRepaint(not_null<const PhotoData*> photo) {
|
||||
const auto i = _photoItems.find(photo);
|
||||
if (i != end(_photoItems)) {
|
||||
for (const auto item : i->second) {
|
||||
for (const auto &item : i->second) {
|
||||
requestItemRepaint(item);
|
||||
}
|
||||
}
|
||||
|
@ -1230,13 +1230,13 @@ void Session::notifyDocumentLayoutChanged(
|
|||
not_null<const DocumentData*> document) {
|
||||
const auto i = _documentItems.find(document);
|
||||
if (i != end(_documentItems)) {
|
||||
for (const auto item : i->second) {
|
||||
for (const auto &item : i->second) {
|
||||
notifyItemLayoutChange(item);
|
||||
}
|
||||
}
|
||||
if (const auto items = InlineBots::Layout::documentItems()) {
|
||||
if (const auto i = items->find(document); i != items->end()) {
|
||||
for (const auto item : i->second) {
|
||||
for (const auto &item : i->second) {
|
||||
item->layoutChanged();
|
||||
}
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ void Session::requestDocumentViewRepaint(
|
|||
not_null<const DocumentData*> document) {
|
||||
const auto i = _documentItems.find(document);
|
||||
if (i != end(_documentItems)) {
|
||||
for (const auto item : i->second) {
|
||||
for (const auto &item : i->second) {
|
||||
requestItemRepaint(item);
|
||||
}
|
||||
}
|
||||
|
@ -1255,7 +1255,7 @@ void Session::requestDocumentViewRepaint(
|
|||
|
||||
void Session::requestPollViewRepaint(not_null<const PollData*> poll) {
|
||||
if (const auto i = _pollViews.find(poll); i != _pollViews.end()) {
|
||||
for (const auto view : i->second) {
|
||||
for (const auto &view : i->second) {
|
||||
requestViewResize(view);
|
||||
}
|
||||
}
|
||||
|
@ -1500,7 +1500,7 @@ rpl::producer<not_null<History*>> Session::historyChanged() const {
|
|||
}
|
||||
|
||||
void Session::sendHistoryChangeNotifications() {
|
||||
for (const auto history : base::take(_historiesChanged)) {
|
||||
for (const auto &history : base::take(_historiesChanged)) {
|
||||
_historyChanged.fire_copy(history);
|
||||
}
|
||||
}
|
||||
|
@ -1531,12 +1531,12 @@ void Session::unloadHeavyViewParts(
|
|||
delegate,
|
||||
[](not_null<ViewElement*> element) { return element->delegate(); });
|
||||
if (remove == _heavyViewParts.size()) {
|
||||
for (const auto view : base::take(_heavyViewParts)) {
|
||||
for (const auto &view : base::take(_heavyViewParts)) {
|
||||
view->unloadHeavyPart();
|
||||
}
|
||||
} else {
|
||||
auto remove = std::vector<not_null<ViewElement*>>();
|
||||
for (const auto view : _heavyViewParts) {
|
||||
for (const auto &view : _heavyViewParts) {
|
||||
if (view->delegate() == delegate) {
|
||||
remove.push_back(view);
|
||||
}
|
||||
|
@ -1555,7 +1555,7 @@ void Session::unloadHeavyViewParts(
|
|||
return;
|
||||
}
|
||||
auto remove = std::vector<not_null<ViewElement*>>();
|
||||
for (const auto view : _heavyViewParts) {
|
||||
for (const auto &view : _heavyViewParts) {
|
||||
if (view->delegate() == delegate
|
||||
&& !delegate->elementIntersectsRange(view, from, till)) {
|
||||
remove.push_back(view);
|
||||
|
@ -1942,7 +1942,7 @@ void Session::processMessagesDeleted(
|
|||
}
|
||||
|
||||
auto historiesToCheck = base::flat_set<not_null<History*>>();
|
||||
for (const auto messageId : data) {
|
||||
for (const auto &messageId : data) {
|
||||
const auto i = list ? list->find(messageId.v) : Messages::iterator();
|
||||
if (list && i != list->end()) {
|
||||
const auto history = i->second->history();
|
||||
|
@ -1954,7 +1954,7 @@ void Session::processMessagesDeleted(
|
|||
affected->unknownMessageDeleted(messageId.v);
|
||||
}
|
||||
}
|
||||
for (const auto history : historiesToCheck) {
|
||||
for (const auto &history : historiesToCheck) {
|
||||
history->requestChatListMessage();
|
||||
}
|
||||
}
|
||||
|
@ -1967,7 +1967,7 @@ void Session::removeDependencyMessage(not_null<HistoryItem*> item) {
|
|||
const auto items = std::move(i->second);
|
||||
_dependentMessages.erase(i);
|
||||
|
||||
for (const auto dependent : items) {
|
||||
for (const auto &dependent : items) {
|
||||
dependent->dependencyItemRemoved(item);
|
||||
}
|
||||
}
|
||||
|
@ -2030,7 +2030,7 @@ HistoryItem *Session::message(FullMsgId itemId) const {
|
|||
void Session::updateDependentMessages(not_null<HistoryItem*> item) {
|
||||
const auto i = _dependentMessages.find(item);
|
||||
if (i != end(_dependentMessages)) {
|
||||
for (const auto dependent : i->second) {
|
||||
for (const auto &dependent : i->second) {
|
||||
dependent->updateDependencyItem();
|
||||
}
|
||||
}
|
||||
|
@ -3169,7 +3169,7 @@ void Session::applyUpdate(const MTPDupdateChatParticipants &update) {
|
|||
});
|
||||
if (const auto chat = chatLoaded(chatId)) {
|
||||
ApplyChatUpdate(chat, update);
|
||||
for (const auto user : chat->participants) {
|
||||
for (const auto &user : chat->participants) {
|
||||
if (user->isBot() && !user->botInfo->inited) {
|
||||
_session->api().requestFullPeer(user);
|
||||
}
|
||||
|
@ -3434,7 +3434,7 @@ void Session::documentMessageRemoved(not_null<DocumentData*> document) {
|
|||
|
||||
void Session::checkPlayingAnimations() {
|
||||
auto check = base::flat_set<not_null<ViewElement*>>();
|
||||
for (const auto view : _heavyViewParts) {
|
||||
for (const auto &view : _heavyViewParts) {
|
||||
if (const auto media = view->media()) {
|
||||
if (const auto document = media->getDocument()) {
|
||||
if (document->isAnimation() || document->isVideoFile()) {
|
||||
|
@ -3447,7 +3447,7 @@ void Session::checkPlayingAnimations() {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (const auto view : check) {
|
||||
for (const auto &view : check) {
|
||||
view->media()->checkAnimation();
|
||||
}
|
||||
}
|
||||
|
@ -3455,7 +3455,7 @@ void Session::checkPlayingAnimations() {
|
|||
HistoryItem *Session::findWebPageItem(not_null<WebPageData*> page) const {
|
||||
const auto i = _webpageItems.find(page);
|
||||
if (i != _webpageItems.end()) {
|
||||
for (const auto item : i->second) {
|
||||
for (const auto &item : i->second) {
|
||||
if (IsServerMsgId(item->id)) {
|
||||
return item;
|
||||
}
|
||||
|
@ -3514,25 +3514,25 @@ void Session::notifyPollUpdateDelayed(not_null<PollData*> poll) {
|
|||
}
|
||||
|
||||
void Session::sendWebPageGamePollNotifications() {
|
||||
for (const auto page : base::take(_webpagesUpdated)) {
|
||||
for (const auto &page : base::take(_webpagesUpdated)) {
|
||||
_webpageUpdates.fire_copy(page);
|
||||
const auto i = _webpageViews.find(page);
|
||||
if (i != _webpageViews.end()) {
|
||||
for (const auto view : i->second) {
|
||||
for (const auto &view : i->second) {
|
||||
requestViewResize(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto game : base::take(_gamesUpdated)) {
|
||||
for (const auto &game : base::take(_gamesUpdated)) {
|
||||
if (const auto i = _gameViews.find(game); i != _gameViews.end()) {
|
||||
for (const auto view : i->second) {
|
||||
for (const auto &view : i->second) {
|
||||
requestViewResize(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto poll : base::take(_pollsUpdated)) {
|
||||
for (const auto &poll : base::take(_pollsUpdated)) {
|
||||
if (const auto i = _pollViews.find(poll); i != _pollViews.end()) {
|
||||
for (const auto view : i->second) {
|
||||
for (const auto &view : i->second) {
|
||||
requestViewResize(view);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ void Stickers::incrementSticker(not_null<DocumentData*> document) {
|
|||
}
|
||||
set->stickers.push_front(document);
|
||||
if (const auto emojiList = getEmojiListFromSet(document)) {
|
||||
for (const auto emoji : *emojiList) {
|
||||
for (const auto &emoji : *emojiList) {
|
||||
set->emoji[emoji].push_front(document);
|
||||
}
|
||||
} else if (!removedFromEmoji.empty()) {
|
||||
|
|
|
@ -26,7 +26,7 @@ RowsByLetter IndexedList::addToEnd(Key key) {
|
|||
}
|
||||
|
||||
auto result = RowsByLetter{ _list.addToEnd(key) };
|
||||
for (const auto ch : key.entry()->chatListFirstLetters()) {
|
||||
for (const auto &ch : key.entry()->chatListFirstLetters()) {
|
||||
auto j = _index.find(ch);
|
||||
if (j == _index.cend()) {
|
||||
j = _index.emplace(ch, _sortMode, _filterId).first;
|
||||
|
@ -42,7 +42,7 @@ Row *IndexedList::addByName(Key key) {
|
|||
}
|
||||
|
||||
const auto result = _list.addByName(key);
|
||||
for (const auto ch : key.entry()->chatListFirstLetters()) {
|
||||
for (const auto &ch : key.entry()->chatListFirstLetters()) {
|
||||
auto j = _index.find(ch);
|
||||
if (j == _index.cend()) {
|
||||
j = _index.emplace(ch, _sortMode, _filterId).first;
|
||||
|
@ -63,7 +63,7 @@ void IndexedList::adjustByDate(const RowsByLetter &links) {
|
|||
|
||||
void IndexedList::moveToTop(Key key) {
|
||||
if (_list.moveToTop(key)) {
|
||||
for (const auto ch : key.entry()->chatListFirstLetters()) {
|
||||
for (const auto &ch : key.entry()->chatListFirstLetters()) {
|
||||
if (auto it = _index.find(ch); it != _index.cend()) {
|
||||
it->second.moveToTop(key);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void IndexedList::adjustByName(
|
|||
|
||||
auto toRemove = oldLetters;
|
||||
auto toAdd = base::flat_set<QChar>();
|
||||
for (const auto ch : key.entry()->chatListFirstLetters()) {
|
||||
for (const auto &ch : key.entry()->chatListFirstLetters()) {
|
||||
auto j = toRemove.find(ch);
|
||||
if (j == toRemove.cend()) {
|
||||
toAdd.insert(ch);
|
||||
|
@ -158,7 +158,7 @@ void IndexedList::adjustNames(
|
|||
|
||||
auto toRemove = oldLetters;
|
||||
auto toAdd = base::flat_set<QChar>();
|
||||
for (const auto ch : key.entry()->chatListFirstLetters()) {
|
||||
for (const auto &ch : key.entry()->chatListFirstLetters()) {
|
||||
auto j = toRemove.find(ch);
|
||||
if (j == toRemove.cend()) {
|
||||
toAdd.insert(ch);
|
||||
|
@ -188,7 +188,7 @@ void IndexedList::adjustNames(
|
|||
|
||||
void IndexedList::del(Key key, Row *replacedBy) {
|
||||
if (_list.del(key, replacedBy)) {
|
||||
for (const auto ch : key.entry()->chatListFirstLetters()) {
|
||||
for (const auto &ch : key.entry()->chatListFirstLetters()) {
|
||||
if (auto it = _index.find(ch); it != _index.cend()) {
|
||||
it->second.del(key, replacedBy);
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ std::vector<not_null<Row*>> IndexedList::filtered(
|
|||
return result;
|
||||
}
|
||||
result.reserve(minimal->size());
|
||||
for (const auto row : *minimal) {
|
||||
for (const auto &row : *minimal) {
|
||||
const auto &nameWords = row->entry()->chatListNameWords();
|
||||
const auto found = [&](const QString &word) {
|
||||
for (const auto &name : nameWords) {
|
||||
|
|
|
@ -61,7 +61,7 @@ constexpr auto kStartReorderThreshold = 30;
|
|||
|
||||
int FixedOnTopDialogsCount(not_null<Dialogs::IndexedList*> list) {
|
||||
auto result = 0;
|
||||
for (const auto row : *list) {
|
||||
for (const auto &row : *list) {
|
||||
if (!row->entry()->fixedOnTopIndex()) {
|
||||
break;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ int PinnedDialogsCount(
|
|||
FilterId filterId,
|
||||
not_null<Dialogs::IndexedList*> list) {
|
||||
auto result = 0;
|
||||
for (const auto row : *list) {
|
||||
for (const auto &row : *list) {
|
||||
if (row->entry()->fixedOnTopIndex()) {
|
||||
continue;
|
||||
} else if (!row->entry()->isPinnedDialog(filterId)) {
|
||||
|
@ -341,7 +341,7 @@ int InnerWidget::dialogsOffset() const {
|
|||
|
||||
int InnerWidget::fixedOnTopCount() const {
|
||||
auto result = 0;
|
||||
for (const auto row : *shownDialogs()) {
|
||||
for (const auto &row : *shownDialogs()) {
|
||||
if (row->entry()->fixedOnTopIndex()) {
|
||||
++result;
|
||||
} else {
|
||||
|
@ -1103,7 +1103,7 @@ int InnerWidget::countPinnedIndex(Row *ofRow) {
|
|||
return -1;
|
||||
}
|
||||
auto result = 0;
|
||||
for (const auto row : *shownDialogs()) {
|
||||
for (const auto &row : *shownDialogs()) {
|
||||
if (row->entry()->fixedOnTopIndex()) {
|
||||
continue;
|
||||
} else if (!row->entry()->isPinnedDialog(_filterId)) {
|
||||
|
|
|
@ -397,7 +397,7 @@ QByteArray PeersMap::wrapUserName(UserId userId) const {
|
|||
|
||||
QByteArray PeersMap::wrapUserNames(const std::vector<UserId> &data) const {
|
||||
auto list = std::vector<QByteArray>();
|
||||
for (const auto userId : data) {
|
||||
for (const auto &userId : data) {
|
||||
list.push_back(wrapUserName(userId));
|
||||
}
|
||||
return SerializeList(list);
|
||||
|
|
|
@ -324,7 +324,7 @@ QByteArray SerializeMessage(
|
|||
const std::vector<UserId> &data,
|
||||
const QByteArray &label = "members") {
|
||||
auto list = std::vector<QByteArray>();
|
||||
for (const auto userId : data) {
|
||||
for (const auto &userId : data) {
|
||||
list.push_back(wrapUserName(userId));
|
||||
}
|
||||
pushBare(label, SerializeArray(context, list));
|
||||
|
|
|
@ -299,7 +299,7 @@ void FilterBox::Inner::createAllUsersCheckbox(const FilterValue &filter) {
|
|||
}
|
||||
|
||||
void FilterBox::Inner::createAdminsCheckboxes(const std::vector<not_null<UserData*>> &admins, const FilterValue &filter) {
|
||||
for (const auto user : admins) {
|
||||
for (const auto &user : admins) {
|
||||
const auto checked = filter.allUsers || base::contains(filter.admins, user);
|
||||
const auto checkbox = addRow(
|
||||
object_ptr<UserCheckbox>(this, user, checked),
|
||||
|
|
|
@ -1236,7 +1236,7 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice) {
|
|||
|
||||
if (const auto added = createItems(slice); !added.empty()) {
|
||||
startBuildingFrontBlock(added.size());
|
||||
for (const auto item : added) {
|
||||
for (const auto &item : added) {
|
||||
addItemToBlock(item);
|
||||
}
|
||||
finishBuildingFrontBlock();
|
||||
|
@ -1269,7 +1269,7 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice) {
|
|||
if (const auto added = createItems(slice); !added.empty()) {
|
||||
Assert(!isBuildingFrontBlock());
|
||||
|
||||
for (const auto item : added) {
|
||||
for (const auto &item : added) {
|
||||
addItemToBlock(item);
|
||||
}
|
||||
|
||||
|
@ -1315,7 +1315,7 @@ void History::addItemsToLists(
|
|||
// lastParticipants are displayed in Profile as members list.
|
||||
markupSenders = &peer->asChannel()->mgInfo->markupSenders;
|
||||
}
|
||||
for (const auto item : ranges::views::reverse(items)) {
|
||||
for (const auto &item : ranges::views::reverse(items)) {
|
||||
item->addToUnreadMentions(UnreadMentionType::Existing);
|
||||
if (item->from()->id) {
|
||||
if (lastAuthors) { // chats
|
||||
|
@ -1389,7 +1389,7 @@ void History::checkAddAllToUnreadMentions() {
|
|||
void History::addToSharedMedia(
|
||||
const std::vector<not_null<HistoryItem*>> &items) {
|
||||
std::vector<MsgId> medias[Storage::kSharedMediaTypeCount];
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
if (const auto types = item->sharedMediaTypes()) {
|
||||
for (auto i = 0; i != Storage::kSharedMediaTypeCount; ++i) {
|
||||
const auto type = static_cast<Storage::SharedMediaType>(i);
|
||||
|
@ -1459,7 +1459,7 @@ bool History::readInboxTillNeedsRequest(MsgId tillId) {
|
|||
|
||||
void History::readClientSideMessages() {
|
||||
auto &histories = owner().histories();
|
||||
for (const auto item : _localMessages) {
|
||||
for (const auto &item : _localMessages) {
|
||||
histories.readClientSideMessage(item);
|
||||
}
|
||||
}
|
||||
|
@ -3040,12 +3040,12 @@ void History::clear(ClearType type) {
|
|||
} else {
|
||||
// Leave the 'sending' messages in local messages.
|
||||
auto local = base::flat_set<not_null<HistoryItem*>>();
|
||||
for (const auto item : _localMessages) {
|
||||
for (const auto &item : _localMessages) {
|
||||
if (!item->isSending()) {
|
||||
local.emplace(item);
|
||||
}
|
||||
}
|
||||
for (const auto item : local) {
|
||||
for (const auto &item : local) {
|
||||
item->destroy();
|
||||
}
|
||||
_notifications.clear();
|
||||
|
|
|
@ -2090,7 +2090,7 @@ TextForMimeData HistoryInner::getSelectedText() const {
|
|||
wrapItem(group->items.back(), HistoryGroupText(group));
|
||||
};
|
||||
|
||||
for (const auto [item, selection] : selected) {
|
||||
for (const auto &[item, selection] : selected) {
|
||||
if (const auto group = session().data().groups().find(item)) {
|
||||
if (groups.contains(group)) {
|
||||
continue;
|
||||
|
@ -3183,7 +3183,7 @@ bool HistoryInner::isSelected(
|
|||
bool HistoryInner::isSelectedGroup(
|
||||
not_null<SelectedItems*> toItems,
|
||||
not_null<const Data::Group*> group) const {
|
||||
for (const auto other : group->items) {
|
||||
for (const auto &other : group->items) {
|
||||
if (!isSelected(toItems, other)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3272,7 +3272,7 @@ void HistoryInner::changeSelectionAsGroup(
|
|||
}
|
||||
auto total = int(toItems->size());
|
||||
const auto canSelect = [&] {
|
||||
for (const auto other : group->items) {
|
||||
for (const auto &other : group->items) {
|
||||
if (!goodForSelection(toItems, other, total)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3280,11 +3280,11 @@ void HistoryInner::changeSelectionAsGroup(
|
|||
return (total <= MaxSelectedItems);
|
||||
}();
|
||||
if (action == SelectAction::Select && canSelect) {
|
||||
for (const auto other : group->items) {
|
||||
for (const auto &other : group->items) {
|
||||
addToSelection(toItems, other);
|
||||
}
|
||||
} else {
|
||||
for (const auto other : group->items) {
|
||||
for (const auto &other : group->items) {
|
||||
removeFromSelection(toItems, other);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace {
|
|||
}
|
||||
|
||||
[[nodiscard]] bool HasInlineItems(const HistoryItemsList &items) {
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
if (item->viaBot()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ QString GetErrorTextForSending(
|
|||
return tr::lng_forward_cant(tr::now);
|
||||
}
|
||||
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
if (const auto media = item->media()) {
|
||||
const auto error = media->errorTextForForward(peer);
|
||||
if (!error.isEmpty() && error != qstr("skip")) {
|
||||
|
@ -161,7 +161,7 @@ QString GetErrorTextForSending(
|
|||
} else if (items.size() > 1) {
|
||||
const auto albumForward = [&] {
|
||||
if (const auto groupId = items.front()->groupId()) {
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
if (item->groupId() != groupId) {
|
||||
return false;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ void FastShareMessage(not_null<HistoryItem*> item) {
|
|||
: MTPmessages_ForwardMessages::Flag(0));
|
||||
auto msgIds = QVector<MTPint>();
|
||||
msgIds.reserve(data->msgIds.size());
|
||||
for (const auto fullId : data->msgIds) {
|
||||
for (const auto &fullId : data->msgIds) {
|
||||
msgIds.push_back(MTP_int(fullId.msg));
|
||||
}
|
||||
auto generateRandom = [&] {
|
||||
|
|
|
@ -382,7 +382,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
|
|||
const auto callId = CallIdFromInput(action.vcall());
|
||||
const auto owner = &history()->owner();
|
||||
const auto peer = history()->peer;
|
||||
for (const auto id : action.vusers().v) {
|
||||
for (const auto &id : action.vusers().v) {
|
||||
const auto user = owner->user(id.v);
|
||||
if (callId) {
|
||||
owner->registerInvitedToCallUser(callId, peer, user);
|
||||
|
|
|
@ -5002,7 +5002,7 @@ void HistoryWidget::revealItemsCallback() {
|
|||
}
|
||||
|
||||
void HistoryWidget::startItemRevealAnimations() {
|
||||
for (const auto item : base::take(_itemRevealPending)) {
|
||||
for (const auto &item : base::take(_itemRevealPending)) {
|
||||
if (const auto view = item->mainView()) {
|
||||
if (const auto top = _list->itemTop(view); top >= 0) {
|
||||
if (const auto height = view->height()) {
|
||||
|
|
|
@ -884,7 +884,7 @@ bool ListWidget::overSelectedItems() const {
|
|||
bool ListWidget::isSelectedGroup(
|
||||
const SelectedMap &applyTo,
|
||||
not_null<const Data::Group*> group) const {
|
||||
for (const auto other : group->items) {
|
||||
for (const auto &other : group->items) {
|
||||
if (!applyTo.contains(other->fullId())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -970,7 +970,7 @@ void ListWidget::changeSelectionAsGroup(
|
|||
}
|
||||
auto already = int(applyTo.size());
|
||||
const auto canSelect = [&] {
|
||||
for (const auto other : group->items) {
|
||||
for (const auto &other : group->items) {
|
||||
if (!isGoodForSelection(applyTo, other, already)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -978,11 +978,11 @@ void ListWidget::changeSelectionAsGroup(
|
|||
return true;
|
||||
}();
|
||||
if (action == SelectAction::Select && canSelect) {
|
||||
for (const auto other : group->items) {
|
||||
for (const auto &other : group->items) {
|
||||
addToSelection(applyTo, other);
|
||||
}
|
||||
} else {
|
||||
for (const auto other : group->items) {
|
||||
for (const auto &other : group->items) {
|
||||
removeFromSelection(applyTo, other->fullId());
|
||||
}
|
||||
}
|
||||
|
@ -1440,7 +1440,7 @@ void ListWidget::resizeToWidth(int newWidth, int minHeight) {
|
|||
}
|
||||
|
||||
void ListWidget::startItemRevealAnimations() {
|
||||
for (const auto view : base::take(_itemRevealPending)) {
|
||||
for (const auto &view : base::take(_itemRevealPending)) {
|
||||
if (const auto height = view->height()) {
|
||||
if (!_itemRevealAnimations.contains(view)) {
|
||||
auto &animation = _itemRevealAnimations[view];
|
||||
|
@ -1731,7 +1731,7 @@ void ListWidget::applyDragSelection() {
|
|||
|
||||
void ListWidget::applyDragSelection(SelectedMap &applyTo) const {
|
||||
if (_dragSelectAction == DragSelectAction::Selecting) {
|
||||
for (const auto itemId : _dragSelected) {
|
||||
for (const auto &itemId : _dragSelected) {
|
||||
if (applyTo.size() >= MaxSelectedItems) {
|
||||
break;
|
||||
} else if (!applyTo.contains(itemId)) {
|
||||
|
@ -1741,7 +1741,7 @@ void ListWidget::applyDragSelection(SelectedMap &applyTo) const {
|
|||
}
|
||||
}
|
||||
} else if (_dragSelectAction == DragSelectAction::Deselecting) {
|
||||
for (const auto itemId : _dragSelected) {
|
||||
for (const auto &itemId : _dragSelected) {
|
||||
removeFromSelection(applyTo, itemId);
|
||||
}
|
||||
}
|
||||
|
@ -2163,12 +2163,12 @@ void ListWidget::updateDragSelection(
|
|||
};
|
||||
const auto changeGroup = [&](not_null<HistoryItem*> item, bool add) {
|
||||
if (const auto group = groups.find(item)) {
|
||||
for (const auto item : group->items) {
|
||||
for (const auto &item : group->items) {
|
||||
if (!_delegate->listIsItemGoodForSelection(item)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (const auto item : group->items) {
|
||||
for (const auto &item : group->items) {
|
||||
changeItem(item, add);
|
||||
}
|
||||
} else if (_delegate->listIsItemGoodForSelection(item)) {
|
||||
|
|
|
@ -622,7 +622,7 @@ bool PinnedWidget::listIsLessInOrder(
|
|||
void PinnedWidget::listSelectionChanged(SelectedItems &&items) {
|
||||
HistoryView::TopBarWidget::SelectedState state;
|
||||
state.count = items.size();
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
if (item.canDelete) {
|
||||
++state.canDeleteCount;
|
||||
}
|
||||
|
|
|
@ -1785,7 +1785,7 @@ bool RepliesWidget::listIsLessInOrder(
|
|||
void RepliesWidget::listSelectionChanged(SelectedItems &&items) {
|
||||
HistoryView::TopBarWidget::SelectedState state;
|
||||
state.count = items.size();
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
if (item.canDelete) {
|
||||
++state.canDeleteCount;
|
||||
}
|
||||
|
|
|
@ -1150,7 +1150,7 @@ bool ScheduledWidget::listIsLessInOrder(
|
|||
void ScheduledWidget::listSelectionChanged(SelectedItems &&items) {
|
||||
HistoryView::TopBarWidget::SelectedState state;
|
||||
state.count = items.size();
|
||||
for (const auto item : items) {
|
||||
for (const auto &item : items) {
|
||||
if (item.canDelete) {
|
||||
++state.canDeleteCount;
|
||||
}
|
||||
|
|
|
@ -1018,7 +1018,7 @@ void TopBarWidget::updateOnlineDisplay() {
|
|||
const auto self = session().user();
|
||||
auto online = 0;
|
||||
auto onlyMe = true;
|
||||
for (const auto user : chat->participants) {
|
||||
for (const auto &user : chat->participants) {
|
||||
if (user->onlineTill > now) {
|
||||
++online;
|
||||
if (onlyMe && user != self) onlyMe = false;
|
||||
|
@ -1095,7 +1095,7 @@ void TopBarWidget::updateOnlineDisplayTimer() {
|
|||
if (const auto user = peer->asUser()) {
|
||||
handleUser(user);
|
||||
} else if (const auto chat = peer->asChat()) {
|
||||
for (const auto user : chat->participants) {
|
||||
for (const auto &user : chat->participants) {
|
||||
handleUser(user);
|
||||
}
|
||||
} else if (peer->isChannel()) {
|
||||
|
|
|
@ -752,7 +752,7 @@ void Poll::draw(Painter &p, const PaintContext &context) const {
|
|||
auto &&answers = ranges::views::zip(
|
||||
_answers,
|
||||
ranges::views::ints(0, int(_answers.size())));
|
||||
for (const auto &[answer, index] : answers) {
|
||||
for (const auto [answer, index] : answers) {
|
||||
const auto animation = _answersAnimation
|
||||
? &_answersAnimation->data[index]
|
||||
: nullptr;
|
||||
|
|
|
@ -56,7 +56,7 @@ std::vector<std::unique_ptr<Data::Media>> PrepareCollageMedia(
|
|||
const WebPageCollage &data) {
|
||||
auto result = std::vector<std::unique_ptr<Data::Media>>();
|
||||
result.reserve(data.items.size());
|
||||
for (const auto item : data.items) {
|
||||
for (const auto &item : data.items) {
|
||||
if (const auto document = std::get_if<DocumentData*>(&item)) {
|
||||
result.push_back(std::make_unique<Data::MediaFile>(
|
||||
parent,
|
||||
|
|
|
@ -266,7 +266,7 @@ rpl::producer<int> AdminsCountValue(not_null<PeerData*> peer) {
|
|||
rpl::producer<int> RestrictionsCountValue(not_null<PeerData*> peer) {
|
||||
const auto countOfRestrictions = [](ChatRestrictions restrictions) {
|
||||
auto count = 0;
|
||||
for (const auto f : Data::ListOfRestrictions()) {
|
||||
for (const auto &f : Data::ListOfRestrictions()) {
|
||||
if (restrictions & f) count++;
|
||||
}
|
||||
return int(Data::ListOfRestrictions().size()) - count;
|
||||
|
|
|
@ -903,7 +903,7 @@ QString FormatDouble(float64 value) {
|
|||
|
||||
int NonZeroPartToInt(QString value) {
|
||||
auto zeros = 0;
|
||||
for (const auto ch : value) {
|
||||
for (const auto &ch : value) {
|
||||
if (ch == '0') {
|
||||
++zeros;
|
||||
} else {
|
||||
|
@ -988,7 +988,7 @@ void UpdatePluralRules(const QString &languageId) {
|
|||
static auto kMap = GeneratePluralRulesMap();
|
||||
auto parent = uint64(0);
|
||||
auto key = uint64(0);
|
||||
for (const auto ch : languageId) {
|
||||
for (const auto &ch : languageId) {
|
||||
const auto converted = ConvertKeyChar(ch.unicode());
|
||||
if (converted == '-' && !parent) {
|
||||
parent = key;
|
||||
|
|
|
@ -48,7 +48,7 @@ QByteArray SessionSettings::serialize() const {
|
|||
stream << qint32(kVersionTag) << qint32(kVersion);
|
||||
stream << static_cast<qint32>(_selectorTab);
|
||||
stream << qint32(_groupStickersSectionHidden.size());
|
||||
for (const auto peerId : _groupStickersSectionHidden) {
|
||||
for (const auto &peerId : _groupStickersSectionHidden) {
|
||||
stream << SerializePeerId(peerId);
|
||||
}
|
||||
stream << qint32(_supportSwitch);
|
||||
|
|
|
@ -818,7 +818,7 @@ void MainWidget::handleAudioUpdate(const Media::Player::TrackState &state) {
|
|||
if (document) {
|
||||
if (const auto items = InlineBots::Layout::documentItems()) {
|
||||
if (const auto i = items->find(document); i != items->end()) {
|
||||
for (const auto item : i->second) {
|
||||
for (const auto &item : i->second) {
|
||||
item->update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ void OverlayWidget::RendererSW::paintBackground() {
|
|||
const auto &bg = _owner->_fullScreenVideo
|
||||
? st::mediaviewVideoBg
|
||||
: st::mediaviewBg;
|
||||
for (const auto rect : region) {
|
||||
for (const auto &rect : region) {
|
||||
_p->fillRect(rect, bg);
|
||||
}
|
||||
_p->setCompositionMode(m);
|
||||
|
|
|
@ -268,7 +268,7 @@ std::vector<DataError> DeserializeErrors(bytes::const_span json) {
|
|||
}
|
||||
auto array = document.array();
|
||||
auto result = std::vector<DataError>();
|
||||
for (const auto &error : array) {
|
||||
for (const auto error : array) {
|
||||
if (!error.isObject()) {
|
||||
LOG(("API Error: Not an object inside errors JSON."));
|
||||
continue;
|
||||
|
|
|
@ -2544,7 +2544,7 @@ bool FormController::parseForm(const MTPaccount_AuthorizationForm &result) {
|
|||
}
|
||||
for (const auto &required : data.vrequired_types().v) {
|
||||
const auto row = CollectRequestedRow(required);
|
||||
for (const auto requested : row.values) {
|
||||
for (const auto &requested : row.values) {
|
||||
const auto type = requested.type;
|
||||
const auto [i, ok] = _form.values.emplace(type, Value(type));
|
||||
auto &value = i->second;
|
||||
|
|
|
@ -458,7 +458,7 @@ void FormSummary::setupSuggestedTips(not_null<VerticalLayout*> layout) {
|
|||
}
|
||||
height += buttons[0].widget->height() + skip;
|
||||
};
|
||||
for (const auto button : buttons) {
|
||||
for (const auto &button : buttons) {
|
||||
if (button.minWidth <= left) {
|
||||
left -= button.minWidth + skip;
|
||||
++rowEnd;
|
||||
|
|
|
@ -237,7 +237,7 @@ void AppendRecentStickers(
|
|||
to.emplace_back(PickerScrubberItem(document));
|
||||
}
|
||||
}
|
||||
for (const auto recent : recentPack) {
|
||||
for (const auto &recent : recentPack) {
|
||||
to.emplace_back(PickerScrubberItem(recent.first));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ void GroupMembersWidget::fillChatMembers(not_null<ChatData*> chat) {
|
|||
reserveItemsForSize(chat->participants.size());
|
||||
addUser(chat, chat->session().user())->onlineForSort
|
||||
= std::numeric_limits<TimeId>::max();
|
||||
for (const auto user : chat->participants) {
|
||||
for (const auto &user : chat->participants) {
|
||||
if (!user->isSelf()) {
|
||||
addUser(chat, user);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ bool IsTemplatesFile(const QString &file) {
|
|||
QString NormalizeQuestion(const QString &question) {
|
||||
auto result = QString();
|
||||
result.reserve(question.size());
|
||||
for (const auto ch : question) {
|
||||
for (const auto &ch : question) {
|
||||
if (ch.isLetterOrNumber()) {
|
||||
result.append(ch.toLower());
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ void CountrySelectBox::Inner::init() {
|
|||
}
|
||||
}
|
||||
auto index = 0;
|
||||
for (const auto info : _list) {
|
||||
for (const auto &info : _list) {
|
||||
auto full = info.country
|
||||
+ ' '
|
||||
+ (!info.alternativeName.isEmpty()
|
||||
|
|
|
@ -29,7 +29,7 @@ void SingleChoiceBox(
|
|||
layout,
|
||||
st::boxOptionListPadding.top() + st::autolockButton.margin.top()));
|
||||
auto &&ints = ranges::views::ints(0, ranges::unreachable);
|
||||
for (const auto &[i, text] : ranges::views::zip(ints, args.options)) {
|
||||
for (const auto [i, text] : ranges::views::zip(ints, args.options)) {
|
||||
layout->add(
|
||||
object_ptr<Ui::Radiobutton>(
|
||||
layout,
|
||||
|
|
|
@ -257,7 +257,7 @@ void EditorBlock::addToSearch(const Row &row) {
|
|||
if (!query.isEmpty()) resetSearch();
|
||||
|
||||
auto index = findRowIndex(&row);
|
||||
for (const auto ch : row.searchStartChars()) {
|
||||
for (const auto &ch : row.searchStartChars()) {
|
||||
_searchIndex[ch].insert(index);
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ void EditorBlock::removeFromSearch(const Row &row) {
|
|||
if (!query.isEmpty()) resetSearch();
|
||||
|
||||
auto index = findRowIndex(&row);
|
||||
for (const auto ch : row.searchStartChars()) {
|
||||
for (const auto &ch : row.searchStartChars()) {
|
||||
const auto i = _searchIndex.find(ch);
|
||||
if (i != end(_searchIndex)) {
|
||||
i->second.remove(index);
|
||||
|
|
Loading…
Add table
Reference in a new issue