fix tinderbox Ts=NaN problem. stream transport must handle offset = -1.

This commit is contained in:
darin%meer.net 2003-10-06 07:58:07 +00:00
Родитель d6e70f5444
Коммит 11af30d3b0
1 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -208,9 +208,12 @@ nsInputStreamTransport::Read(char *buf, PRUint32 count, PRUint32 *result)
if (mFirstTime) {
mFirstTime = PR_FALSE;
if (mOffset) {
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mSource);
if (seekable)
seekable->Seek(nsISeekableStream::NS_SEEK_SET, mOffset);
// read from current position if offset equal to max
if (mOffset != PR_UINT32_MAX) {
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mSource);
if (seekable)
seekable->Seek(nsISeekableStream::NS_SEEK_SET, mOffset);
}
// reset offset to zero so we can use it to enforce limit
mOffset = 0;
}
@ -405,9 +408,12 @@ nsOutputStreamTransport::Write(const char *buf, PRUint32 count, PRUint32 *result
if (mFirstTime) {
mFirstTime = PR_FALSE;
if (mOffset) {
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mSink);
if (seekable)
seekable->Seek(nsISeekableStream::NS_SEEK_SET, mOffset);
// write to current position if offset equal to max
if (mOffset != PR_UINT32_MAX) {
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mSink);
if (seekable)
seekable->Seek(nsISeekableStream::NS_SEEK_SET, mOffset);
}
// reset offset to zero so we can use it to enforce limit
mOffset = 0;
}