Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: chrome/browser/importer/firefox_importer_utils.cc

Issue 10925: Fix erase method usage on STL containers in Chrome. Invoking erase on the ite... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resource_dispatcher_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/firefox_importer_utils.cc
===================================================================
--- chrome/browser/importer/firefox_importer_utils.cc (revision 5528)
+++ chrome/browser/importer/firefox_importer_utils.cc (working copy)
@@ -195,11 +195,13 @@
std::map<std::wstring, TemplateURL*> search_engine_for_url;
std::string content;
+ bool need_to_increment_iter;
// The first XML file represents the default search engine in Firefox 3, so we
// need to keep it on top of the list.
TemplateURL* default_turl = NULL;
for (std::vector<std::wstring>::const_iterator iter = xml_files.begin();
- iter != xml_files.end(); ++iter) {
+ iter != xml_files.end();) {
+ need_to_increment_iter = true;
file_util::ReadFileToString(*iter, &content);
TemplateURL* template_url = new TemplateURL();
FirefoxURLParameterFilter param_filter;
@@ -216,7 +218,8 @@
// returns a vector with first Firefox default search engines and then
// the user's ones. We want to give priority to the user ones.
delete iter->second;
- search_engine_for_url.erase(iter);
+ iter = search_engine_for_url.erase(iter);
+ need_to_increment_iter = false;
MAD 2009/02/26 18:13:24 This is not the same iter as the one used for the
}
// Give this a keyword to facilitate tab-to-search, if possible.
template_url->set_keyword(TemplateURLModel::GenerateKeyword(GURL(url),
@@ -229,6 +232,8 @@
delete template_url;
}
content.clear();
+ if (need_to_increment_iter)
+ ++iter;
}
// Put the results in the |search_engines| vector.
« no previous file with comments | « no previous file | chrome/browser/resource_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698