diff options
-rw-r--r-- | include/m_system.h | 9 | ||||
-rw-r--r-- | plugins/VoiceService/src/services.cpp | 3 | ||||
-rw-r--r-- | protocols/Telegram/src/avatars.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/signal.cpp | 2 | ||||
-rw-r--r-- | src/core/stdfile/src/ftmanager.cpp | 2 | ||||
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 3 | ||||
-rw-r--r-- | src/mir_app/src/popupOption.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/src/db.cpp | 10 |
8 files changed, 20 insertions, 13 deletions
diff --git a/include/m_system.h b/include/m_system.h index 2c00e048f2..2d36a47bcd 100644 --- a/include/m_system.h +++ b/include/m_system.h @@ -389,7 +389,7 @@ template<class T> struct OBJLIST : public LIST<T> List_ObjCopy((SortedList *)&x, (SortedList *)this, sizeof(T));
}
- __inline OBJLIST &operator = (const OBJLIST &x)
+ __inline OBJLIST& operator=(const OBJLIST &x)
{
destroy();
List_ObjCopy((SortedList *)&x, (SortedList *)this, sizeof(T));
@@ -425,7 +425,12 @@ template<class T> struct OBJLIST : public LIST<T> return 0;
}
- __inline T &operator[](int idx) const { return *this->items[idx]; }
+ __inline void removeItem(T **p)
+ {
+ remove(int(p - items));
+ }
+
+ __inline T& operator[](int idx) const { return *this->items[idx]; }
};
#define __A2W(s) L ## s
diff --git a/plugins/VoiceService/src/services.cpp b/plugins/VoiceService/src/services.cpp index 410cb0f171..68a26cd1d1 100644 --- a/plugins/VoiceService/src/services.cpp +++ b/plugins/VoiceService/src/services.cpp @@ -64,8 +64,7 @@ INT_PTR VoiceUnregister(WPARAM wParam, LPARAM) if (call->module == module) { call->Drop(); call->SetState(VOICE_STATE_ENDED); - - calls.remove(calls.indexOf(&call)); + calls.removeItem(&call); } modules.remove(module); diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index 225dcee0e2..d3d8cf2d1d 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -101,7 +101,7 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj) SMADD_CONT cont = {1, m_szModuleName, it->m_destPath};
CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
}
- m_arFiles.remove(m_arFiles.indexOf(&it));
+ m_arFiles.removeItem(&it);
return;
}
}
diff --git a/protocols/WhatsApp/src/signal.cpp b/protocols/WhatsApp/src/signal.cpp index d8a57b0222..7e147de11a 100644 --- a/protocols/WhatsApp/src/signal.cpp +++ b/protocols/WhatsApp/src/signal.cpp @@ -123,7 +123,7 @@ static int delete_all_sessions_func(const char *name, size_t name_len, void *use for (auto &it : pList.rev_iter()) {
if (it->hasAddress(name, name_len)) {
pStore->pProto->delSetting(it->getSetting());
- pList.remove(pList.indexOf(&it));
+ pList.removeItem(&it);
count++;
}
}
diff --git a/src/core/stdfile/src/ftmanager.cpp b/src/core/stdfile/src/ftmanager.cpp index 56b0a168a7..10f4215c63 100644 --- a/src/core/stdfile/src/ftmanager.cpp +++ b/src/core/stdfile/src/ftmanager.cpp @@ -143,7 +143,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_FT_REMOVE:
for (auto &it : dat->arWindows)
if (it->hwnd == (HWND)lParam) {
- dat->arWindows.remove(dat->arWindows.indexOf(&it));
+ dat->arWindows.removeItem(&it);
break;
}
LayoutTransfers(hwnd, dat);
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 30792d9244..96d15c8805 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -122,8 +122,7 @@ class CUserInfoDlg : public CDlgBase if (!it->pDialog->IsEmpty())
continue;
- delete it;
- items.remove(items.indexOf(&it));
+ delete items.removeItem(&it);
}
if (items.getCount() == 0)
diff --git a/src/mir_app/src/popupOption.cpp b/src/mir_app/src/popupOption.cpp index 4ac5290c6d..a2b2f9a60a 100644 --- a/src/mir_app/src/popupOption.cpp +++ b/src/mir_app/src/popupOption.cpp @@ -64,7 +64,7 @@ void KillModulePopups(CMPluginBase *pPlugin) {
for (auto &it : g_arOptions.rev_iter())
if (it->m_plugin == pPlugin)
- g_arOptions.remove(g_arOptions.indexOf(&it));
+ g_arOptions.removeItem(&it);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 63afe4d66b..737fdd84b9 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -443,14 +443,18 @@ MIR_CORE_DLL(MEVENT) db_event_last(MCONTACT hContact) MIR_CORE_DLL(int) db_event_markRead(MCONTACT hContact, MEVENT hDbEvent, bool bFromServer)
{
if (g_pCurrDb == nullptr)
- return 0;
+ return 1;
if (!g_pCurrDb->MarkEventRead(hContact, hDbEvent))
- return 0;
+ return 1;
if (!bFromServer)
- if (auto *ppro = Proto_GetInstance(hContact))
+ if (auto *ppro = Proto_GetInstance(hContact)) {
ppro->OnMarkRead(hContact, hDbEvent);
+ return 0;
+ }
+
+ return 1;
}
MIR_CORE_DLL(MEVENT) db_event_next(MCONTACT hContact, MEVENT hDbEvent)
|