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

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

Issue 1582813003: Remove redundant emptiness check from genericParseNumber (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 f1af2cb4321e092b42b380458087a50be2a7f407..127a01858d34ab78702f85b30b2aaa3953f3d03d 100644
--- a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
@@ -42,7 +42,6 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT
{
FloatType integer, decimal, frac, exponent;
int sign, expsign;
- const CharType* start = ptr;
exponent = 0;
integer = 0;
@@ -62,6 +61,7 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT
sign = -1;
}
+ const CharType* digitsStart = ptr;
if (ptr == end || ((*ptr < '0' || *ptr > '9') && *ptr != '.'))
// The first character of a number must be one of [0-9+-.]
return false;
@@ -94,8 +94,12 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT
decimal += (*(ptr++) - '0') * (frac *= static_cast<FloatType>(0.1));
}
+ // When we get here we should have consumed either a digit for the integer
+ // part or a fractional part (with at least one digit after the '.'.)
+ ASSERT_UNUSED(digitsStart, digitsStart != ptr);
pdr. 2016/01/13 18:58:11 Can we reuse/rename ptrStartIntPart and change thi
fs 2016/01/13 19:16:27 Yepp. Like so.
+
// read the exponent part
- if (ptr != start && ptr + 1 < end && (*ptr == 'e' || *ptr == 'E')
+ if (ptr + 1 < end && (*ptr == 'e' || *ptr == 'E')
&& (ptr[1] != 'x' && ptr[1] != 'm')) {
ptr++;
@@ -131,9 +135,6 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT
if (!isValidRange(number))
return false;
- if (start == ptr)
- return false;
-
if (mode & AllowTrailingWhitespace)
skipOptionalSVGSpacesOrDelimiter(ptr, end);
« 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