From 2ec975899563178477a9fdf54b821ff7eab027e1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 9 May 2013 11:32:53 +0000 Subject: fix for the endless loop + code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4606 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_database.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'protocols') diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index 43fb9383d9..bbc11cb385 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -2,10 +2,7 @@ bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, SEBinary &guid, int flag) { - bool result = false; - - HANDLE hDbEvent = ::db_event_last(hContact); - while (hDbEvent) + for (HANDLE hDbEvent = ::db_event_last(hContact); hDbEvent; hDbEvent = ::db_event_prev(hDbEvent)) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = ::db_event_getBlobSize(hDbEvent); @@ -21,18 +18,11 @@ bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, SEBinary &guid int sendFlag = dbei.flags & DBEF_SENT; if (dbei.eventType == EVENTTYPE_MESSAGE && sendFlag == flag) - { if (::memcmp(&dbei.pBlob[dbei.cbBlob - 32], guid.data(), guid.size()) == 0) - { - result = true; - break; - } - } - - hDbEvent = ::db_event_prev(hDbEvent); + return true; } - return result; + return false; } HANDLE CSkypeProto::AddDBEvent(HANDLE hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) -- cgit v1.2.3