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

Unified Diff: net/log/net_log_util.cc

Issue 2470273003: Replace for each loop (Closed)
Patch Set: Replace for each loop with const auto& Created 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/log/net_log_util.cc
diff --git a/net/log/net_log_util.cc b/net/log/net_log_util.cc
index da724e9f0bbb41693e0494b2110c1a8f2347728b..763e5892d9369fb2360c9cc72d7047ba7f1f8c37 100644
--- a/net/log/net_log_util.cc
+++ b/net/log/net_log_util.cc
@@ -158,8 +158,8 @@ std::unique_ptr<base::DictionaryValue> GetNetConstants() {
{
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
- for (size_t i = 0; i < arraysize(kCertStatusFlags); i++)
- dict->SetInteger(kCertStatusFlags[i].name, kCertStatusFlags[i].constant);
+ for (const auto& flag : kCertStatusFlags)
+ dict->SetInteger(flag.name, flag.constant);
constants_dict->Set("certStatusFlag", std::move(dict));
}
@@ -169,8 +169,8 @@ std::unique_ptr<base::DictionaryValue> GetNetConstants() {
{
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
- for (size_t i = 0; i < arraysize(kLoadFlags); i++)
- dict->SetInteger(kLoadFlags[i].name, kLoadFlags[i].constant);
+ for (const auto& flag : kLoadFlags)
+ dict->SetInteger(flag.name, flag.constant);
constants_dict->Set("loadFlag", std::move(dict));
}
@@ -180,8 +180,8 @@ std::unique_ptr<base::DictionaryValue> GetNetConstants() {
{
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
- for (size_t i = 0; i < arraysize(kLoadStateTable); i++)
- dict->SetInteger(kLoadStateTable[i].name, kLoadStateTable[i].constant);
+ for (const auto& state : kLoadStateTable)
+ dict->SetInteger(state.name, state.constant);
constants_dict->Set("loadState", std::move(dict));
}
@@ -200,8 +200,8 @@ std::unique_ptr<base::DictionaryValue> GetNetConstants() {
{
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
- for (size_t i = 0; i < arraysize(kNetErrors); i++)
- dict->SetInteger(ErrorToShortString(kNetErrors[i]), kNetErrors[i]);
+ for (const auto& error : kNetErrors)
+ dict->SetInteger(ErrorToShortString(error), error);
constants_dict->Set("netError", std::move(dict));
}
@@ -240,8 +240,8 @@ std::unique_ptr<base::DictionaryValue> GetNetConstants() {
{
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
- for (size_t i = 0; i < arraysize(kSdchProblems); i++)
- dict->SetInteger(kSdchProblems[i].name, kSdchProblems[i].constant);
+ for (const auto& problem : kSdchProblems)
+ dict->SetInteger(problem.name, problem.constant);
constants_dict->Set("sdchProblemCode", std::move(dict));
}
« 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