mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Fix GCC 15 -Wrange-loop-construct
This commit is contained in:
@@ -1929,7 +1929,7 @@ void ApiWrap::updateNotifySettingsDelayed(Data::DefaultNotify type) {
|
||||
|
||||
void ApiWrap::sendNotifySettingsUpdates() {
|
||||
_updateNotifyQueueLifetime.destroy();
|
||||
for (const auto topic : base::take(_updateNotifyTopics)) {
|
||||
for (const auto &topic : base::take(_updateNotifyTopics)) {
|
||||
request(MTPaccount_UpdateNotifySettings(
|
||||
MTP_inputNotifyForumTopic(
|
||||
topic->peer()->input(),
|
||||
@@ -1937,7 +1937,7 @@ void ApiWrap::sendNotifySettingsUpdates() {
|
||||
topic->notify().serialize()
|
||||
)).afterDelay(kSmallDelayMs).send();
|
||||
}
|
||||
for (const auto peer : base::take(_updateNotifyPeers)) {
|
||||
for (const auto &peer : base::take(_updateNotifyPeers)) {
|
||||
request(MTPaccount_UpdateNotifySettings(
|
||||
MTP_inputNotifyPeer(peer->input()),
|
||||
peer->notify().serialize()
|
||||
@@ -3621,7 +3621,7 @@ void ApiWrap::forwardMessages(
|
||||
|
||||
ids.reserve(count);
|
||||
randomIds.reserve(count);
|
||||
for (const auto item : draft.items) {
|
||||
for (const auto &item : draft.items) {
|
||||
const auto randomId = base::RandomValue<uint64>();
|
||||
if (genClientSideMessage) {
|
||||
const auto newId = FullMsgId(
|
||||
|
||||
@@ -585,7 +585,7 @@ void EditNoPaidMessagesExceptions(
|
||||
setTo.premiums = false;
|
||||
setTo.miniapps = false;
|
||||
auto &removeFrom = copy.never;
|
||||
for (const auto peer : setTo.peers) {
|
||||
for (const auto &peer : setTo.peers) {
|
||||
removeFrom.peers.erase(
|
||||
ranges::remove(removeFrom.peers, peer),
|
||||
end(removeFrom.peers));
|
||||
@@ -671,7 +671,7 @@ void EditPrivacyBox::editExceptions(
|
||||
Unexpected("Invalid exception value.");
|
||||
}();
|
||||
auto &removeFrom = exceptions(type);
|
||||
for (const auto peer : exceptions(exception).peers) {
|
||||
for (const auto &peer : exceptions(exception).peers) {
|
||||
removeFrom.peers.erase(
|
||||
ranges::remove(removeFrom.peers, peer),
|
||||
end(removeFrom.peers));
|
||||
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
|
||||
template <typename PeerDataRange>
|
||||
void peerListAddSelectedPeers(PeerDataRange &&range) {
|
||||
for (const auto peer : range) {
|
||||
for (const auto &peer : range) {
|
||||
peerListAddSelectedPeerInBunch(peer);
|
||||
}
|
||||
peerListFinishSelectedRowsBunch();
|
||||
|
||||
@@ -111,7 +111,7 @@ void Controller::prepare() {
|
||||
if (_chat) {
|
||||
appendRow(_chat);
|
||||
} else {
|
||||
for (const auto chat : _chats) {
|
||||
for (const auto &chat : _chats) {
|
||||
appendRow(chat);
|
||||
}
|
||||
if (_chats.size() >= kEnableSearchRowsCount) {
|
||||
|
||||
@@ -614,7 +614,7 @@ void ParticipantsAdditionalData::fillFromChannel(
|
||||
if (information->creator) {
|
||||
_creator = information->creator;
|
||||
}
|
||||
for (const auto user : information->lastParticipants) {
|
||||
for (const auto &user : information->lastParticipants) {
|
||||
const auto admin = information->lastAdmins.find(user);
|
||||
const auto rank = information->memberRanks.find(peerToUser(user->id));
|
||||
const auto restricted = information->lastRestricted.find(user);
|
||||
@@ -1575,7 +1575,7 @@ void ParticipantsBoxController::rebuildChatAdmins(
|
||||
delegate()->peerListRemoveRow(
|
||||
delegate()->peerListRowAt(0));
|
||||
}
|
||||
for (const auto user : list) {
|
||||
for (const auto &user : list) {
|
||||
if (auto row = createRow(user)) {
|
||||
const auto raw = row.get();
|
||||
delegate()->peerListAppendRow(std::move(row));
|
||||
@@ -1732,7 +1732,7 @@ bool ParticipantsBoxController::feedMegagroupLastParticipants() {
|
||||
|
||||
auto added = false;
|
||||
_additional.fillFromPeer();
|
||||
for (const auto user : info->lastParticipants) {
|
||||
for (const auto &user : info->lastParticipants) {
|
||||
if (appendRow(user)) {
|
||||
added = true;
|
||||
}
|
||||
|
||||
@@ -1522,7 +1522,7 @@ object_ptr<Ui::BoxContent> ShareInviteLinkBox(
|
||||
comment.text = link;
|
||||
}
|
||||
auto &api = session->api();
|
||||
for (const auto thread : result) {
|
||||
for (const auto &thread : result) {
|
||||
auto message = Api::MessageToSend(
|
||||
Api::SendAction(thread, options));
|
||||
message.textWithTags = comment;
|
||||
|
||||
@@ -1741,7 +1741,7 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
||||
const auto showRecentForwardsToSelf = result.size() == 1
|
||||
&& result.front()->peer()->isSelf()
|
||||
&& history->session().premium();
|
||||
for (const auto thread : result) {
|
||||
for (const auto &thread : result) {
|
||||
const auto peer = thread->peer();
|
||||
const auto threadHistory = thread->owningHistory();
|
||||
const auto forum = threadHistory->asForum();
|
||||
@@ -2108,7 +2108,7 @@ void FastShareLink(
|
||||
comment.text = url;
|
||||
}
|
||||
auto &api = show->session().api();
|
||||
for (const auto thread : result) {
|
||||
for (const auto &thread : result) {
|
||||
auto message = Api::MessageToSend(
|
||||
Api::SendAction(thread, options));
|
||||
message.textWithTags = comment;
|
||||
|
||||
@@ -1823,7 +1823,7 @@ TextWithEntities ActiveAuctionsTitle(const Data::ActiveAuctions &auctions) {
|
||||
).append(' ').append(tr::lng_auction_bar_active(tr::now));
|
||||
}
|
||||
auto result = tr::marked();
|
||||
for (const auto auction : list | ranges::views::take(3)) {
|
||||
for (const auto &auction : list | ranges::views::take(3)) {
|
||||
result.append(Data::SingleCustomEmoji(auction->gift->document));
|
||||
}
|
||||
return result.append(' ').append(
|
||||
@@ -1851,7 +1851,7 @@ ManyAuctionsState ActiveAuctionsState(const Data::ActiveAuctions &auctions) {
|
||||
return { std::move(text), !position };
|
||||
}
|
||||
auto outbid = 0;
|
||||
for (const auto auction : list) {
|
||||
for (const auto &auction : list) {
|
||||
if (!winning(auction)) {
|
||||
++outbid;
|
||||
}
|
||||
@@ -2036,7 +2036,7 @@ Fn<void()> ActiveAuctionsCallback(
|
||||
.ends = state.nextRoundAt ? state.nextRoundAt : state.endDate,
|
||||
};
|
||||
};
|
||||
for (const auto auction : list) {
|
||||
for (const auto &auction : list) {
|
||||
state->list.push_back(singleFrom(*auction));
|
||||
}
|
||||
return [=] {
|
||||
|
||||
@@ -2145,7 +2145,7 @@ Controller::Controller(not_null<Main::Session*> session, PickCallback pick)
|
||||
return aBirthday.day() < bBirthday.day();
|
||||
});
|
||||
|
||||
for (const auto user : usersWithBirthdays) {
|
||||
for (const auto &user : usersWithBirthdays) {
|
||||
auto row = std::make_unique<PeerRow>(user);
|
||||
if (auto s = status(user->birthday()); !s.isEmpty()) {
|
||||
row->setCustomStatus(std::move(s));
|
||||
|
||||
@@ -344,7 +344,7 @@ void ConfInviteRow::elementsPaint(
|
||||
}
|
||||
|
||||
void prepare() override {
|
||||
for (const auto user : _users) {
|
||||
for (const auto &user : _users) {
|
||||
delegate()->peerListAppendRow(
|
||||
std::make_unique<ConfInviteRow>(user, _st));
|
||||
}
|
||||
@@ -485,7 +485,7 @@ ConfInviteController::ConfInviteController(
|
||||
, _shareLink(std::move(shareLink)) {
|
||||
if (!_shareLink) {
|
||||
_skip.reserve(_prioritize.size());
|
||||
for (const auto user : _prioritize) {
|
||||
for (const auto &user : _prioritize) {
|
||||
_skip.emplace(user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ object_ptr<ShareBox> ShareInviteLinkBox(
|
||||
comment.text = link;
|
||||
}
|
||||
auto &api = peer->session().api();
|
||||
for (const auto thread : result) {
|
||||
for (const auto &thread : result) {
|
||||
auto message = Api::MessageToSend(
|
||||
Api::SendAction(thread, options));
|
||||
message.textWithTags = comment;
|
||||
|
||||
@@ -499,7 +499,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
||||
sorted.emplace(byOnline(user), user);
|
||||
}
|
||||
}
|
||||
for (const auto user : _chat->lastAuthors) {
|
||||
for (const auto &user : _chat->lastAuthors) {
|
||||
if (user->isInaccessible()) continue;
|
||||
if (!listAllSuggestions && filterNotPassedByName(user)) continue;
|
||||
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
|
||||
@@ -530,7 +530,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
||||
_channel);
|
||||
} else {
|
||||
mrows.reserve(mrows.size() + _channel->mgInfo->lastParticipants.size());
|
||||
for (const auto user : _channel->mgInfo->lastParticipants) {
|
||||
for (const auto &user : _channel->mgInfo->lastParticipants) {
|
||||
if (user->isInaccessible()) continue;
|
||||
if (!listAllSuggestions && filterNotPassedByName(user)) continue;
|
||||
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
|
||||
|
||||
@@ -976,7 +976,7 @@ void GroupCall::checkFinishSpeakingByActive() {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
for (const auto participantPeer : stop) {
|
||||
for (const auto &participantPeer : stop) {
|
||||
const auto participant = findParticipant(participantPeer);
|
||||
Assert(participant != nullptr);
|
||||
if (participant->speaking) {
|
||||
|
||||
@@ -984,7 +984,7 @@ void Histories::deleteMessages(const MessageIdsList &ids, bool revoke) {
|
||||
document->owner().savedMusic().remove(document);
|
||||
}
|
||||
|
||||
for (const auto item : remove) {
|
||||
for (const auto &item : remove) {
|
||||
const auto history = item->history();
|
||||
const auto wasLast = (history->lastMessage() == item);
|
||||
const auto wasInChats = (history->chatListMessage() == item);
|
||||
|
||||
@@ -1709,7 +1709,7 @@ void Session::enumerateItemViews(
|
||||
not_null<const HistoryItem*> item,
|
||||
Method method) {
|
||||
if (const auto i = _views.find(item); i != _views.end()) {
|
||||
for (const auto view : i->second) {
|
||||
for (const auto &view : i->second) {
|
||||
method(view);
|
||||
}
|
||||
}
|
||||
@@ -2297,7 +2297,7 @@ void Session::unloadHeavyViewParts(
|
||||
remove.push_back(view);
|
||||
}
|
||||
}
|
||||
for (const auto view : remove) {
|
||||
for (const auto &view : remove) {
|
||||
view->unloadHeavyPart();
|
||||
}
|
||||
}
|
||||
@@ -2317,7 +2317,7 @@ void Session::unloadHeavyViewParts(
|
||||
remove.push_back(view);
|
||||
}
|
||||
}
|
||||
for (const auto view : remove) {
|
||||
for (const auto &view : remove) {
|
||||
view->unloadHeavyPart();
|
||||
}
|
||||
}
|
||||
@@ -4679,7 +4679,7 @@ void Session::registerContactItem(
|
||||
}
|
||||
|
||||
if (const auto i = _views.find(item); i != _views.end()) {
|
||||
for (const auto view : i->second) {
|
||||
for (const auto &view : i->second) {
|
||||
if (const auto media = view->media()) {
|
||||
media->updateSharedContactUserId(contactId);
|
||||
}
|
||||
@@ -4746,7 +4746,7 @@ void Session::unregisterStoryItem(
|
||||
void Session::refreshStoryItemViews(FullStoryId id) {
|
||||
const auto i = _storyItems.find(id);
|
||||
if (i != _storyItems.end()) {
|
||||
for (const auto item : i->second) {
|
||||
for (const auto &item : i->second) {
|
||||
if (const auto media = item->media()) {
|
||||
if (media->storyMention()) {
|
||||
item->updateStoryMentionText();
|
||||
|
||||
@@ -261,7 +261,7 @@ void Stickers::incrementSticker(not_null<DocumentData*> document) {
|
||||
set->emoji[emoji].push_front(document);
|
||||
}
|
||||
} else if (!removedFromEmoji.empty()) {
|
||||
for (const auto emoji : removedFromEmoji) {
|
||||
for (const auto &emoji : removedFromEmoji) {
|
||||
set->emoji[emoji].push_front(document);
|
||||
}
|
||||
} else {
|
||||
@@ -1465,7 +1465,7 @@ std::vector<not_null<DocumentData*>> Stickers::getListByEmoji(
|
||||
const auto others = session().api().stickersByEmoji(key);
|
||||
if (others) {
|
||||
result.reserve(result.size() + others->size());
|
||||
for (const auto document : *others) {
|
||||
for (const auto &document : *others) {
|
||||
add(document, CreateOtherSortKey(document));
|
||||
}
|
||||
} else if (!forceAllResults) {
|
||||
|
||||
@@ -638,7 +638,7 @@ void History::destroyMessagesByDates(TimeId minDate, TimeId maxDate) {
|
||||
toDestroy.push_back(message.get());
|
||||
}
|
||||
}
|
||||
for (const auto item : toDestroy) {
|
||||
for (const auto &item : toDestroy) {
|
||||
item->destroy();
|
||||
}
|
||||
}
|
||||
@@ -651,7 +651,7 @@ void History::destroyMessagesByTopic(MsgId topicRootId) {
|
||||
toDestroy.push_back(message.get());
|
||||
}
|
||||
}
|
||||
for (const auto item : toDestroy) {
|
||||
for (const auto &item : toDestroy) {
|
||||
item->destroy();
|
||||
}
|
||||
}
|
||||
@@ -665,7 +665,7 @@ void History::destroyMessagesBySublist(not_null<PeerData*> sublistPeer) {
|
||||
toDestroy.push_back(message.get());
|
||||
}
|
||||
}
|
||||
for (const auto item : toDestroy) {
|
||||
for (const auto &item : toDestroy) {
|
||||
item->destroy();
|
||||
}
|
||||
}
|
||||
@@ -4043,7 +4043,7 @@ void History::clearUpTill(MsgId availableMinId) {
|
||||
remove.push_back(item.get());
|
||||
}
|
||||
}
|
||||
for (const auto item : remove) {
|
||||
for (const auto &item : remove) {
|
||||
item->destroy();
|
||||
}
|
||||
requestChatListMessage();
|
||||
|
||||
@@ -5214,7 +5214,7 @@ void HistoryInner::applyDragSelection(
|
||||
toRemove.emplace_back(item.first);
|
||||
}
|
||||
}
|
||||
for (const auto item : toRemove) {
|
||||
for (const auto &item : toRemove) {
|
||||
changeSelectionAsGroup(toItems, item, SelectAction::Deselect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ Data::SendError GetErrorForSending(
|
||||
Data::SendErrorWithThread GetErrorForSending(
|
||||
const std::vector<not_null<Data::Thread*>> &threads,
|
||||
SendingErrorRequest request) {
|
||||
for (const auto thread : threads) {
|
||||
for (const auto &thread : threads) {
|
||||
const auto error = GetErrorForSending(thread, request);
|
||||
if (error) {
|
||||
return Data::SendErrorWithThread{ error, thread };
|
||||
|
||||
@@ -105,7 +105,7 @@ void ForwardPanel::checkTexts() {
|
||||
? kNameWithCaptionsVersion
|
||||
: kNameNoCaptionsVersion;
|
||||
if (keepNames) {
|
||||
for (const auto item : _data.items) {
|
||||
for (const auto &item : _data.items) {
|
||||
if (const auto from = item->originalSender()) {
|
||||
version += from->nameVersion();
|
||||
} else if (item->originalHiddenSenderInfo()) {
|
||||
@@ -142,7 +142,7 @@ void ForwardPanel::updateTexts() {
|
||||
auto fullname = QString();
|
||||
auto names = std::vector<QString>();
|
||||
names.reserve(_data.items.size());
|
||||
for (const auto item : _data.items) {
|
||||
for (const auto &item : _data.items) {
|
||||
if (const auto from = item->originalSender()) {
|
||||
if (!insertedPeers.contains(from)) {
|
||||
insertedPeers.emplace(from);
|
||||
|
||||
@@ -201,7 +201,7 @@ void UserpicsList::subscribeToUpdates(Fn<void()> callback) {
|
||||
return;
|
||||
}
|
||||
_subscribed = std::make_unique<Subscribed>(std::move(callback));
|
||||
for (const auto peer : _peers) {
|
||||
for (const auto &peer : _peers) {
|
||||
_subscribed->list.push_back({ .peer = peer });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ void Controller::showReaction(const ReactionId &reaction) {
|
||||
}) | ranges::views::transform(
|
||||
&AllEntry::first
|
||||
) | ranges::to_vector;
|
||||
for (const auto peer : _filtered) {
|
||||
for (const auto &peer : _filtered) {
|
||||
appendRow(peer, _shownReaction);
|
||||
}
|
||||
_filteredOffset = QString();
|
||||
|
||||
@@ -836,7 +836,7 @@ void WrapWidget::showFinishedHook() {
|
||||
showTopBarMenu(false);
|
||||
if (_topBarMenu) {
|
||||
const auto menu = _topBarMenu->menu();
|
||||
for (const auto action : menu->actions()) {
|
||||
for (const auto &action : menu->actions()) {
|
||||
const auto controlId = "highlight-control-id";
|
||||
if (action->property(controlId).toString() == highlightId) {
|
||||
if (const auto item = menu->itemForAction(action)) {
|
||||
|
||||
@@ -128,7 +128,7 @@ rpl::producer<int> ListController::unlockHeightValue() const {
|
||||
void ListController::rebuild() {
|
||||
const auto participants = &_peer->session().api().chatParticipants();
|
||||
const auto &list = participants->similar(_peer);
|
||||
for (const auto peer : list.list) {
|
||||
for (const auto &peer : list.list) {
|
||||
if (!delegate()->peerListFindRow(peer->id.value)) {
|
||||
delegate()->peerListAppendRow(createRow(peer));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Media::Stories {
|
||||
comment.text = url;
|
||||
}
|
||||
auto &api = show->session().api();
|
||||
for (const auto thread : result) {
|
||||
for (const auto &thread : result) {
|
||||
auto message = Api::MessageToSend(
|
||||
Api::SendAction(thread, options));
|
||||
message.textWithTags = comment;
|
||||
@@ -134,7 +134,7 @@ namespace Media::Stories {
|
||||
|
||||
const auto api = &story->session().api();
|
||||
auto &histories = story->owner().histories();
|
||||
for (const auto thread : result) {
|
||||
for (const auto &thread : result) {
|
||||
const auto action = Api::SendAction(thread, options);
|
||||
if (!comment.text.isEmpty()) {
|
||||
auto message = Api::MessageToSend(action);
|
||||
|
||||
@@ -721,7 +721,7 @@ void Main::showFinished() {
|
||||
if (controller()->takeHighlightControlId(emojiId)) {
|
||||
if (const auto popupMenu = _userpic->showChangePhotoMenu()) {
|
||||
const auto menu = popupMenu->menu();
|
||||
for (const auto action : menu->actions()) {
|
||||
for (const auto &action : menu->actions()) {
|
||||
const auto controlId = "highlight-control-id";
|
||||
if (action->property(controlId).toString() == emojiId) {
|
||||
if (const auto item = menu->itemForAction(action)) {
|
||||
|
||||
@@ -402,7 +402,7 @@ void AddStakePresets(
|
||||
const auto cols = int(row.size());
|
||||
const auto singlew = (width - (cols - 1) * xskip) / cols;
|
||||
auto x = 0;
|
||||
for (const auto button : row) {
|
||||
for (const auto &button : row) {
|
||||
button->setFullWidth(singlew);
|
||||
button->move(x, y);
|
||||
x += singlew + xskip;
|
||||
|
||||
@@ -62,7 +62,7 @@ void CloseInWindows(not_null<Data::Thread*> thread) {
|
||||
using WindowPointer = base::weak_ptr<Window::SessionController>;
|
||||
auto closing = std::vector<WindowPointer>();
|
||||
auto clearing = std::vector<WindowPointer>();
|
||||
for (const auto window : thread->session().windows()) {
|
||||
for (const auto &window : thread->session().windows()) {
|
||||
if (window->windowId().chat() == thread) {
|
||||
closing.push_back(base::make_weak(window));
|
||||
} else if (window->activeChatCurrent().thread() == thread) {
|
||||
|
||||
@@ -153,7 +153,7 @@ void MediaPreviewWidget::paintEvent(QPaintEvent *e) {
|
||||
+ (emojiCount - 1) * st::stickerEmojiSkip;
|
||||
auto emojiLeft = (width() - emojiWidth) / 2;
|
||||
const auto esize = Ui::Emoji::GetSizeLarge();
|
||||
for (const auto emoji : _emojiList) {
|
||||
for (const auto &emoji : _emojiList) {
|
||||
Ui::Emoji::Draw(
|
||||
p,
|
||||
emoji,
|
||||
|
||||
@@ -3201,7 +3201,7 @@ base::weak_qptr<Ui::BoxContent> ShowForwardMessagesBox(
|
||||
const auto sendMenuType = [=] {
|
||||
const auto selected = state->box->collectSelectedRows();
|
||||
const auto hasPaid = [&] {
|
||||
for (const auto peer : selected) {
|
||||
for (const auto &peer : selected) {
|
||||
if (peer->starsPerMessageChecked()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user