dammit why does this break linux?!

backing out my last checkin
This commit is contained in:
alecf%netscape.com 2002-01-11 22:44:30 +00:00
parent 926dbcef45
commit b0f44a323d

View File

@ -233,7 +233,7 @@ PRInt32 UTF8InputStream::Fill(nsresult * aErrorCode)
NS_ASSERTION(mByteData->GetLength() >= mByteDataOffset, "unsigned madness");
PRUint32 remainder = mByteData->GetLength() - mByteDataOffset;
mByteDataOffset = remainder;
PRInt32 nb = mByteData->Fill(aErrorCode, mInput, remainder);
if (nb <= 0) {
// Because we assume a many to one conversion, the lingering data
@ -247,7 +247,6 @@ PRInt32 UTF8InputStream::Fill(nsresult * aErrorCode)
// Now convert as much of the byte buffer to unicode as possible
PRInt32 srcLen = CountValidUTF8Bytes(mByteData->GetBuffer(),remainder + nb);
NS_ASSERTION( (remainder+nb >= srcLen), "cannot be longer than out buffer");
NS_ConvertUTF8toUCS2
unicodeValue(Substring(mByteData->GetBuffer(),
@ -265,7 +264,7 @@ PRInt32 UTF8InputStream::Fill(nsresult * aErrorCode)
mUnicharDataOffset = 0;
mUnicharDataLength = dstLen;
mByteDataOffset = srcLen;
mByteDataOffset += srcLen;
return dstLen;
}
@ -275,10 +274,8 @@ UTF8InputStream::CountValidUTF8Bytes(const char* aBuffer, PRInt32 aMaxBytes)
{
const char *c = aBuffer;
const char *end = aBuffer + aMaxBytes;
const char *lastchar = c; // pre-initialize in case of 0-length buffer
while (c < end && *c) {
lastchar = c;
if (UTF8traits::isASCII(*c))
c++;
else if (UTF8traits::is2byte(*c))
@ -296,8 +293,6 @@ UTF8InputStream::CountValidUTF8Bytes(const char* aBuffer, PRInt32 aMaxBytes)
break; // Otherwise we go into an infinite loop. But what happens now?
}
}
if (c > end)
c = lastchar;
return c - aBuffer;
}