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

Unified Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 2724153004: Declare a variable before using it (Closed)
Patch Set: Created 3 years, 10 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index 590f814d6073c07ed0ea15fb6515ecb2bb0dbd9d..af62c8548cc24498ae51862960c1190a67bfe488 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -880,7 +880,9 @@ std::vector<Suggestion> PersonalDataManager::GetProfileSuggestions(
// trial group or SIZE_MAX if no limit is defined.
std::string limit_str = variations::GetVariationParamValue(
kFrecencyFieldTrialName, kFrecencyFieldTrialLimitParam);
- size_t limit = base::StringToSizeT(limit_str, &limit) ? limit : SIZE_MAX;
+ size_t limit;
vabr (Chromium) 2017/03/04 19:40:29 This is actually worse than before. Before there w
chengx 2017/03/06 18:26:14 I will use another CL to fix this. Thanks!
vabr (Chromium) 2017/03/06 18:46:48 SGTM, thanks for following up! :)
+ if (!base::StringToSizeT(limit_str, &limit))
+ limit = SIZE_MAX;
unique_suggestions.resize(std::min(unique_suggestions.size(), limit));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698