95614 - Initialized an iterator and replaced NS_ENSURE_SUCCESS ( which asserts), since the result code from nsScanner::Peek() does not indicate an exceptional condition, with equivalent code. r=heikki, sr=waterson.
git-svn-id: svn://10.0.0.236/trunk@101230 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -547,6 +547,7 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
|
||||
start = origin;
|
||||
++start;
|
||||
aScanner.SetPosition(start);
|
||||
aScanner.EndReading(end);
|
||||
|
||||
while((NS_OK==result) && (!done)) {
|
||||
result=aScanner.ReadUntil(start, end, theEndCondition, PR_FALSE);
|
||||
|
||||
@@ -561,8 +561,11 @@ nsresult nsScanner::SkipWhitespace(void) {
|
||||
|
||||
PRUnichar theChar=0;
|
||||
nsresult result=Peek(theChar);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
|
||||
if (result == kEOF) {
|
||||
return Eof();
|
||||
}
|
||||
|
||||
while (current != mEndPosition) {
|
||||
switch(theChar) {
|
||||
case '\n': mNewlinesSkipped++;
|
||||
@@ -584,18 +587,14 @@ nsresult nsScanner::SkipWhitespace(void) {
|
||||
skipped = PR_TRUE;
|
||||
}
|
||||
|
||||
if (!skipped)
|
||||
return NS_OK;
|
||||
|
||||
if (current == mEndPosition) {
|
||||
if (skipped) {
|
||||
SetPosition(current);
|
||||
return Eof();
|
||||
if (current == mEndPosition) {
|
||||
return Eof();
|
||||
}
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1195,7 +1194,10 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
||||
|
||||
PRUnichar theChar=0;
|
||||
nsresult result=Peek(theChar);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
if (result == kEOF) {
|
||||
return Eof();
|
||||
}
|
||||
|
||||
while (current != mEndPosition) {
|
||||
// Filter out completely wrong characters
|
||||
@@ -1251,7 +1253,11 @@ nsresult nsScanner::ReadUntil(nsReadingIterator<PRUnichar>& aStart,
|
||||
|
||||
PRUnichar theChar=0;
|
||||
nsresult result=Peek(theChar);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
if (result == kEOF) {
|
||||
aStart = aEnd = current;
|
||||
return Eof();
|
||||
}
|
||||
|
||||
while (current != mEndPosition) {
|
||||
// Filter out completely wrong characters
|
||||
@@ -1310,7 +1316,6 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
||||
|
||||
PRUnichar theChar;
|
||||
nsresult result=Peek(theChar);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
while (current != mEndPosition) {
|
||||
if (aTerminalChar == theChar) {
|
||||
|
||||
@@ -547,6 +547,7 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
|
||||
start = origin;
|
||||
++start;
|
||||
aScanner.SetPosition(start);
|
||||
aScanner.EndReading(end);
|
||||
|
||||
while((NS_OK==result) && (!done)) {
|
||||
result=aScanner.ReadUntil(start, end, theEndCondition, PR_FALSE);
|
||||
|
||||
@@ -561,8 +561,11 @@ nsresult nsScanner::SkipWhitespace(void) {
|
||||
|
||||
PRUnichar theChar=0;
|
||||
nsresult result=Peek(theChar);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
|
||||
if (result == kEOF) {
|
||||
return Eof();
|
||||
}
|
||||
|
||||
while (current != mEndPosition) {
|
||||
switch(theChar) {
|
||||
case '\n': mNewlinesSkipped++;
|
||||
@@ -584,18 +587,14 @@ nsresult nsScanner::SkipWhitespace(void) {
|
||||
skipped = PR_TRUE;
|
||||
}
|
||||
|
||||
if (!skipped)
|
||||
return NS_OK;
|
||||
|
||||
if (current == mEndPosition) {
|
||||
if (skipped) {
|
||||
SetPosition(current);
|
||||
return Eof();
|
||||
if (current == mEndPosition) {
|
||||
return Eof();
|
||||
}
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1195,7 +1194,10 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
||||
|
||||
PRUnichar theChar=0;
|
||||
nsresult result=Peek(theChar);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
if (result == kEOF) {
|
||||
return Eof();
|
||||
}
|
||||
|
||||
while (current != mEndPosition) {
|
||||
// Filter out completely wrong characters
|
||||
@@ -1251,7 +1253,11 @@ nsresult nsScanner::ReadUntil(nsReadingIterator<PRUnichar>& aStart,
|
||||
|
||||
PRUnichar theChar=0;
|
||||
nsresult result=Peek(theChar);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
if (result == kEOF) {
|
||||
aStart = aEnd = current;
|
||||
return Eof();
|
||||
}
|
||||
|
||||
while (current != mEndPosition) {
|
||||
// Filter out completely wrong characters
|
||||
@@ -1310,7 +1316,6 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
||||
|
||||
PRUnichar theChar;
|
||||
nsresult result=Peek(theChar);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
while (current != mEndPosition) {
|
||||
if (aTerminalChar == theChar) {
|
||||
|
||||
Reference in New Issue
Block a user