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

Unified Diff: third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp

Issue 1588453006: Use a local variable as a character cursor in genericParseNumber (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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: third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
index d098d3f09a1b49a97e83f4dcf1e7183259be5ad6..b76452b25fa7c6a1d944218cc8fd73052e0bf7c9 100644
--- a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
@@ -38,7 +38,7 @@ static inline bool isValidRange(const FloatType& x)
// at a higher precision internally, without any unnecessary runtime cost or code
// complexity.
template <typename CharType, typename FloatType>
-static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatType& number, WhitespaceMode mode)
+static bool genericParseNumber(const CharType*& cursor, const CharType* end, FloatType& number, WhitespaceMode mode)
{
FloatType integer, decimal, frac, exponent;
int sign, expsign;
@@ -51,8 +51,9 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT
expsign = 1;
if (mode & AllowLeadingWhitespace)
- skipOptionalSVGSpaces(ptr, end);
+ skipOptionalSVGSpaces(cursor, end);
+ const CharType* ptr = cursor;
// read the sign
if (ptr < end && *ptr == '+')
ptr++;
@@ -134,8 +135,11 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT
if (!isValidRange(number))
return false;
+ // A valid number has been parsed. Commit cursor.
+ cursor = ptr;
+
if (mode & AllowTrailingWhitespace)
- skipOptionalSVGSpacesOrDelimiter(ptr, end);
+ skipOptionalSVGSpacesOrDelimiter(cursor, end);
return true;
}
« 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