← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2740: better search result removal

 

------------------------------------------------------------
revno: 2740
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2011-12-23 15:47:37 +0100
message:
  better search result removal
modified:
  dcpp/FavoriteManager.cpp
  dwt/src/widgets/Table.cpp
  win32/SearchFrame.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/FavoriteManager.cpp'
--- dcpp/FavoriteManager.cpp	2011-12-22 22:14:45 +0000
+++ dcpp/FavoriteManager.cpp	2011-12-23 14:47:37 +0000
@@ -206,7 +206,7 @@
 	FavoriteHubEntry* f;
 
 	auto i = getFavoriteHub(aEntry.getServer());
-	if(i != favoriteHubs.end()) {
+	if(!i) {
 		return;
 	}
 	f = new FavoriteHubEntry(aEntry);

=== modified file 'dwt/src/widgets/Table.cpp'
--- dwt/src/widgets/Table.cpp	2011-12-23 14:07:18 +0000
+++ dwt/src/widgets/Table.cpp	2011-12-23 14:47:37 +0000
@@ -209,14 +209,14 @@
 	// now insert sub-items (for columns)
 	lvi.mask = LVIF_TEXT | LVIF_IMAGE;
 	lvi.iSubItem = 1;
-	for(auto i = row.begin() + 1, iend = row.end(); i != iend; ++i) {
-		lvi.pszText = const_cast<LPTSTR>(i->c_str());
-		lvi.cchTextMax = static_cast<int>(i->size());
+	std::for_each(row.cbegin() + 1, row.cend(), [this, &lvi](const tstring& text) {
+		lvi.pszText = const_cast<LPTSTR>(text.c_str());
+		lvi.cchTextMax = static_cast<int>(text.size());
 		if(!ListView_SetItem(handle(), &lvi)) {
 			throw Win32Exception("Error while trying to insert row sub-item in Table");
 		}
 		lvi.iSubItem++;
-	}
+	});
 
 	return ret;
 }

=== modified file 'win32/SearchFrame.cpp'
--- win32/SearchFrame.cpp	2011-12-22 22:14:45 +0000
+++ win32/SearchFrame.cpp	2011-12-23 14:47:37 +0000
@@ -752,8 +752,7 @@
 		auto data = results->getData(i);
 		results->erase(i);
 		if(data) {
-			searchResults.erase(std::remove_if(searchResults.begin(), searchResults.end(),
-				[data](const SearchInfo& si) { return &si == data; }), searchResults.end());
+			searchResults.remove_if([data](const SearchInfo& si) { return &si == data; });
 		}
 	}