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

Unified Diff: Source/platform/ParsingUtilities.h

Issue 656063002: Subresource Integrity: Improve parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
Index: Source/platform/ParsingUtilities.h
diff --git a/Source/platform/ParsingUtilities.h b/Source/platform/ParsingUtilities.h
index 882b800bf398e9e951aa39e1ff22bf40c48243ad..aff22b895a5003608fff9f78383066142a5a5c66 100644
--- a/Source/platform/ParsingUtilities.h
+++ b/Source/platform/ParsingUtilities.h
@@ -51,7 +51,23 @@ bool skipExactly(const CharType*& position, const CharType* end)
return false;
}
-template<typename CharType>
+template <typename CharType>
+bool skipToken(const CharType*& position, const CharType* end, const char* token)
+{
+ const CharType* current = position;
+ while (current < end && *token) {
+ if (*current != *token++)
jww 2014/10/15 23:26:04 I find this inline post-increment extremely confus
Mike West 2014/10/16 06:17:22 Done.
+ return false;
+ ++current;
+ }
+ if (*token)
+ return false;
+
+ position = current;
+ return true;
+}
+
+template <typename CharType>
void skipUntil(const CharType*& position, const CharType* end, CharType delimiter)
{
while (position < end && *position != delimiter)

Powered by Google App Engine
This is Rietveld 408576698