summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-01-20 19:32:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-01-20 19:32:28 +0300
commit999d22f6c3c618cde52097547e53703664d7e665 (patch)
tree651589d4660b8346729c12f0bea93d0570fba1e3 /plugins/Db3x_mmap/src
parent601ec263ad0887d7a8a090badc3c77cfcb24f0d5 (diff)
db_event_delete: unused parameter removed
Diffstat (limited to 'plugins/Db3x_mmap/src')
-rw-r--r--plugins/Db3x_mmap/src/dbevents.cpp19
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h2
2 files changed, 12 insertions, 9 deletions
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp
index 22716614ee..ba17be694e 100644
--- a/plugins/Db3x_mmap/src/dbevents.cpp
+++ b/plugins/Db3x_mmap/src/dbevents.cpp
@@ -162,11 +162,16 @@ MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
return (MEVENT)ofsNew;
}
-BOOL CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
+BOOL CDb3Mmap::DeleteEvent(MEVENT hDbEvent)
{
+ mir_cslockfull lck(m_csDbAccess);
+ DBEvent dbe = *(DBEvent*)DBRead((DWORD)hDbEvent, nullptr);
+ if (dbe.signature != DBEVENT_SIGNATURE)
+ return 1;
+
DBCachedContact *cc;
- if (contactID) {
- if ((cc = m_cache->GetCachedContact(contactID)) == nullptr)
+ if (dbe.contactID) {
+ if ((cc = m_cache->GetCachedContact(dbe.contactID)) == nullptr)
return 2;
if (cc->IsSub())
if ((cc = m_cache->GetCachedContact(cc->parentID)) == nullptr)
@@ -174,18 +179,16 @@ BOOL CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
}
else cc = nullptr;
- mir_cslockfull lck(m_csDbAccess);
DWORD ofsContact = (cc) ? cc->dwOfsContact : m_dbHeader.ofsUser;
- DBContact dbc = *(DBContact*)DBRead(ofsContact, nullptr);
- DBEvent dbe = *(DBEvent*)DBRead((DWORD)hDbEvent, nullptr);
- if (dbc.signature != DBCONTACT_SIGNATURE || dbe.signature != DBEVENT_SIGNATURE)
+ DBContact dbc = *(DBContact *)DBRead(ofsContact, nullptr);
+ if (dbc.signature != DBCONTACT_SIGNATURE)
return 1;
lck.unlock();
log1("delete event @ %08x", hContact);
// call notifier while outside mutex
- NotifyEventHooks(g_hevEventDeleted, contactID, (LPARAM)hDbEvent);
+ NotifyEventHooks(g_hevEventDeleted, dbe.contactID, (LPARAM)hDbEvent);
// get back in
lck.lock();
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h
index 26d3a4931b..bdbcbeac0c 100644
--- a/plugins/Db3x_mmap/src/dbintf.h
+++ b/plugins/Db3x_mmap/src/dbintf.h
@@ -219,7 +219,7 @@ public:
STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override;
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override;
- STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) override;
+ STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;