From bcb27264ba737778e5d3edad36088bacf74f0236 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Apr 2013 20:03:46 +0000 Subject: - short function names allows to write database loops in one string; - 'continue' operator can be used then; - multiple bugs fixed in clists; - code becomes much more compact; git-svn-id: http://svn.miranda-ng.org/main/trunk@4403 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SecureIM/src/options.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'plugins/SecureIM/src/options.cpp') diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 386fc023bf..795e88b14c 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -985,10 +985,9 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) LVITEM lvi; memset(&lvi,0,sizeof(lvi)); lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; - HANDLE hContact = db_find_first(); char tmp[NAMSIZE]; - while (hContact) { + for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { pUinKey ptr = getUinKey(hContact); if (ptr && isSecureProtocol(hContact) && !isChatRoom(hContact)) { if (iInit) { @@ -1013,7 +1012,6 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) else setListViewPUB(hLV, itemNum, hasKey(ptr)); setListViewIcon(hLV, itemNum, ptr); } - hContact = db_find_next(hContact); } ListView_Sort(hLV,0); } @@ -1073,10 +1071,9 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) LVITEM lvi; memset(&lvi,0,sizeof(lvi)); lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; - HANDLE hContact = db_find_first(); char tmp[NAMSIZE]; - while (hContact) { + for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { pUinKey ptr = getUinKey(hContact); if (ptr && ptr->mode == MODE_PGP && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) { LPSTR szKeyID = db_get_sa(hContact,MODULENAME,"pgp_abbr"); @@ -1095,7 +1092,6 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) LV_SetItemTextA(hLV, itemNum, 2, (szKeyID)?szKeyID:Translate(sim221)); SAFE_FREE(szKeyID); } - hContact = db_find_next(hContact); } ListView_Sort(hLV,(LPARAM)0x10); } @@ -1135,10 +1131,9 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) LVITEM lvi; memset(&lvi,0,sizeof(lvi)); lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; - HANDLE hContact = db_find_first(); char tmp[NAMSIZE]; - while (hContact) { + for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { pUinKey ptr = getUinKey(hContact); if (ptr && ptr->mode == MODE_GPG && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) { if (iInit ) @@ -1161,7 +1156,6 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) LV_SetItemTextA(hLV, itemNum, 3, (ptr->tgpgMode)?Translate(sim228):Translate(sim229)); SAFE_FREE(szKeyID); } - hContact = db_find_next(hContact); } ListView_Sort(hLV,(LPARAM)0x20); } -- cgit v1.2.3