Added FillStream(...) which exposes nsIBuffer::WriteSegments()

This commit is contained in:
rpotts%netscape.com 1999-06-12 08:56:05 +00:00
Родитель 3b9b3f2321
Коммит 2d59a49818
2 изменённых файлов: 11 добавлений и 12 удалений

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

@ -105,7 +105,7 @@ nsresult nsSocketTransportStream::Init(nsSocketTransport* aTransport,
}
if (NS_SUCCEEDED(rv)) {
rv = NS_NewBuffer(&mBuffer, MAX_IO_BUFFER_SIZE, 1*MAX_IO_BUFFER_SIZE);
rv = NS_NewBuffer(&mBuffer, MAX_IO_BUFFER_SIZE/2, 2*MAX_IO_BUFFER_SIZE);
}
if (NS_SUCCEEDED(rv)) {
rv = NS_NewBufferInputStream(&mStream, mBuffer);
@ -135,18 +135,15 @@ nsresult nsSocketTransportStream::BlockTransport(void)
return NS_OK;
}
nsresult nsSocketTransportStream::GetWriteAmount(PRUint32 *aResultSize)
nsresult nsSocketTransportStream::FillStream(nsReadSegmentFun reader,
void* closure,
PRUint32 count,
PRUint32 *writeCount)
{
nsresult rv;
char *segment;
*aResultSize = 0;
rv = mBuffer->GetWriteSegment(&segment, aResultSize);
return rv;
return mBuffer->WriteSegments(reader, closure, count, writeCount);
}
//
// --------------------------------------------------------------------------
// nsISupports implementation...

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

@ -21,7 +21,7 @@
#include "prtypes.h"
#include "nsIBufferInputStream.h"
#include "nsIBuffer.h"
// Forward declarations...
class nsSocketTransport;
@ -50,7 +50,9 @@ public:
// nsSocketTransportStream methods:
nsresult Init(nsSocketTransport* aTransport, PRBool aBlockingFlag);
nsresult BlockTransport(void);
nsresult GetWriteAmount(PRUint32* aResultSize);
nsresult FillStream(nsReadSegmentFun reader, void* closure, PRUint32 count,
PRUint32 *writeCount);
void Lock(void) { NS_ASSERTION(mMonitor, "Monitor null."); PR_EnterMonitor(mMonitor); }
void Notify(void) { NS_ASSERTION(mMonitor, "Monitor null."); PR_Notify(mMonitor); }