mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-05-13 08:57:27 +00:00
fix signed/unsigned problem, call Reset function when error occur
This commit is contained in:
parent
a7ed69ffb9
commit
35dc6c6fcb
@ -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
|
// if we failed, we consume one byte by replace it with U+FFFD
|
||||||
// and try conversion again.
|
// and try conversion again.
|
||||||
if(NS_FAILED(res)) {
|
if(NS_FAILED(res)) {
|
||||||
|
mUnicodeDecoder->Reset();
|
||||||
mBuffer.Append( (PRUnichar)0xFFFD);
|
mBuffer.Append( (PRUnichar)0xFFFD);
|
||||||
mTotalRead++;
|
mTotalRead++;
|
||||||
aBuffer += srcLength + 1;
|
if(((PRUint32) (srcLength + 1)) > aLen)
|
||||||
aLen -= srcLength + 1;
|
srcLength = aLen;
|
||||||
|
else
|
||||||
|
srcLength++;
|
||||||
|
aBuffer += srcLength;
|
||||||
|
aLen -= srcLength;
|
||||||
}
|
}
|
||||||
} while (NS_FAILED(res) && (aLen > 0));
|
} while (NS_FAILED(res) && (aLen > 0));
|
||||||
// we continue convert the bytes data into Unicode
|
// we continue convert the bytes data into Unicode
|
||||||
|
@ -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
|
// if we failed, we consume one byte by replace it with U+FFFD
|
||||||
// and try conversion again.
|
// and try conversion again.
|
||||||
if(NS_FAILED(res)) {
|
if(NS_FAILED(res)) {
|
||||||
|
mUnicodeDecoder->Reset();
|
||||||
mBuffer.Append( (PRUnichar)0xFFFD);
|
mBuffer.Append( (PRUnichar)0xFFFD);
|
||||||
mTotalRead++;
|
mTotalRead++;
|
||||||
aBuffer += srcLength + 1;
|
if(((PRUint32) (srcLength + 1)) > aLen)
|
||||||
aLen -= srcLength + 1;
|
srcLength = aLen;
|
||||||
|
else
|
||||||
|
srcLength++;
|
||||||
|
aBuffer += srcLength;
|
||||||
|
aLen -= srcLength;
|
||||||
}
|
}
|
||||||
} while (NS_FAILED(res) && (aLen > 0));
|
} while (NS_FAILED(res) && (aLen > 0));
|
||||||
// we continue convert the bytes data into Unicode
|
// we continue convert the bytes data into Unicode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user