From df6b0c988eb26339d4c7e4a1d0fe3b9717703c28 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 9 Mar 2018 19:32:32 +0300 Subject: more loop-related code cleaning --- protocols/VKontakte/src/misc.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index c8479c6911..551ac57da7 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -519,14 +519,15 @@ void CVkProto::GrabCookies(NETLIBHTTPREQUEST *nhr) } if (!szCookieName.IsEmpty() && !szDomain.IsEmpty()) { - int k; - for (k = 0; k < m_cookies.getCount(); k++) { - if (m_cookies[k].m_name == szCookieName) { - m_cookies[k].m_value = szCookieVal; + bool bFound = false; + for (auto &it : m_cookies) + if (it->m_name == szCookieName) { + bFound = true; + it->m_value = szCookieVal; break; } - } - if (k == m_cookies.getCount()) + + if (!bFound) m_cookies.insert(new CVkCookie(szCookieName, szCookieVal, szDomain)); } } -- cgit v1.2.3