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

Unified Diff: Source/core/frame/SubresourceIntegrity.cpp

Issue 680393005: Cleanup a few loops into the new C++11 for-each style. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 | Source/core/frame/csp/ContentSecurityPolicy.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/SubresourceIntegrity.cpp
diff --git a/Source/core/frame/SubresourceIntegrity.cpp b/Source/core/frame/SubresourceIntegrity.cpp
index ac8d38f0e5ff0ad54ed9dda26bdb389f2c1cf0a4..0e041528d1f6cfa6a5db2bee128e5e2e9caf9afa 100644
--- a/Source/core/frame/SubresourceIntegrity.cpp
+++ b/Source/core/frame/SubresourceIntegrity.cpp
@@ -63,13 +63,9 @@ static String algorithmToString(HashAlgorithm algorithm)
{ HashAlgorithmSha512, "SHA-512" }
};
- // See comment in parseIntegrityAttribute about why sizeof() is used
- // instead of WTF_ARRAY_LENGTH.
- size_t i = 0;
- size_t kSupportedAlgorithmsLength = sizeof(kAlgorithmToString) / sizeof(kAlgorithmToString[0]);
- for (; i < kSupportedAlgorithmsLength; i++) {
- if (kAlgorithmToString[i].algorithm == algorithm)
- return kAlgorithmToString[i].name;
+ for (const auto& algorithmToString : kAlgorithmToString) {
+ if (algorithmToString.algorithm == algorithm)
+ return algorithmToString.name;
}
ASSERT_NOT_REACHED();
« no previous file with comments | « no previous file | Source/core/frame/csp/ContentSecurityPolicy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698