summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/NewsAggregator/Src/Utils.cpp12
-rw-r--r--plugins/Quotes/src/ImportExport.cpp6
-rw-r--r--plugins/SimpleStatusMsg/src/main.cpp11
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp3
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp8
-rw-r--r--plugins/Variables/src/contact.cpp12
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp6
-rw-r--r--protocols/IcqOscarJ/src/icq_servlist.cpp1
-rw-r--r--protocols/IcqOscarJ/src/icq_uploadui.cpp2
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp18
-rw-r--r--protocols/MRA/src/Mra_functions.cpp12
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp6
13 files changed, 47 insertions, 53 deletions
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp
index 4eff01b870..56a5a99182 100644
--- a/plugins/NewsAggregator/Src/Utils.cpp
+++ b/plugins/NewsAggregator/Src/Utils.cpp
@@ -429,24 +429,20 @@ LPCTSTR ClearText(CMStringW &result, const wchar_t *message)
MCONTACT GetContactByNick(const wchar_t *nick)
{
- MCONTACT hContact = NULL;
-
for (auto &hContact : Contacts(MODULE)) {
ptrW contactNick(::db_get_wsa(hContact, MODULE, "Nick"));
if (!mir_wstrcmpi(contactNick, nick))
- break;
+ return hContact;
}
- return hContact;
+ return 0;
}
MCONTACT GetContactByURL(const wchar_t *url)
{
- MCONTACT hContact = NULL;
-
for (auto &hContact : Contacts(MODULE)) {
ptrW contactURL(::db_get_wsa(hContact, MODULE, "URL"));
if (!mir_wstrcmpi(contactURL, url))
- break;
+ return hContact;
}
- return hContact;
+ return 0;
}
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp
index 081023b6a2..b68cc67103 100644
--- a/plugins/Quotes/src/ImportExport.cpp
+++ b/plugins/Quotes/src/ImportExport.cpp
@@ -222,10 +222,10 @@ INT_PTR Quotes_Export(WPARAM wp, LPARAM lp)
}
}
else {
- for (auto &hContact : Contacts(QUOTES_MODULE_NAME)) {
- CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
+ for (auto &cc : Contacts(QUOTES_MODULE_NAME)) {
+ CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(cc);
if (pProvider) {
- IXMLNode::TXMLNodePtr pNode = export_contact(hContact, pXmlEngine);
+ IXMLNode::TXMLNodePtr pNode = export_contact(cc, pXmlEngine);
if (pNode)
pRoot->AddChild(pNode);
}
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp
index c373c84401..0a9807348d 100644
--- a/plugins/SimpleStatusMsg/src/main.cpp
+++ b/plugins/SimpleStatusMsg/src/main.cpp
@@ -1614,16 +1614,15 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam)
return 0;
char *szProto = (char *)lMirParam;
- BOOL bContactFound = FALSE;
- MCONTACT hContact;
+ MCONTACT hContact = 0;
- for (auto &hContact : Contacts()) {
- if (db_get_dw(hContact, szProto, "UIN", 0) == (DWORD)lParam) {
- bContactFound = TRUE;
+ for (auto &cc : Contacts()) {
+ if (db_get_dw(cc, szProto, "UIN", 0) == (DWORD)lParam) {
+ hContact = cc;
break;
}
}
- if (!bContactFound)
+ if (!hContact)
return 0;
int iStatus = ICQMsgTypeToStatus(wParam);
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index 78466a2838..a27b0c6190 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -452,8 +452,7 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam
LPGENW("This will delete all settings, you've made!\nAll TreeView settings, window positions and any other settings!\n\nAre you sure to proceed?"));
if (WantReset) {
- MCONTACT hContact;
- DB::CEnumList Settings;
+ DB::CEnumList Settings;
// delete all skin icons
if (!Settings.EnumSettings(NULL, "SkinIcons"))
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index c1e60e7531..b76227f7de 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -726,10 +726,10 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam)
else {
WORD a1 = 0;
- //walk through all the contacts stored in the DB
- for (auto &hContact : Contacts())
- if (!db_mc_isSub(hContact) && !mdb.DBGetBirthDate(hContact))
- mdb.BackupBirthday(hContact, nullptr, TRUE, &a1);
+ // walk through all the contacts stored in the DB
+ for (auto &cc : Contacts())
+ if (!db_mc_isSub(cc) && !mdb.DBGetBirthDate(cc))
+ mdb.BackupBirthday(cc, nullptr, TRUE, &a1);
}
if (lParam != TRUE) {
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 */
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index fdf025c619..f34e9b2e60 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -23,6 +23,8 @@
#include <errno.h>
#include <io.h>
+#pragma warning(disable : 4189)
+
////////////////////////////////////////////////////////////
// Swap bits in DWORD
uint32_t swap32(uint32_t x)
@@ -1433,7 +1435,6 @@ void GaduProto::notifyuser(MCONTACT hContact, int refresh)
void GaduProto::notifyall()
{
- MCONTACT hContact;
debugLogA("notifyall(): Subscribing notification to all users");
// Readup count
int count = 0;
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index cfe7942297..caa854ff6a 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -128,8 +128,6 @@ char *oauth_generate_signature(LIST<OAUTHPARAMETER> &params, const char *httpmet
char *oauth_getparam(LIST<OAUTHPARAMETER> &params, const char *name)
{
- OAUTHPARAMETER *p;
-
if (name == nullptr)
return nullptr;
@@ -142,8 +140,6 @@ char *oauth_getparam(LIST<OAUTHPARAMETER> &params, const char *name)
void oauth_setparam(LIST<OAUTHPARAMETER> &params, const char *name, const char *value)
{
- OAUTHPARAMETER *p;
-
if (name == nullptr)
return;
@@ -154,7 +150,7 @@ void oauth_setparam(LIST<OAUTHPARAMETER> &params, const char *name, const char *
return;
}
- p = (OAUTHPARAMETER*)mir_alloc(sizeof(OAUTHPARAMETER));
+ OAUTHPARAMETER *p = (OAUTHPARAMETER*)mir_alloc(sizeof(OAUTHPARAMETER));
p->name = oauth_uri_escape(name);
p->value = oauth_uri_escape(value);
params.insert(p);
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp
index f1d17036ef..b3c613d017 100644
--- a/protocols/IcqOscarJ/src/icq_servlist.cpp
+++ b/protocols/IcqOscarJ/src/icq_servlist.cpp
@@ -1194,7 +1194,6 @@ void* CIcqProto::collectBuddyGroup(WORD wGroupID, int *count)
{
WORD* buf = nullptr;
int cnt = 0;
- MCONTACT hContact;
WORD wItemID;
for (auto &hContact : AccContacts()) {
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp
index 1a6cd6c4c6..7fbdeca635 100644
--- a/protocols/IcqOscarJ/src/icq_uploadui.cpp
+++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp
@@ -226,7 +226,6 @@ static char* getServerResultDesc(int wCode)
static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- MCONTACT hContact;
static int working;
static HANDLE hProtoAckHook;
@@ -468,6 +467,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa
case STATE_ITEMS:
// Iterate over all contacts until one is found that
// needs to be updated on the server
+ MCONTACT hContact;
if (hCurrentContact == NULL)
hContact = db_find_first(ppro->m_szModuleName);
else { // we do not want to go thru all contacts over and over again
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index 399ecf503b..81c08d073e 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -413,9 +413,9 @@ MCONTACT CIcqProto::HContactFromUIN(DWORD dwUin, int *Added)
if (Added)
*Added = 0;
- MCONTACT hContact = HandleFromCacheByUid(dwUin, nullptr);
- if (hContact)
- return hContact;
+ MCONTACT cc = HandleFromCacheByUid(dwUin, nullptr);
+ if (cc)
+ return cc;
for (auto &hContact : AccContacts()) {
DWORD dwContactUin = getContactUin(hContact);
@@ -429,7 +429,7 @@ MCONTACT CIcqProto::HContactFromUIN(DWORD dwUin, int *Added)
if (Added) {
debugLogA("Attempt to create ICQ contact %u", dwUin);
- hContact = db_add_contact();
+ MCONTACT hContact = db_add_contact();
if (!hContact) {
debugLogA("Failed to create ICQ contact %u", dwUin);
return INVALID_CONTACT_ID;
@@ -476,9 +476,9 @@ MCONTACT CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added)
if (Added)
*Added = 0;
- MCONTACT hContact = HandleFromCacheByUid(dwUin, szUid);
- if (hContact)
- return hContact;
+ MCONTACT cc = HandleFromCacheByUid(dwUin, szUid);
+ if (cc)
+ return cc;
for (auto &hContact : AccContacts()) {
DWORD dwContactUin;
@@ -493,11 +493,11 @@ MCONTACT CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added)
}
}
- //not present: add
+ // not present: add
if (Added) {
debugLogA("Attempt to create ICQ contact by string <%s>", szUid);
- hContact = db_add_contact();
+ MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
setString(hContact, UNIQUEIDSETTING, szUid);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 70e1ed567d..0de82591be 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -508,16 +508,18 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe
MCONTACT hContact = NULL;
bool bFound = false;
- //check not already on list
+ // check not already on list
CMStringA szEMailLocal;
- for (auto &hContact : AccContacts()) {
- if (mraGetStringA(hContact, "e-mail", szEMailLocal))
+ for (auto &cc : AccContacts()) {
+ if (mraGetStringA(cc, "e-mail", szEMailLocal)) {
if (szEMailLocal == szEmail) {
if (bTemporary == FALSE)
- db_unset(hContact, "CList", "NotOnList");
+ db_unset(cc, "CList", "NotOnList");
+ hContact = cc;
bFound = true;
break;
}
+ }
}
if (!bFound && bAddIfNeeded) {
@@ -549,7 +551,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe
}
if (pbAdded)
- *pbAdded = (bFound == FALSE && bAddIfNeeded && hContact);
+ *pbAdded = (bFound == false && bAddIfNeeded && hContact);
return hContact;
}
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index 3a9c065b6d..0a4d0aa464 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -599,7 +599,6 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
return;
}
- MCONTACT hContact;
LIST<void> arContacts(10, PtrKeySortT);
for (auto &hContact : AccContacts())
@@ -607,7 +606,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
arContacts.insert((HANDLE)hContact);
for (auto &it : jnUsers) {
- hContact = SetContactInfo(it);
+ MCONTACT hContact = SetContactInfo(it);
if (hContact)
arContacts.remove((HANDLE)hContact);
}
@@ -646,7 +645,8 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
LONG userid = it.as_int();
if (userid == 0)
break;
- hContact = FindUser(userid, true);
+
+ MCONTACT hContact = FindUser(userid, true);
if (!getBool(hContact, "ReqAuth")) {
RetrieveUserInfo(userid);
setByte(hContact, "ReqAuth", 1);