summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/contact.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-17 22:11:51 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-17 22:11:59 +0300
commit3ad5334f17119c9ae010d5059f5cfb1831c9ddbd (patch)
tree1d76618499baee7cf217c97dfe2045b467d20a0a /plugins/Variables/src/contact.cpp
parentf632783f27da5dd0ed3513bbee6182ea8af30afe (diff)
more warning fixes
Diffstat (limited to 'plugins/Variables/src/contact.cpp')
-rw-r--r--plugins/Variables/src/contact.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 9e40bc71dd..52ecf66950 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -194,8 +194,8 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
// contact was not in cache, do a search
CMStringW tmp;
int count = 0;
- MCONTACT hContact;
LIST<void> arResults(1);
+ MCONTACT hMatch = 0;
for (auto &hContact : Contacts()) {
// <_HANDLE_:hContact>
@@ -268,8 +268,10 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
if (bMatch) {
if (nMatch == -1)
arResults.insert((HANDLE)hContact);
- else if (nMatch == count)
+ else if (nMatch == count) {
+ hMatch = hContact;
break;
+ }
count++;
}
}
@@ -277,7 +279,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
if (bReturnCount)
return count;
- if (hContact == 0)
+ if (hMatch == 0)
return INVALID_CONTACT_ID;
// return random contact
@@ -289,13 +291,13 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
mir_cslock lck(csContactCache);
CONTACTCE *cce = new CONTACTCE();
- cce->hContact = hContact;
+ cce->hContact = hMatch;
cce->flags = dwFlags;
cce->tszContact = mir_wstrdup(tszContact);
arContactCache.insert(cce);
}
- return hContact;
+ return hMatch;
}
/* keep cache consistent */