summaryrefslogtreecommitdiff
path: root/plugins/IEView/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-06-05 17:50:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-06-05 17:50:34 +0300
commitd7c9eb34f80f207efd47d2fc65e31aedf166c323 (patch)
tree338b9b905674dc31b1efab739dfcedeed3d8d7b3 /plugins/IEView/src
parentffc5a3d7550528281976745279e77ac9faba551b (diff)
major code cleaning in regard to db_event_getBlobSize & event memory allocation
Diffstat (limited to 'plugins/IEView/src')
-rw-r--r--plugins/IEView/src/HTMLBuilder.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp
index a0ad5d7528..fcbd404f80 100644
--- a/plugins/IEView/src/HTMLBuilder.cpp
+++ b/plugins/IEView/src/HTMLBuilder.cpp
@@ -198,21 +198,19 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
newEvent.hwnd = event->hwnd;
for (int eventIdx = 0; hDbEvent != NULL && (eventIdx < event->count || event->count == -1); eventIdx++) {
- DBEVENTINFO dbei = {};
- dbei.cbBlob = db_event_getBlobSize(hDbEvent);
- if (dbei.cbBlob == 0xFFFFFFFF) {
+ DB::EventInfo dbei;
+ dbei.cbBlob = -1;
+ if (db_event_get(hDbEvent, &dbei)) {
hDbEvent = db_event_next(event->hContact, hDbEvent);
continue;
}
- dbei.pBlob = (PBYTE)malloc(dbei.cbBlob);
- db_event_get(hDbEvent, &dbei);
+
if (!(dbei.flags & DBEF_SENT) && dbei.eventType == EVENTTYPE_MESSAGE) {
db_event_markRead(event->hContact, hDbEvent);
g_clistApi.pfnRemoveEvent(event->hContact, hDbEvent);
}
if (!isDbEventShown(&dbei)) {
- free(dbei.pBlob);
hDbEvent = db_event_next(event->hContact, hDbEvent);
continue;
}
@@ -265,7 +263,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
eventData->szText.w = DbEvent_GetTextW(&dbei, newEvent.codepage);
eventData->iType = IEED_EVENT_MESSAGE;
}
- free(dbei.pBlob);
+
eventData->next = nullptr;
if (prevEventData != nullptr)
prevEventData->next = eventData;