fix signed/unsigned problem, call Reset function when error occur

git-svn-id: svn://10.0.0.236/trunk@30449 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ftang%netscape.com
1999-05-05 23:53:49 +00:00
parent 6163d9ab46
commit eb2533ba2d
2 changed files with 14 additions and 4 deletions

View File

@@ -257,10 +257,15 @@ PRBool nsScanner::Append(const char* aBuffer, PRUint32 aLen){
// if we failed, we consume one byte by replace it with U+FFFD
// and try conversion again.
if(NS_FAILED(res)) {
mUnicodeDecoder->Reset();
mBuffer.Append( (PRUnichar)0xFFFD);
mTotalRead++;
aBuffer += srcLength + 1;
aLen -= srcLength + 1;
if(((PRUint32) (srcLength + 1)) > aLen)
srcLength = aLen;
else
srcLength++;
aBuffer += srcLength;
aLen -= srcLength;
}
} while (NS_FAILED(res) && (aLen > 0));
// we continue convert the bytes data into Unicode