diff options
author | George Hazan <george.hazan@gmail.com> | 2013-05-09 11:32:53 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-05-09 11:32:53 +0000 |
commit | 2ec975899563178477a9fdf54b821ff7eab027e1 (patch) | |
tree | 90e7602f4401dfa959f734b8b056b2b775444e31 /protocols | |
parent | 00145f285b89e19f3bf03b73f9fe10974240b48f (diff) |
fix for the endless loop + code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4606 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Skype/src/skype_database.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
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)
|