diff options
37 files changed, 105 insertions, 161 deletions
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index a77db51160..e7c3caf63f 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -103,10 +103,9 @@ static void QueueRemove(MCONTACT hContact) {
mir_cslock lck(cs);
- auto T = queue.rev_iter();
- for (auto &it : T)
+ for (auto &it : queue.rev_iter())
if (it->hContact == hContact)
- queue.remove(T.indexOf(&it));
+ queue.removeItem(&it);
}
// Add an contact to a queue
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 191d11d6ec..cc93b0d16c 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -269,7 +269,7 @@ static void _AniAva_ReduceAvatarImages(int startY, int dY, BOOL bDestroyWindow) for (auto &it : T) {
int res = SendMessage(it->hWindow, AAM_REMOVEAVATAR, (WPARAM)startY, (LPARAM)dY);
if (res == 0xDEAD && bDestroyWindow)
- s_Objects.remove(T.indexOf(&it));
+ s_Objects.removeItem(&it);
}
}
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index cbc0a3ccae..427ac780d5 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -525,10 +525,9 @@ int ske_ReleaseBufferDC(HDC hDC, int keepTime) { DWORD dwCurrentTime = GetTickCount(); - //Try to find DC in buffer list - set flag to be release after time; + // Try to find DC in buffer list - set flag to be release after time; mir_cslock lck(BufferListCS); - auto T = BufferList.rev_iter(); - for (auto &it : T) { + for (auto &it : BufferList.rev_iter()) { if (it) { if (hDC != nullptr && it->hDC == hDC) { it->dwDestroyAfterTime = dwCurrentTime + keepTime; @@ -539,8 +538,7 @@ int ske_ReleaseBufferDC(HDC hDC, int keepTime) SelectObject(it->hDC, it->oldBitmap); DeleteObject(it->hBitmap); DeleteDC(it->hDC); - mir_free(it); - BufferList.remove(T.indexOf(&it)); + mir_free(BufferList.removeItem(&it)); } } } diff --git a/plugins/Clist_modern/src/modern_xptheme.cpp b/plugins/Clist_modern/src/modern_xptheme.cpp index bff9e8a7fb..2c341149c9 100644 --- a/plugins/Clist_modern/src/modern_xptheme.cpp +++ b/plugins/Clist_modern/src/modern_xptheme.cpp @@ -72,12 +72,10 @@ void xpt_FreeThemeHandle(XPTHANDLE xptHandle) void xpt_FreeThemeForWindow(HWND hwnd)
{
mir_cslock lck(xptCS);
- auto T = xptObjectList.rev_iter();
- for (auto &xptObject : T)
- if (xptObject->hOwnerWindow == hwnd) {
- _sttXptCloseThemeData(xptObject);
- xptObjectList.remove(T.indexOf(&xptObject));
- }
+
+ for (auto &xptObject : xptObjectList.rev_iter())
+ if (xptObject->hOwnerWindow == hwnd)
+ _sttXptCloseThemeData(xptObjectList.removeItem(&xptObject));
}
void xpt_OnWM_THEMECHANGED()
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 7e69ffa91d..e3b05f2c24 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -38,13 +38,12 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent) TContactInfo *pFound = nullptr;
mir_cslock lck(m_cs);
- auto T = m_cache.rev_iter();
- for (auto &it : T) {
+
+ for (auto &it : m_cache.rev_iter()) {
it->rate *= q;
if (it->hContact == hContact) {
it->rate += weight;
- pFound = it;
- m_cache.remove(T.indexOf(&it)); // reinsert to maintain the sort order
+ pFound = m_cache.removeItem(&it); // reinsert to maintain the sort order
}
}
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index d74dbfeadc..7e32d8aa4e 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -225,10 +225,9 @@ int OnWindowEvent(WPARAM, LPARAM lParam) SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE);
}
- auto T = g_hWindows.rev_iter();
- for (auto &it : T)
+ for (auto &it : g_hWindows.rev_iter())
if (it == PVOID(msgEvData->hContact))
- g_hWindows.remove(T.indexOf(&it));
+ g_hWindows.removeItem(&it);
break;
}
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 5796e051e3..b703204fd5 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -42,34 +42,28 @@ void FreeXSC(XSTATUSCHANGE *xsc) void RemoveLoggedEventsXStatus(MCONTACT hContact)
{
- auto T = eventListXStatus.rev_iter();
- for (auto &it : T)
+ for (auto &it : eventListXStatus.rev_iter())
if (it->hContact == hContact) {
db_event_delete(it->hDBEvent);
- mir_free(it);
- eventListXStatus.remove(T.indexOf(&it));
+ mir_free(eventListXStatus.removeItem(&it));
}
}
void RemoveLoggedEventsStatus(MCONTACT hContact)
{
- auto T = eventListStatus.rev_iter();
- for (auto &it : T)
+ for (auto &it : eventListStatus.rev_iter())
if (it->hContact == hContact) {
db_event_delete(it->hDBEvent);
- mir_free(it);
- eventListStatus.remove(T.indexOf(&it));
+ mir_free(eventListStatus.removeItem(&it));
}
}
void RemoveLoggedEventsSMsg(MCONTACT hContact)
{
- auto T = eventListSMsg.rev_iter();
- for (auto &it : T)
+ for (auto &it : eventListSMsg.rev_iter())
if (it->hContact == hContact) {
db_event_delete(it->hDBEvent);
- mir_free(it);
- eventListSMsg.remove(T.indexOf(&it));
+ mir_free(eventListSMsg.removeItem(&it));
}
}
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 183014a76f..d6fa27d649 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -179,12 +179,9 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA break;
case UTM_REMOVE_WINDOW:
- {
- auto T = popupList.rev_iter();
- for (auto &it : T)
- if (it == wnd)
- popupList.remove(T.indexOf(&it));
- }
+ for (auto &it : popupList.rev_iter())
+ if (it == wnd)
+ popupList.removeItem(&it);
RepositionPopups();
--nPopups;
diff --git a/plugins/ProxySwitch/src/ip.cpp b/plugins/ProxySwitch/src/ip.cpp index e36f4ae444..1962ca7382 100644 --- a/plugins/ProxySwitch/src/ip.cpp +++ b/plugins/ProxySwitch/src/ip.cpp @@ -647,7 +647,7 @@ void UnboundConnections(LONG *OldIP, LONG *NewIP) mir_cslock lck(csConnection_List); for (auto &it : g_arConnections.rev_iter()) if (it->IP == (ULONG)*OldIP) - g_arConnections.remove(g_arConnections.indexOf(&it)); + g_arConnections.removeItem(&it); } OldIP++; } diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp index eb27717760..bfd39e3ce5 100644 --- a/plugins/Scriver/src/sendqueue.cpp +++ b/plugins/Scriver/src/sendqueue.cpp @@ -89,7 +89,7 @@ void ReportSendQueueTimeouts(CMsgDialog *pDlg) pDlg->StopMessageSending();
(new CErrorDlg(TranslateT("The message send timed out."), pDlg, it))->Create();
}
- else arQueue.remove(arQueue.indexOf(&it));
+ else arQueue.removeItem(&it);
}
}
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 408e181c4e..168d1edd2e 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -50,14 +50,13 @@ static PLUGIN_DATAT* PU_GetByContact(const MCONTACT hContact) */
static void PU_CleanUp()
{
- auto T = arPopupList.rev_iter();
- for (auto &p : T) {
+ for (auto &p : arPopupList.rev_iter()) {
if (p->hContact != 0)
continue;
mir_free(p->eventData);
mir_free(p);
- arPopupList.remove(T.indexOf(&p));
+ arPopupList.removeItem(&p);
}
}
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index 7e3a9bb73a..cd800ff5a2 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -136,7 +136,7 @@ void CPsTree::Remove(HINSTANCE hInst) TreeView_DeleteAllItems(_hWndTree); bRemoved = true; } - _pages.remove(_pages.indexOf(&it)); + _pages.removeItem(&it); } } diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp index 9b49a2c261..8a93812287 100644 --- a/plugins/UserInfoEx/src/mir_contactqueue.cpp +++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp @@ -83,13 +83,9 @@ void CContactQueue::RemoveAll(MCONTACT hContact) {
mir_cslock lck(_cs);
- auto T = _queue.rev_iter();
- for (auto &qi : T) {
- if (qi->hContact == hContact) {
- mir_free(qi);
- _queue.remove(T.indexOf(&qi));
- }
- }
+ for (auto &qi : _queue.rev_iter())
+ if (qi->hContact == hContact)
+ mir_free(_queue.removeItem(&qi));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -99,12 +95,9 @@ void CContactQueue::RemoveAllConsiderParam(MCONTACT hContact, PVOID param) {
mir_cslock lck(_cs);
- auto T = _queue.rev_iter();
- for (auto &qi : T)
- if (qi->hContact == hContact && qi->param == param) {
- mir_free(qi);
- _queue.remove(T.indexOf(&qi));
- }
+ for (auto &qi : _queue.rev_iter())
+ if (qi->hContact == hContact && qi->param == param)
+ mir_free(_queue.removeItem(&qi));
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 4a1079b437..3df3681d85 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -332,7 +332,7 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam) (isUid && (it->flags & CI_UNIQUEID))) {
/* remove from cache */
mir_free(it->tszContact);
- arContactCache.remove(arContactCache.indexOf(&it));
+ arContactCache.removeItem(&it);
break;
}
}
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 43f569f7a3..10fe201ba1 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -120,7 +120,7 @@ void CDiscordProto::OnCommandCallDeleted(const JSONNode &pRoot) for (auto &call : arVoiceCalls.rev_iter()) if (call->channelId == channelId) { elapsed = currTime - call->startTime; - arVoiceCalls.remove(arVoiceCalls.indexOf(&call)); + arVoiceCalls.removeItem(&call); break; } @@ -257,11 +257,10 @@ void CDiscordProto::OnCommandGuildDeleted(const JSONNode &pRoot) if (pGuild == nullptr) return; - auto T = arUsers.rev_iter(); - for (auto &it : T) + for (auto &it : arUsers.rev_iter()) if (it->pGuild == pGuild) { Chat_Terminate(m_szModuleName, it->wszUsername, true); - arUsers.remove(T.indexOf(&it)); + arUsers.removeItem(&it); } Chat_Terminate(m_szModuleName, pRoot["name"].as_mstring(), true); diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp index 28ee2adb96..9b025c2376 100644 --- a/protocols/Facebook/src/server.cpp +++ b/protocols/Facebook/src/server.cpp @@ -576,8 +576,8 @@ void FacebookProto::OnPublishPrivateMessage(const JSONNode &root) if (m_uid == actorFbId) { for (auto& it : arOwnMessages) { if (it->msgId == offlineId) { - ProtoBroadcastAck(pUser->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) it->reqId, (LPARAM) szId.c_str()); - arOwnMessages.remove(arOwnMessages.indexOf(&it)); + ProtoBroadcastAck(pUser->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)it->reqId, (LPARAM)szId.c_str()); + arOwnMessages.removeItem(&it); break; } } @@ -789,7 +789,7 @@ void FacebookProto::OnPublishSentMessage(const JSONNode &root) } else ProtoBroadcastAck(pUser->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)it->reqId, (LPARAM)szId.c_str()); - arOwnMessages.remove(arOwnMessages.indexOf(&it)); + arOwnMessages.removeItem(&it); break; } } diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 49bd0e0a3d..42f6d66ee8 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2078,10 +2078,9 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage *pmsg) setWString(hContact, "Nick", nick);
// If user found, remove from checklist
- auto T = checklist.rev_iter();
- for (auto &it : T)
+ for (auto &it : checklist.rev_iter())
if (!mir_wstrcmpi(it->GetString(), nick))
- checklist.remove(T.indexOf(&it));
+ checklist.removeItem(&it);
}
}
break;
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index 2bd6ffd688..6d5a1a6a83 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -471,13 +471,13 @@ void CJabberInfoFrame::RemoveInfoItem(char *pszName) {
bool bUpdate = false;
size_t length = mir_strlen(pszName);
- auto T = m_pItems.rev_iter();
- for (auto &p : T) {
+
+ for (auto &p : m_pItems.rev_iter()) {
if (!strncmp(p->m_pszName, pszName, length)) {
if (!p->m_bShow)
--m_hiddenItemCount;
RemoveTooltip(p->m_tooltipId);
- m_pItems.remove(T.indexOf(&p));
+ m_pItems.removeItem(&p);
bUpdate = true;
}
}
diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp index fc1dfc5294..0b05136806 100644 --- a/protocols/JabberG/src/jabber_list.cpp +++ b/protocols/JabberG/src/jabber_list.cpp @@ -176,12 +176,9 @@ void CJabberProto::ListRemove(JABBER_LIST list, const char *jid) void CJabberProto::ListRemoveList(JABBER_LIST list)
{
mir_cslock lck(m_csLists);
- for (auto &it : m_lstRoster.rev_iter()) {
- if (it->list == list) {
- delete it;
- m_lstRoster.remove(m_lstRoster.indexOf(&it));
- }
- }
+ for (auto &it : m_lstRoster.rev_iter())
+ if (it->list == list)
+ delete m_lstRoster.removeItem(&it);
}
void CJabberProto::ListRemoveByIndex(int index)
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 4cbdab32b4..bb6c4c3e99 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -121,10 +121,9 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) }
// Remove contacts not on list (not tagged)
- auto T = info->mJoinedContacts.rev_iter();
- for (auto &it : T) {
+ for (auto &it : info->mJoinedContacts.rev_iter()) {
if (!it->btag)
- info->mJoinedContacts.remove(T.indexOf(&it));
+ info->mJoinedContacts.removeItem(&it);
else
it->btag = 0;
}
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 4fe0e82eb5..d8fa035b10 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -212,7 +212,7 @@ bool CVkProto::CheckMid(LIST<void> &lList, int guid) {
for (auto &it : lList)
if ((INT_PTR)it == guid) {
- lList.remove(lList.indexOf(&it));
+ lList.removeItem(&it);
return true;
}
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 1668e2959b..a5904b7b46 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -182,26 +182,23 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe }
}
- auto T = cc->m_users.rev_iter();
- for (auto &cu : T) {
+ for (auto &cu : cc->m_users.rev_iter()) {
if (!cu->m_bDel)
continue;
wchar_t wszId[20];
_itow(cu->m_uid, wszId, 10);
+ CMStringW wszNick(FORMAT, L"%s (%s)", cu->m_wszNick.get(), UserProfileUrl(cu->m_uid).c_str());
GCEVENT gce = { m_szModuleName, 0, GC_EVENT_PART };
gce.pszID.w = cc->m_wszId;
gce.pszUID.w = wszId;
gce.dwFlags = GCEF_NOTNOTIFY;
gce.time = time(0);
- gce.pszNick.w = mir_wstrdup(CMStringW(FORMAT, L"%s (%s)",
- cu->m_wszNick,
- UserProfileUrl(cu->m_uid).c_str()
- ));
+ gce.pszNick.w = wszNick;
Chat_Event(&gce);
- cc->m_users.remove(T.indexOf(&cu));
+ cc->m_users.removeItem(&cu);
}
}
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index 0604b5269d..35fbcac30a 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -32,11 +32,11 @@ static VOID CALLBACK MsgTimer(HWND, UINT, UINT_PTR, DWORD dwTime) LIST<TMsgQueue> arTimedOut(1);
{
mir_cslock lck(csMsgQueue);
- auto T = msgQueue.rev_iter();
- for (auto &it : T)
+
+ for (auto &it : msgQueue.rev_iter())
if (dwTime - it->ts > g_dat.msgTimeout) {
arTimedOut.insert(it);
- msgQueue.remove(T.indexOf(&it));
+ msgQueue.removeItem(&it);
}
}
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 52ea9dc7e9..dcb7d77f3c 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -383,7 +383,7 @@ public: m_tree.DeleteAllItems();
bRemoved = true;
}
- m_pages.remove(m_pages.indexOf(&odp));
+ m_pages.removeItem(&odp);
}
}
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index 0d3b3a8d24..b818058378 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -87,51 +87,51 @@ MIR_APP_DLL(void) KillModuleFonts(HPLUGIN pPlugin) {
for (auto &it : font_id_list.rev_iter())
if (it->pPlugin == pPlugin) {
- font_id_list.remove(font_id_list.indexOf(&it));
+ font_id_list.removeItem(&it);
notifyOptions();
}
for (auto &it : font_id_list_w2.rev_iter())
if (it->pPlugin == pPlugin)
- font_id_list_w2.remove(font_id_list_w2.indexOf(&it));
+ font_id_list_w2.removeItem(&it);
for (auto &it : font_id_list_w3.rev_iter())
if (it->pPlugin == pPlugin)
- font_id_list_w3.remove(font_id_list_w3.indexOf(&it));
+ font_id_list_w3.removeItem(&it);
}
MIR_APP_DLL(void) KillModuleColours(HPLUGIN pPlugin)
{
for (auto &it : colour_id_list.rev_iter())
if (it->pPlugin == pPlugin) {
- colour_id_list.remove(colour_id_list.indexOf(&it));
+ colour_id_list.removeItem(&it);
notifyOptions();
}
for (auto &it : colour_id_list_w2.rev_iter())
if (it->pPlugin == pPlugin)
- colour_id_list_w2.remove(colour_id_list_w2.indexOf(&it));
+ colour_id_list_w2.removeItem(&it);
for (auto &it : colour_id_list_w3.rev_iter())
if (it->pPlugin == pPlugin)
- colour_id_list_w3.remove(colour_id_list_w3.indexOf(&it));
+ colour_id_list_w3.removeItem(&it);
}
MIR_APP_DLL(void) KillModuleEffects(HPLUGIN pPlugin)
{
for (auto &it : effect_id_list.rev_iter())
if (it->pPlugin == pPlugin) {
- effect_id_list.remove(effect_id_list.indexOf(&it));
+ effect_id_list.removeItem(&it);
notifyOptions();
}
for (auto &it : effect_id_list_w2.rev_iter())
if (it->pPlugin == pPlugin)
- effect_id_list_w2.remove(effect_id_list_w2.indexOf(&it));
+ effect_id_list_w2.removeItem(&it);
for (auto &it : effect_id_list_w3.rev_iter())
if (it->pPlugin == pPlugin)
- effect_id_list_w3.remove(effect_id_list_w3.indexOf(&it));
+ effect_id_list_w3.removeItem(&it);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 381a1c5679..e1b1627741 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -211,7 +211,7 @@ int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, bool removeCon for (auto &si : T) {
if (si->iType != GCW_SERVER && !mir_strcmpi(si->pszModule, pszModule)) {
SM_FreeSession(si, removeContact);
- g_arSessions.remove(T.indexOf(&si));
+ g_arSessions.removeItem(&si);
}
}
return TRUE;
@@ -428,7 +428,7 @@ void SM_RemoveAll(void) {
for (auto &it : g_arSessions.rev_iter()) {
SM_FreeSession(it, false);
- g_arSessions.remove(g_arSessions.indexOf(&it));
+ g_arSessions.removeItem(&it);
}
}
@@ -821,7 +821,7 @@ static BOOL UM_RemoveUser(SESSION_INFO *si, const wchar_t *pszUID) if (!mir_wstrcmpi(ui->pszUID, pszUID)) {
mir_free(ui->pszNick);
mir_free(ui->pszUID);
- arUsers.remove(arUsers.indexOf(&ui));
+ arUsers.removeItem(&ui);
break;
}
}
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index 76a0ed70b8..51b6ecd4c0 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -239,7 +239,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) iGap++;
arByName.remove(it);
- arByIds.remove(arByIds.indexOf(&it));
+ arByIds.removeItem(&it);
}
for (auto &it : arByIds) {
diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp index 32c9107cf8..94b8777c60 100644 --- a/src/mir_app/src/ei_services.cpp +++ b/src/mir_app/src/ei_services.cpp @@ -193,11 +193,10 @@ MIR_APP_DLL(void) KillModuleExtraIcons(HPLUGIN pPlugin) { LIST<ExtraIcon> arIcons(1); - auto T = registeredExtraIcons.rev_iter(); - for (auto &it : T) + for (auto &it : registeredExtraIcons.rev_iter()) if (it->m_pPlugin == pPlugin) { arIcons.insert(it); - registeredExtraIcons.remove(T.indexOf(&it)); + registeredExtraIcons.removeItem(&it); } if (arIcons.getCount() == 0) diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp index ada51dcfea..c361d7c7ef 100644 --- a/src/mir_app/src/hotkey_opts.cpp +++ b/src/mir_app/src/hotkey_opts.cpp @@ -754,15 +754,10 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break; UnregisterHotkeys(); - { - auto T = hotkeys.rev_iter(); - for (auto &p : T) { - if (p->OptNew && p->OptDeleted || p->rootHotkey && !p->OptHotkey || (lpnmhdr->code == PSN_APPLY) && p->OptDeleted || (lpnmhdr->code == PSN_RESET) && p->OptNew) { - FreeHotkey(p); - hotkeys.remove(T.indexOf(&p)); - } - } - } + + for (auto &p : hotkeys.rev_iter()) + if (p->OptNew && p->OptDeleted || p->rootHotkey && !p->OptHotkey || (lpnmhdr->code == PSN_APPLY) && p->OptDeleted || (lpnmhdr->code == PSN_RESET) && p->OptNew) + FreeHotkey(hotkeys.removeItem(&p)); if (lpnmhdr->code == PSN_APPLY) { LVITEM lvi = { 0 }; diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index 7d7490e0c2..981dee4105 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -220,12 +220,9 @@ MIR_APP_DLL(int) Hotkey_Unregister(const char *pszName) if (g_hwndHkOptions)
SendMessage(g_hwndHkOptions, WM_HOTKEYUNREGISTERED, 0, 0);
- auto T = hotkeys.rev_iter();
- for (auto &it : T)
- if (it->UnregisterHotkey) {
- FreeHotkey(it);
- hotkeys.remove(T.indexOf(&it));
- }
+ for (auto &it : hotkeys.rev_iter())
+ if (it->UnregisterHotkey)
+ FreeHotkey(hotkeys.removeItem(&it));
return 0;
}
@@ -288,12 +285,9 @@ void RegisterHotkeys() MIR_APP_DLL(void) KillModuleHotkeys(HPLUGIN pPlugin)
{
- auto T = hotkeys.rev_iter();
- for (auto &it : T)
- if (it->pPlugin == pPlugin) {
- FreeHotkey(it);
- hotkeys.remove(T.indexOf(&it));
- }
+ for (auto &it : hotkeys.rev_iter())
+ if (it->pPlugin == pPlugin)
+ FreeHotkey(hotkeys.removeItem(&it));
}
void UnregisterHotkeys()
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index 308961343e..54452dc550 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -613,12 +613,9 @@ MIR_APP_DLL(void) KillModuleIcons(HPLUGIN pPlugin) return;
mir_cslock lck(csIconList);
- auto T = iconList.rev_iter();
- for (auto &it : T)
- if (it->pPlugin == pPlugin) {
- delete it;
- iconList.remove(T.indexOf(&it));
- }
+ for (auto &it : iconList.rev_iter())
+ if (it->pPlugin == pPlugin)
+ delete iconList.removeItem(&it);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp index fa91049dca..e3fe8d0f3c 100644 --- a/src/mir_app/src/proto_accs.cpp +++ b/src/mir_app/src/proto_accs.cpp @@ -373,7 +373,7 @@ void KillModuleAccounts(HINSTANCE hInst) } } - g_arProtos.remove(g_arProtos.indexOf(&pd)); + g_arProtos.removeItem(&pd); } } @@ -418,7 +418,7 @@ void UnloadAccountsModule() auto T = accounts.rev_iter(); for (auto &it : T) { UnloadAccount(it, 0); - accounts.remove(T.indexOf(&it)); + accounts.removeItem(&it); } accounts.destroy(); diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index 9eb1937d3e..64d7a58a6f 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -371,7 +371,7 @@ MIR_APP_DLL(void) KillModuleSounds(HPLUGIN pPlugin) auto T = arSounds.rev_iter();
for (auto &it : T)
if (it->pPlugin == pPlugin) {
- arSounds.remove(T.indexOf(&it));
+ arSounds.removeItem(&it);
bFound = true;
}
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp index 3f17e76e0e..bfb9bc3ee6 100644 --- a/src/mir_app/src/srmm_statusicon.cpp +++ b/src/mir_app/src/srmm_statusicon.cpp @@ -256,10 +256,9 @@ MIR_APP_DLL(void) Srmm_ClickStatusIcon(MCONTACT hContact, const StatusIconClickD void KillModuleSrmmIcons(HPLUGIN pPlugin)
{
- auto T = arIcons.rev_iter();
- for (auto &it : T)
+ for (auto &it : arIcons.rev_iter())
if (it->pPlugin == pPlugin)
- arIcons.remove(T.indexOf(&it));
+ arIcons.removeItem(&it);
}
int LoadSrmmModule()
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 33d10bbd28..5aa899f31b 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -222,12 +222,9 @@ MIR_APP_DLL(int) Srmm_RemoveButton(BBButton *bbdi) { mir_cslock lck(csToolBar); - auto T = arButtonsList.rev_iter(); - for (auto &cbd : T) - if (!mir_strcmp(cbd->m_pszModuleName, bbdi->pszModuleName) && cbd->m_dwButtonID == bbdi->dwButtonID) { - pFound = cbd; - arButtonsList.remove(T.indexOf(&cbd)); - } + for (auto &cbd : arButtonsList.rev_iter()) + if (!mir_strcmp(cbd->m_pszModuleName, bbdi->pszModuleName) && cbd->m_dwButtonID == bbdi->dwButtonID) + pFound = arButtonsList.removeItem(&cbd); } if (pFound) { @@ -425,15 +422,14 @@ MIR_APP_DLL(void) Srmm_RedrawToolbarIcons(HWND hwndDlg) static void CB_ReInitCustomButtons() { - auto T = arButtonsList.rev_iter(); - for (auto &cbd : T) { + for (auto &cbd : arButtonsList.rev_iter()) if (cbd->m_opFlags & (BBSF_NTBSWAPED | BBSF_NTBDESTRUCT)) { cbd->m_opFlags ^= BBSF_NTBSWAPED; if (cbd->m_opFlags & BBSF_NTBDESTRUCT) - arButtonsList.remove(T.indexOf(&cbd)); + arButtonsList.removeItem(&cbd); } - } + qsort(arButtonsList.getArray(), arButtonsList.getCount(), sizeof(void*), sstSortButtons); WindowList_Broadcast(g_hWindowList, WM_CBD_RECREATE, 0, 0); @@ -791,10 +787,8 @@ void KillModuleToolbarIcons(HPLUGIN pPlugin) { auto T = arButtonsList.rev_iter(); for (auto &cbd : T) - if (cbd->m_pPlugin == pPlugin) { - delete cbd; - arButtonsList.remove(T.indexOf(&cbd)); - } + if (cbd->m_pPlugin == pPlugin) + delete arButtonsList.removeItem(&cbd); } static INT_PTR BroadcastMessage(WPARAM, LPARAM lParam) diff --git a/src/mir_app/src/usedIcons.cpp b/src/mir_app/src/usedIcons.cpp index b904a091bd..5673637c1a 100644 --- a/src/mir_app/src/usedIcons.cpp +++ b/src/mir_app/src/usedIcons.cpp @@ -84,10 +84,9 @@ void RemoveIcon(const char *icolibName) void ResetIcons()
{
- auto T = usedIcons.rev_iter();
- for (auto &it : T) {
+ for (auto &it : usedIcons.rev_iter()) {
if (it->refCount <= 0)
- usedIcons.remove(T.indexOf(&it));
+ usedIcons.removeItem(&it);
else
it->hImage = INVALID_HANDLE_VALUE;
}
diff --git a/src/mir_core/src/threads.cpp b/src/mir_core/src/threads.cpp index ad14b1cc9f..27e33dfa90 100644 --- a/src/mir_core/src/threads.cpp +++ b/src/mir_core/src/threads.cpp @@ -239,7 +239,7 @@ static void __cdecl KillObjectThreadsWorker(void* owner) TerminateThread(it->hThread, 9999);
CloseHandle(it->hThread);
mir_free(it);
- threads.remove(T.indexOf(&it));
+ threads.removeItem(&it);
}
}
}
|