From 999d22f6c3c618cde52097547e53703664d7e665 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 20 Jan 2020 19:32:28 +0300 Subject: db_event_delete: unused parameter removed --- plugins/Db3x_mmap/src/dbevents.cpp | 19 +++++++++++-------- plugins/Db3x_mmap/src/dbintf.h | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'plugins/Db3x_mmap/src') 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; -- cgit v1.2.3