summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-07 20:15:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-07 20:15:59 +0000
commit6c61dc812b9a5382c282f3e61111516fff562c0e (patch)
tree3308c3bb4734663bf28c8c0cf438ea7f6d4b49fa
parent20fa18c158baf0c336c1efe655899943a916ce77 (diff)
fix for potentially endless loops
git-svn-id: http://svn.miranda-ng.org/main/trunk@11789 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Scriver/src/msgs.cpp4
-rw-r--r--plugins/TabSRMM/src/globals.cpp4
-rw-r--r--protocols/JabberG/src/jabber_rc.cpp2
-rw-r--r--src/core/stdfile/src/file.cpp2
4 files changed, 4 insertions, 8 deletions
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 335446a8b4..70db6ee54e 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -263,8 +263,7 @@ static void RestoreUnreadMessageAlerts(void)
cle.ptszTooltip = toolTip;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- HANDLE hDbEvent = db_event_firstUnread(hContact);
- while (hDbEvent) {
+ for (HANDLE hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
dbei.cbBlob = 0;
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && DbEventIsMessageOrCustom(&dbei)) {
@@ -286,7 +285,6 @@ static void RestoreUnreadMessageAlerts(void)
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
}
- hDbEvent = db_event_next(hContact, hDbEvent);
}
}
}
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 7debe97ca5..ccc83a7940 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -551,8 +551,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void)
if (db_get_dw(hContact, "SendLater", "count", 0))
sendLater->addContact(hContact);
- HANDLE hDbEvent = db_event_firstUnread(hContact);
- while (hDbEvent) {
+ for (HANDLE hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
if (!dbei.markedRead() && dbei.eventType == EVENTTYPE_MESSAGE) {
@@ -567,7 +566,6 @@ void CGlobals::RestoreUnreadMessageAlerts(void)
cle.ptszTooltip = toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
- hDbEvent = db_event_next(hContact, hDbEvent);
}
}
}
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp
index 8d042cbdc5..5c96401afb 100644
--- a/protocols/JabberG/src/jabber_rc.cpp
+++ b/protocols/JabberG/src/jabber_rc.cpp
@@ -563,7 +563,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
mir_ptr<BYTE> pEventBuf((PBYTE)mir_alloc(dbei.cbBlob + 1));
dbei.pBlob = pEventBuf;
- if ( db_event_get(hDbEvent, &dbei))
+ if (db_event_get(hDbEvent, &dbei))
continue;
if (dbei.eventType != EVENTTYPE_MESSAGE || (dbei.flags & (DBEF_READ | DBEF_SENT)))
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index 950f018141..0363ebc851 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -291,7 +291,7 @@ static void RemoveUnreadFileEvents(void)
while (hDbEvent) {
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
- if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
+ if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
db_event_markRead(hContact, hDbEvent);
hDbEvent = db_event_next(hContact, hDbEvent);
}