From 3ad5334f17119c9ae010d5059f5cfb1831c9ddbd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 17 Mar 2018 22:11:51 +0300 Subject: more warning fixes --- plugins/Variables/src/contact.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'plugins/Variables/src') 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 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 */ -- cgit v1.2.3