Bug 1418847 - Move variable declarations within Parser::Parse(). r=glandium

MozReview-Commit-ID: FdgXKBKH4nr
This commit is contained in:
Nicholas Nethercote
2017-11-21 12:57:36 +11:00
parent e4a9c14517
commit e9a7b910bc

View File

@@ -1225,17 +1225,12 @@ Parser::ReportProblem(const char* aMessage, int aLine, bool aError)
bool
Parser::Parse(const char* aBuf, int aBufLen)
{
const char* end;
char c;
char udigit;
State state;
// The line number is currently only used for the error/warning reporting.
int lineNum = 0;
state = mState;
for (end = aBuf + aBufLen; aBuf != end; ++aBuf) {
c = *aBuf;
State state = mState;
for (const char* end = aBuf + aBufLen; aBuf != end; ++aBuf) {
char c = *aBuf;
if (c == '\r' || c == '\n' || c == 0x1A) {
lineNum++;
}
@@ -1478,7 +1473,8 @@ Parser::Parse(const char* aBuf, int aBufLen)
break;
// parsing a hex (\xHH) or mUtf16 escape (\uHHHH)
case State::eHexEscape:
case State::eHexEscape: {
char udigit;
if (c >= '0' && c <= '9') {
udigit = (c - '0');
} else if (c >= 'A' && c <= 'F') {
@@ -1541,6 +1537,7 @@ Parser::Parse(const char* aBuf, int aBufLen)
state = State::eQuotedString;
}
break;
}
// looking for beginning of mUtf16 low surrogate
case State::eUTF16LowSurrogate: