always seek so variables are initialized properly, increment mSegmentNum before getting next block; bug 129760, r=dougt, sr=darin, a=Asa
git-svn-id: svn://10.0.0.236/trunk@116856 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -364,12 +364,10 @@ nsStorageStream::NewInputStream(PRInt32 aStartingOffset, nsIInputStream* *aInput
|
||||
|
||||
NS_ADDREF(inputStream);
|
||||
|
||||
if (aStartingOffset) {
|
||||
nsresult rv = inputStream->Seek(aStartingOffset);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(inputStream);
|
||||
return rv;
|
||||
}
|
||||
nsresult rv = inputStream->Seek(aStartingOffset);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(inputStream);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aInputStream = inputStream;
|
||||
@@ -404,7 +402,7 @@ nsStorageInputStream::Read(char* aBuffer, PRUint32 aCount, PRUint32 *aNumRead)
|
||||
if (!available)
|
||||
goto out;
|
||||
|
||||
mReadCursor = mStorageStream->mSegmentedBuffer->GetSegment(mSegmentNum++);
|
||||
mReadCursor = mStorageStream->mSegmentedBuffer->GetSegment(++mSegmentNum);
|
||||
mSegmentEnd = mReadCursor + PR_MIN(mSegmentSize, available);
|
||||
}
|
||||
|
||||
@@ -442,7 +440,7 @@ nsStorageInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRU
|
||||
if (!available)
|
||||
goto out;
|
||||
|
||||
mReadCursor = mStorageStream->mSegmentedBuffer->GetSegment(mSegmentNum++);
|
||||
mReadCursor = mStorageStream->mSegmentedBuffer->GetSegment(++mSegmentNum);
|
||||
mSegmentEnd = mReadCursor + PR_MIN(mSegmentSize, available);
|
||||
availableInSegment = mSegmentEnd - mReadCursor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user