Bug 392840: Get rid of nsCSSScanner::Unread. r+sr=bzbarsky, r+a=dbaron

git-svn-id: svn://10.0.0.236/trunk@232467 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sharparrow1%yahoo.com
2007-08-21 18:29:50 +00:00
parent 1553a1347d
commit 13e2702914
2 changed files with 8 additions and 16 deletions

View File

@@ -527,13 +527,6 @@ PRInt32 nsCSSScanner::Peek(nsresult& aErrorCode)
return PRInt32(mPushback[mPushbackCount - 1]);
}
void nsCSSScanner::Unread()
{
NS_PRECONDITION((mLastRead >= 0), "double pushback");
Pushback(PRUnichar(mLastRead));
mLastRead = -1;
}
void nsCSSScanner::Pushback(PRUnichar aChar)
{
if (mPushbackCount == mPushbackSize) { // grow buffer
@@ -560,7 +553,7 @@ PRBool nsCSSScanner::LookAhead(nsresult& aErrorCode, PRUnichar aChar)
if (ch == aChar) {
return PR_TRUE;
}
Unread();
Pushback(ch);
return PR_FALSE;
}
@@ -576,7 +569,7 @@ PRBool nsCSSScanner::EatWhiteSpace(nsresult& aErrorCode)
eaten = PR_TRUE;
continue;
}
Unread();
Pushback(ch);
break;
}
return eaten;
@@ -598,7 +591,7 @@ PRBool nsCSSScanner::EatNewline(nsresult& aErrorCode)
} else if (ch == '\n') {
eaten = PR_TRUE;
} else {
Unread();
Pushback(ch);
}
return eaten;
}
@@ -820,7 +813,7 @@ PRBool nsCSSScanner::NextURL(nsresult& aErrorCode, nsCSSToken& aToken)
// ")". This is an invalid url spec.
ok = PR_FALSE;
} else if (ch == ')') {
Unread();
Pushback(ch);
// All done
break;
} else {
@@ -858,7 +851,7 @@ nsCSSScanner::ParseAndAppendEscape(nsresult& aErrorCode, nsString& aOutput)
break;
}
if (ch >= 256 || (lexTable[ch] & (IS_HEX_DIGIT | IS_WHITESPACE)) == 0) {
Unread();
Pushback(ch);
break;
} else if ((lexTable[ch] & IS_HEX_DIGIT) != 0) {
if ((lexTable[ch] & IS_DIGIT) != 0) {
@@ -936,7 +929,7 @@ PRBool nsCSSScanner::GatherIdent(nsresult& aErrorCode, PRInt32 aChar,
} else if ((aChar > 255) || ((gLexTable[aChar] & IS_IDENT) != 0)) {
aIdent.Append(PRUnichar(aChar));
} else {
Unread();
Pushback(aChar);
break;
}
}
@@ -963,7 +956,7 @@ PRBool nsCSSScanner::ParseRef(nsresult& aErrorCode,
}
// No ident chars after the '#'. Just unread |ch| and get out of here.
Unread();
Pushback(ch);
return PR_TRUE;
}
@@ -1039,7 +1032,7 @@ PRBool nsCSSScanner::ParseNumber(nsresult& aErrorCode, PRInt32 c,
ident.SetLength(0);
} else {
// Put back character that stopped numeric scan
Unread();
Pushback(c);
if (!gotDot) {
aToken.mInteger = ident.ToInteger(&ec);
aToken.mIntegerValid = PR_TRUE;