Bug 393080: Make count and offset in nsCSSScanner unsigned. r+sr=bzbarsky, a=dbaron

This commit is contained in:
sharparrow1@yahoo.com 2007-08-22 10:32:59 -07:00
parent a5a4e42120
commit e37155ba7f
2 changed files with 5 additions and 8 deletions

View File

@ -250,7 +250,7 @@ PR_STATIC_CALLBACK(int) CSSErrorsPrefChanged(const char *aPref, void *aClosure)
}
void nsCSSScanner::Init(nsIUnicharInputStream* aInput,
const PRUnichar * aBuffer, PRInt32 aCount,
const PRUnichar * aBuffer, PRUint32 aCount,
nsIURI* aURI, PRUint32 aLineNumber)
{
NS_PRECONDITION(!mInputStream, "Should not have an existing input stream!");
@ -473,16 +473,13 @@ PRInt32 nsCSSScanner::Read(nsresult& aErrorCode)
if (0 < mPushbackCount) {
rv = PRInt32(mPushback[--mPushbackCount]);
} else {
if (mCount < 0) {
return -1;
}
if (mOffset == mCount) {
mOffset = 0;
if (!mInputStream) {
mCount = 0;
return -1;
}
aErrorCode = mInputStream->Read(mBuffer, CSS_BUFFER_SIZE, (PRUint32*)&mCount);
aErrorCode = mInputStream->Read(mBuffer, CSS_BUFFER_SIZE, &mCount);
if (NS_FAILED(aErrorCode) || mCount == 0) {
mCount = 0;
return -1;

View File

@ -139,7 +139,7 @@ class nsCSSScanner {
// when the line number is unknown.
// Either aInput or (aBuffer and aCount) must be set.
void Init(nsIUnicharInputStream* aInput,
const PRUnichar *aBuffer, PRInt32 aCount,
const PRUnichar *aBuffer, PRUint32 aCount,
nsIURI* aURI, PRUint32 aLineNumber);
void Close();
@ -225,8 +225,8 @@ protected:
PRUnichar mBuffer[CSS_BUFFER_SIZE];
const PRUnichar *mReadPointer;
PRInt32 mOffset;
PRInt32 mCount;
PRUint32 mOffset;
PRUint32 mCount;
PRUnichar* mPushback;
PRInt32 mPushbackCount;
PRInt32 mPushbackSize;