diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-09 19:32:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-09 19:32:39 +0300 |
commit | df6b0c988eb26339d4c7e4a1d0fe3b9717703c28 (patch) | |
tree | 5b4960edd6c9186e1fbc14f83f7f08a6a842f0a7 /protocols/JabberG/src/jabber_search.cpp | |
parent | 303dd9297732fc943ed3e20ab37587f0c009dfe5 (diff) |
more loop-related code cleaning
Diffstat (limited to 'protocols/JabberG/src/jabber_search.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_search.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index e325fad9fe..d0dfcfcbe3 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -209,12 +209,10 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M { LIST<wchar_t> ListOfNonEmptyFields(20, (LIST<wchar_t>::FTSortFunc)TCharKeyCmp); LIST<wchar_t> ListOfFields(20); - LIST<void>* plUsersInfo = (LIST<void>*)pvUsersInfo; - int i, nUsersFound = plUsersInfo->getCount(); + LIST<U_TCHAR_MAP> *plUsersInfo = (LIST<U_TCHAR_MAP>*)pvUsersInfo; // lets fill the ListOfNonEmptyFields but in users order - for (i = 0; i < nUsersFound; i++) { - U_TCHAR_MAP* pmUserData = (U_TCHAR_MAP*)plUsersInfo->operator [](i); + for (auto &pmUserData : *plUsersInfo) { int nUserFields = pmUserData->getCount(); for (int j = 0; j < nUserFields; j++) { wchar_t *var = pmUserData->getKeyName(j); @@ -225,7 +223,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M // now fill the ListOfFields but order is from pmAllFields int nAllCount = pmAllFields->getCount(); - for (i = 0; i < nAllCount; i++) { + for (int i = 0; i < nAllCount; i++) { wchar_t *var = pmAllFields->getUnOrderedKeyName(i); if (var && ListOfNonEmptyFields.getIndex(var) < 0) continue; @@ -241,7 +239,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M Results.nFieldCount = nFieldCount; /* Sending Columns Titles */ - for (i = 0; i < nFieldCount; i++) { + for (int i = 0; i < nFieldCount; i++) { wchar_t *var = ListOfFields[i]; if (var) Results.pszFields[i] = pmAllFields->operator [](var); @@ -253,10 +251,9 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M /* Sending Users Data */ Results.psr.cbSize = sizeof(Results.psr); // sending user data - for (i = 0; i < nUsersFound; i++) { + for (auto &pmUserData : *plUsersInfo) { wchar_t buff[200]; buff[0] = 0; - U_TCHAR_MAP *pmUserData = (U_TCHAR_MAP *)plUsersInfo->operator [](i); for (int j = 0; j < nFieldCount; j++) { wchar_t *var = ListOfFields[j]; wchar_t *value = pmUserData->operator [](var); @@ -554,14 +551,11 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR SetDlgItemTextA(hwndDlg, IDC_SERVER, szServerName); SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szServerName); //TO DO: Add Transports here - int i, transpCount = dat->ppro->m_lstTransports.getCount(); - for (i = 0; i < transpCount; i++) { - wchar_t *szTransp = dat->ppro->m_lstTransports[i]; - if (szTransp) - JabberSearchAddUrlToRecentCombo(hwndDlg, szTransp); - } + for (auto &it : dat->ppro->m_lstTransports) + if (it != nullptr) + JabberSearchAddUrlToRecentCombo(hwndDlg, it); - for (i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, "RecentlySearched_%d", i); ptrW szValue(dat->ppro->getWStringA(key)); |