зеркало из https://github.com/mozilla/pjs.git
Moved WriteFrom to nsIBufferOutputStream. Made necko pass around buffer streams.
This commit is contained in:
Родитель
d8c389dd95
Коммит
aaf94a8b04
|
@ -447,11 +447,6 @@ public:
|
|||
fflush(stdout);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHOD Flush()
|
||||
{
|
||||
fflush(stdout);
|
||||
|
|
|
@ -56,10 +56,6 @@ public:
|
|||
NS_IMETHOD Write(const char *aBuf,
|
||||
PRUint32 aLen,
|
||||
PRUint32 *aWriteLength);
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHOD Flush(void) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -216,11 +216,6 @@ public:
|
|||
NS_IMETHOD
|
||||
Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -166,11 +166,6 @@ public:
|
|||
NS_IMETHOD
|
||||
Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -166,11 +166,6 @@ public:
|
|||
NS_IMETHOD
|
||||
Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -216,11 +216,6 @@ public:
|
|||
NS_IMETHOD
|
||||
Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -676,11 +676,6 @@ public:
|
|||
NS_IMETHOD
|
||||
Write(const char* aBuf, PRInt32 aCount, PRInt32 *resultingCount);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -43,11 +43,6 @@ public:
|
|||
NS_IMETHOD
|
||||
Write(const char* aBuf, PRInt32 aCount, PRInt32 *resultingCount);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
|
||||
#include "nsIStreamObserver.idl"
|
||||
|
||||
interface nsIInputStream;
|
||||
interface nsIBufferInputStream;
|
||||
interface nsIEventQueue;
|
||||
|
||||
[scriptable, uuid(1a637020-1482-11d3-9333-00104ba0fd40)]
|
||||
interface nsIStreamListener : nsIStreamObserver
|
||||
{
|
||||
void OnDataAvailable(in nsISupports ctxt,
|
||||
in nsIInputStream inStr,
|
||||
in nsIBufferInputStream inStr,
|
||||
in unsigned long sourceOffset,
|
||||
in unsigned long count);
|
||||
};
|
||||
|
@ -44,6 +44,6 @@ NS_NewAsyncStreamListener(nsIStreamListener* *result,
|
|||
// in an input stream to be read by another thread.
|
||||
extern nsresult
|
||||
NS_NewSyncStreamListener(nsIStreamListener* *listener,
|
||||
nsIInputStream* *inStream);
|
||||
nsIBufferInputStream* *inStream);
|
||||
|
||||
%}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "nsIStreamObserver.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
}
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
@ -451,14 +451,14 @@ public:
|
|||
mIStream(nsnull), mLength(0) {}
|
||||
virtual ~nsOnDataAvailableEvent();
|
||||
|
||||
nsresult Init(nsIInputStream* aIStream, PRUint32 aSourceOffset,
|
||||
nsresult Init(nsIBufferInputStream* aIStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsIInputStream* mIStream;
|
||||
PRUint32 mSourceOffset;
|
||||
PRUint32 mLength;
|
||||
nsIBufferInputStream* mIStream;
|
||||
PRUint32 mSourceOffset;
|
||||
PRUint32 mLength;
|
||||
};
|
||||
|
||||
nsOnDataAvailableEvent::~nsOnDataAvailableEvent()
|
||||
|
@ -467,7 +467,7 @@ nsOnDataAvailableEvent::~nsOnDataAvailableEvent()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsOnDataAvailableEvent::Init(nsIInputStream* aIStream, PRUint32 aSourceOffset,
|
||||
nsOnDataAvailableEvent::Init(nsIBufferInputStream* aIStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
mSourceOffset = aSourceOffset;
|
||||
|
@ -486,9 +486,9 @@ nsOnDataAvailableEvent::HandleEvent()
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamListener::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "nsIFileStream.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
|
@ -212,7 +213,7 @@ nsFileTransport::OpenInputStream(nsIInputStream* *result)
|
|||
nsresult rv;
|
||||
|
||||
nsIStreamListener* syncListener;
|
||||
nsIInputStream* inStr;
|
||||
nsIBufferInputStream* inStr;
|
||||
rv = NS_NewSyncStreamListener(&syncListener, &inStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class nsFileTransportService;
|
|||
class nsIBaseStream;
|
||||
class nsIString;
|
||||
class nsIBuffer;
|
||||
class nsIInputStream;
|
||||
class nsIBufferInputStream;
|
||||
|
||||
class nsFileTransport : public nsIChannel, public nsIRunnable
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ protected:
|
|||
// state variables:
|
||||
nsIBaseStream* mFileStream; // cast to nsIInputStream/nsIOutputStream for reading/writing
|
||||
nsIBuffer* mBuffer;
|
||||
nsIInputStream* mBufferStream;
|
||||
nsIBufferInputStream* mBufferStream;
|
||||
nsresult mStatus;
|
||||
PRUint32 mSourceOffset;
|
||||
PRInt32 mAmount;
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
#include "nsSocketTransport.h"
|
||||
#include "nsSocketTransportService.h"
|
||||
#include "nsSocketTransportStreams.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsAutoLock.h"
|
||||
|
||||
//
|
||||
// This is the State table which maps current state to next state
|
||||
|
@ -253,7 +257,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
|
|||
// Enter the socket transport lock...
|
||||
// This lock protects access to socket transport member data...
|
||||
//
|
||||
Lock();
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("+++ Entering nsSocketTransport::Process() [this=%x].\t"
|
||||
|
@ -390,9 +394,6 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
|
|||
"CurrentState = %d\n\n",
|
||||
this, rv, mCurrentState));
|
||||
|
||||
// Leave the socket transport lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -868,7 +869,7 @@ nsSocketTransport::Suspend(void)
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Enter the socket transport lock...
|
||||
Lock();
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
mSuspendCount += 1;
|
||||
//
|
||||
|
@ -886,9 +887,6 @@ nsSocketTransport::Suspend(void)
|
|||
"mSuspendCount = %d.\n",
|
||||
this, rv, mSuspendCount));
|
||||
|
||||
// Leave the socket transport lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -899,7 +897,7 @@ nsSocketTransport::Resume(void)
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Enter the socket transport lock...
|
||||
Lock();
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
if (mSuspendCount) {
|
||||
mSuspendCount -= 1;
|
||||
|
@ -920,9 +918,6 @@ nsSocketTransport::Resume(void)
|
|||
"mSuspendCount = %d.\n",
|
||||
this, rv, mSuspendCount));
|
||||
|
||||
// Leave the socket transport lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -942,7 +937,7 @@ nsSocketTransport::AsyncRead(PRUint32 startPosition, PRInt32 readCount,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Enter the socket transport lock...
|
||||
Lock();
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("+++ Entering nsSocketTransport::AsyncRead() [this=%x].\n", this));
|
||||
|
@ -983,9 +978,6 @@ nsSocketTransport::AsyncRead(PRUint32 startPosition, PRInt32 readCount,
|
|||
("--- Leaving nsSocketTransport::AsyncRead() [this=%x]. rv = %x.\n",
|
||||
this, rv));
|
||||
|
||||
// Leave the socket transport lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1001,7 +993,7 @@ nsSocketTransport::AsyncWrite(nsIInputStream* aFromStream,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Enter the socket transport lock...
|
||||
Lock();
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("+++ Entering nsSocketTransport::AsyncWrite() [this=%x].\n", this));
|
||||
|
@ -1012,7 +1004,10 @@ nsSocketTransport::AsyncWrite(nsIInputStream* aFromStream,
|
|||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mWriteStream = aFromStream;
|
||||
nsIBufferInputStream* str;
|
||||
rv = aFromStream->QueryInterface(nsIBufferInputStream::GetIID(), (void**)&str); // XXX not sure this is the right thing here
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mWriteStream = str;
|
||||
NS_ADDREF(mWriteStream);
|
||||
|
||||
NS_IF_RELEASE(mWriteContext);
|
||||
|
@ -1035,9 +1030,6 @@ nsSocketTransport::AsyncWrite(nsIInputStream* aFromStream,
|
|||
("--- Leaving nsSocketTransport::AsyncWrite() [this=%x]. rv = %x.\n",
|
||||
this, rv));
|
||||
|
||||
// Leave the socket transport lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1048,7 +1040,7 @@ nsSocketTransport::OpenInputStream(nsIInputStream* *result)
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Enter the socket transport lock...
|
||||
Lock();
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("+++ Entering nsSocketTransport::OpenInputStream() [this=%x].\n",
|
||||
|
@ -1084,9 +1076,6 @@ nsSocketTransport::OpenInputStream(nsIInputStream* *result)
|
|||
"rv = %x.\n",
|
||||
this, rv));
|
||||
|
||||
// Leave the socket transport lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1097,7 +1086,7 @@ nsSocketTransport::OpenOutputStream(nsIOutputStream* *result)
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Enter the socket transport lock...
|
||||
Lock();
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("+++ Entering nsSocketTransport::OpenOutputStream() [this=%x].\n",
|
||||
|
@ -1118,9 +1107,10 @@ nsSocketTransport::OpenOutputStream(nsIOutputStream* *result)
|
|||
// is called.
|
||||
|
||||
// XXX not sure if this should be blocking (PR_TRUE) or non-blocking.
|
||||
rv = NS_NewPipe(&mWriteStream,
|
||||
result,
|
||||
PR_FALSE, MAX_IO_BUFFER_SIZE);
|
||||
nsIBufferOutputStream* out = nsnull;
|
||||
rv = NS_NewPipe2(&mWriteStream, &out,
|
||||
MAX_IO_BUFFER_SIZE, MAX_IO_BUFFER_SIZE);
|
||||
*result = out;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -1134,9 +1124,6 @@ nsSocketTransport::OpenOutputStream(nsIOutputStream* *result)
|
|||
"rv = %x.\n",
|
||||
this, rv));
|
||||
|
||||
// Leave the socket transport lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
|
||||
//
|
||||
// This is the size of the global buffer used by all nsSocketTransport
|
||||
|
@ -108,10 +108,6 @@ protected:
|
|||
nsresult doRead(PRInt16 aSelectFlags);
|
||||
nsresult doWrite(PRInt16 aSelectFlags);
|
||||
|
||||
// Inline helpers...
|
||||
void Lock (void) { NS_ASSERTION(mLock, "Lock null."); PR_Lock(mLock); }
|
||||
void Unlock(void) { NS_ASSERTION(mLock, "Lock null."); PR_Unlock(mLock); }
|
||||
|
||||
protected:
|
||||
PRCList mListLink;
|
||||
|
||||
|
@ -134,7 +130,7 @@ protected:
|
|||
|
||||
nsISupports* mWriteContext;
|
||||
nsIStreamObserver* mWriteObserver;
|
||||
nsIInputStream* mWriteStream;
|
||||
nsIBufferInputStream* mWriteStream;
|
||||
|
||||
PRUint32 mSourceOffset;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "nsSocketTransportService.h"
|
||||
#include "nsSocketTransport.h"
|
||||
|
||||
#include "nsAutoLock.h"
|
||||
|
||||
#define MAX_OPEN_CONNECTIONS 50
|
||||
|
||||
|
@ -166,17 +166,18 @@ nsresult nsSocketTransportService::AddToWorkQ(nsSocketTransport* aTransport)
|
|||
nsresult rv = NS_OK;
|
||||
PRCList* qp;
|
||||
|
||||
Lock();
|
||||
//
|
||||
// Only add the transport if it is *not* already on the list...
|
||||
//
|
||||
qp = aTransport->GetListNode();
|
||||
if (PR_CLIST_IS_EMPTY(qp)) {
|
||||
NS_ADDREF(aTransport);
|
||||
bFireEvent = PR_CLIST_IS_EMPTY(&mWorkQ);
|
||||
PR_APPEND_LINK(qp, &mWorkQ);
|
||||
{
|
||||
nsAutoLock lock(mThreadLock);
|
||||
//
|
||||
// Only add the transport if it is *not* already on the list...
|
||||
//
|
||||
qp = aTransport->GetListNode();
|
||||
if (PR_CLIST_IS_EMPTY(qp)) {
|
||||
NS_ADDREF(aTransport);
|
||||
bFireEvent = PR_CLIST_IS_EMPTY(&mWorkQ);
|
||||
PR_APPEND_LINK(qp, &mWorkQ);
|
||||
}
|
||||
}
|
||||
Unlock();
|
||||
//
|
||||
// Only fire an event if this is the first entry in the workQ. Otherwise,
|
||||
// the event has already been fired and the transport thread will process
|
||||
|
@ -204,7 +205,7 @@ nsresult nsSocketTransportService::ProcessWorkQ(void)
|
|||
// XXX: Need a way to restart the ProcessWorkQ(...) when space becomes
|
||||
// available in the select set...
|
||||
//
|
||||
Lock();
|
||||
nsAutoLock lock(mThreadLock);
|
||||
while (!PR_CLIST_IS_EMPTY(&mWorkQ) &&
|
||||
(MAX_OPEN_CONNECTIONS > mSelectFDSetCount)) {
|
||||
nsSocketTransport* transport;
|
||||
|
@ -229,7 +230,6 @@ nsresult nsSocketTransportService::ProcessWorkQ(void)
|
|||
// Release the transport object (since it is no longer on the WorkQ).
|
||||
NS_RELEASE(transport);
|
||||
}
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -61,10 +61,6 @@ public:
|
|||
nsresult RemoveFromSelectList(nsSocketTransport* aTransport);
|
||||
|
||||
protected:
|
||||
// Inline helpers...
|
||||
void Lock (void) { NS_ASSERTION(mThreadLock, "Lock null."); PR_Lock(mThreadLock); }
|
||||
void Unlock(void) { NS_ASSERTION(mThreadLock, "Lock null."); PR_Unlock(mThreadLock); }
|
||||
|
||||
nsIThread* mThread;
|
||||
PRFileDesc* mThreadEvent;
|
||||
PRLock* mThreadLock;
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "nsIBuffer.h"
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// Private implementation of a nsIByteBufferInputStream used by the
|
||||
// Private implementation of a nsIBufferInputStream used by the
|
||||
// nsSocketTransport implementation
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -103,8 +103,10 @@ nsresult nsSocketTransportStream::Init(nsSocketTransport* aTransport,
|
|||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_NewByteBufferInputStream(&mStream, PR_FALSE,
|
||||
MAX_IO_BUFFER_SIZE);
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, MAX_IO_BUFFER_SIZE, MAX_IO_BUFFER_SIZE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = NS_NewBufferInputStream(&mStream, buf);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -138,7 +140,7 @@ nsresult nsSocketTransportStream::BlockTransport(void)
|
|||
//
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsSocketTransportStream,
|
||||
nsIByteBufferInputStream::GetIID());
|
||||
nsIBufferInputStream::GetIID());
|
||||
|
||||
|
||||
//
|
||||
|
@ -218,14 +220,20 @@ nsSocketTransportStream::Read(char * aBuf, PRUint32 aCount,
|
|||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsIByteBufferInputStream implementation...
|
||||
// nsIBufferInputStream implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportStream::Fill(nsIInputStream* aStream,
|
||||
PRUint32 aCount,
|
||||
PRUint32 *aWriteCount)
|
||||
nsSocketTransportStream::GetBuffer(nsIBuffer* *result)
|
||||
{
|
||||
return mStream->GetBuffer(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportStream::FillFrom(nsIInputStream* aStream,
|
||||
PRUint32 aCount,
|
||||
PRUint32 *aWriteCount)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -237,7 +245,7 @@ nsSocketTransportStream::Fill(nsIInputStream* aStream,
|
|||
"aCount=%d\n",
|
||||
this, aCount));
|
||||
|
||||
rv = mStream->Fill(aStream, aCount, aWriteCount);
|
||||
rv = mStream->FillFrom(aStream, aCount, aWriteCount);
|
||||
|
||||
if (mIsStreamBlocking && (NS_BASE_STREAM_WOULD_BLOCK != rv)) {
|
||||
Notify();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -20,14 +20,14 @@
|
|||
#define nsSocketTransportStreams_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
|
||||
|
||||
// Forward declarations...
|
||||
class nsSocketTransport;
|
||||
|
||||
|
||||
class nsSocketTransportStream : public nsIByteBufferInputStream
|
||||
class nsSocketTransportStream : public nsIBufferInputStream
|
||||
{
|
||||
public:
|
||||
nsSocketTransportStream();
|
||||
|
@ -42,9 +42,10 @@ public:
|
|||
NS_IMETHOD GetLength(PRUint32 *aResult);
|
||||
NS_IMETHOD Read(char * aBuf, PRUint32 aCount, PRUint32 *aReadCount);
|
||||
|
||||
// nsIByteBufferInputStream methods:
|
||||
NS_IMETHOD Fill(nsIInputStream* stream, PRUint32 aCount, PRUint32 *aWriteCount);
|
||||
// nsIBufferInputStream methods:
|
||||
NS_IMETHOD GetBuffer(nsIBuffer* *result);
|
||||
NS_IMETHOD Fill(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
|
||||
NS_IMETHOD FillFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval);
|
||||
|
||||
// nsSocketTransportStream methods:
|
||||
nsresult Init(nsSocketTransport* aTransport, PRBool aBlockingFlag);
|
||||
|
@ -64,7 +65,7 @@ private:
|
|||
PRBool mIsStreamBlocking;
|
||||
|
||||
PRMonitor* mMonitor;
|
||||
nsIByteBufferInputStream* mStream;
|
||||
nsIBufferInputStream* mStream;
|
||||
nsSocketTransport* mTransport;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
*/
|
||||
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsIBuffer.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -41,7 +42,7 @@ public:
|
|||
|
||||
// nsIStreamListener methods:
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
@ -52,21 +53,21 @@ public:
|
|||
}
|
||||
virtual ~nsSyncStreamListener();
|
||||
|
||||
nsresult Init(nsIInputStream* *result);
|
||||
nsresult Init(nsIBufferInputStream* *result);
|
||||
|
||||
protected:
|
||||
nsIOutputStream* mOutputStream;
|
||||
nsIBufferOutputStream* mOutputStream;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsSyncStreamListener::Init(nsIInputStream* *result)
|
||||
nsSyncStreamListener::Init(nsIBufferInputStream* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIInputStream* in;
|
||||
nsIBufferInputStream* in;
|
||||
|
||||
rv = NS_NewPipe(&in, &mOutputStream);
|
||||
rv = NS_NewPipe2(&in, &mOutputStream, 4 * 1024, 16 * 1024);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = in;
|
||||
|
@ -127,7 +128,7 @@ nsSyncStreamListener::OnStopRequest(nsISupports* context,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsSyncStreamListener::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
|
@ -146,7 +147,7 @@ nsSyncStreamListener::OnDataAvailable(nsISupports* context,
|
|||
|
||||
nsresult
|
||||
NS_NewSyncStreamListener(nsIStreamListener* *listener,
|
||||
nsIInputStream* *inStream)
|
||||
nsIBufferInputStream* *inStream)
|
||||
{
|
||||
nsSyncStreamListener* l = new nsSyncStreamListener();
|
||||
if (l == nsnull)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "nsFTPChannel.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsFtpConnectionThread.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
@ -260,9 +260,9 @@ nsFTPChannel::OnStopRequest(nsISupports* context,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
// Fill in the buffer w/ the new data.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
// nsIStreamListener methods:
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "nsIChannel.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#include "nsIByteBufferInputStream.h" // for our internal stream state
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h" // for our internal stream state
|
||||
#include "nsIInputStream.h"
|
||||
|
||||
#include "prprf.h"
|
||||
|
@ -825,9 +825,11 @@ nsFtpConnectionThread::Run() {
|
|||
// We're receiving a directory listing.
|
||||
// Read it from the data stream.
|
||||
PRUint32 bytes = 0, len = 0;
|
||||
nsIByteBufferInputStream* in;
|
||||
nsIBufferInputStream* in;
|
||||
|
||||
rv = NS_NewByteBufferInputStream(&in);
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, 4 * 1024, 16 * 1024);
|
||||
rv = NS_NewBufferInputStream(&in, buf);
|
||||
if (NS_FAILED(rv)) {
|
||||
mState = FTP_ERROR;
|
||||
break;
|
||||
|
@ -938,9 +940,11 @@ nsFtpConnectionThread::Run() {
|
|||
// We're receiving a file.
|
||||
// Read it from the data stream.
|
||||
PRUint32 bytes = 0, len = 0;
|
||||
nsIByteBufferInputStream* in;
|
||||
nsIBufferInputStream* in;
|
||||
|
||||
rv = NS_NewByteBufferInputStream(&in);
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, 4 * 1024, 16 * 1024);
|
||||
rv = NS_NewBufferInputStream(&in, buf);
|
||||
if (NS_FAILED(rv)) {
|
||||
mState = FTP_ERROR;
|
||||
break;
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "nsFtpStreamListenerEvent.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIString.h"
|
||||
|
||||
|
@ -117,7 +116,7 @@ nsFtpOnDataAvailableEvent::~nsFtpOnDataAvailableEvent()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsFtpOnDataAvailableEvent::Init(nsIInputStream* aIStream,
|
||||
nsFtpOnDataAvailableEvent::Init(nsIBufferInputStream* aIStream,
|
||||
PRUint32 aSourceOffset, PRUint32 aLength)
|
||||
{
|
||||
mLength = aLength;
|
||||
|
@ -136,7 +135,7 @@ nsFtpOnDataAvailableEvent::HandleEvent()
|
|||
/*
|
||||
NS_IMETHODIMP
|
||||
nsMarshalingStreamListener::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
|
|
|
@ -61,13 +61,13 @@ public:
|
|||
mIStream(nsnull), mLength(0) {}
|
||||
virtual ~nsFtpOnDataAvailableEvent();
|
||||
|
||||
nsresult Init(nsIInputStream* aIStream, PRUint32 aSourceOffset, PRUint32 aLength);
|
||||
nsresult Init(nsIBufferInputStream* aIStream, PRUint32 aSourceOffset, PRUint32 aLength);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsIInputStream* mIStream;
|
||||
PRUint32 mSourceOffset;
|
||||
PRUint32 mLength;
|
||||
nsIBufferInputStream* mIStream;
|
||||
PRUint32 mSourceOffset;
|
||||
PRUint32 mLength;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
#include "nsHeaderPair.h"
|
||||
#include "kHTTPHeaders.h"
|
||||
#include "nsHTTPEnums.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "plstr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIChannel.h"
|
||||
|
@ -73,9 +74,15 @@ NS_IMPL_ADDREF(nsHTTPRequest);
|
|||
nsresult
|
||||
nsHTTPRequest::Build()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (m_Request)
|
||||
NS_ERROR("Request already built!");
|
||||
nsresult rv = NS_NewByteBufferInputStream(&m_Request);
|
||||
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, 4 * 1024, 16 * 1024);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = NS_NewBufferInputStream(&m_Request, buf);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
class nsIInputStream;
|
||||
class nsIURL;
|
||||
class nsVoidArray;
|
||||
class nsIByteBufferInputStream;
|
||||
class nsIBufferInputStream;
|
||||
class nsIChannel;
|
||||
class nsHTTPChannel;
|
||||
|
||||
|
@ -298,7 +298,7 @@ protected:
|
|||
HTTPVersion m_Version;
|
||||
HTTPMethod m_Method;
|
||||
// The actual request stream!
|
||||
nsIByteBufferInputStream* m_Request;
|
||||
nsIBufferInputStream* m_Request;
|
||||
nsVoidArray* m_pArray;
|
||||
nsIChannel* m_pTransport;
|
||||
nsHTTPChannel* m_pConnection;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "nsIStreamListener.h"
|
||||
#include "nsHTTPResponseListener.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsHTTPChannel.h"
|
||||
#include "nsHTTPResponse.h"
|
||||
#include "nsIHttpEventSink.h"
|
||||
|
@ -50,9 +50,9 @@ NS_IMPL_ISUPPORTS(nsHTTPResponseListener,nsIStreamListener::GetIID());
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsHTTPResponseListener::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *i_pStream,
|
||||
PRUint32 i_SourceOffset,
|
||||
PRUint32 i_Length)
|
||||
nsIBufferInputStream *i_pStream,
|
||||
PRUint32 i_SourceOffset,
|
||||
PRUint32 i_Length)
|
||||
{
|
||||
nsIInputStream* inStr = nsnull;
|
||||
|
||||
|
|
|
@ -53,9 +53,9 @@ public:
|
|||
|
||||
// nsIStreamListener functions
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
||||
NS_IMETHOD OnStartBinding(nsISupports* context);
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "prio.h"
|
||||
#include "nsIFileStream.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIChannel.h"
|
||||
|
@ -113,7 +114,7 @@ public:
|
|||
}
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
PR_EnterMonitor(mMonitor);
|
||||
|
@ -204,7 +205,7 @@ Simulated_nsFileTransport_Run(nsReader* reader, const char* path)
|
|||
nsresult rv;
|
||||
nsISupports* fs;
|
||||
nsIInputStream* fileStr = nsnull;
|
||||
nsIByteBufferInputStream* bufStr = nsnull;
|
||||
nsIBufferInputStream* bufStr = nsnull;
|
||||
nsFileSpec spec(path);
|
||||
PRUint32 sourceOffset = 0;
|
||||
|
||||
|
@ -218,7 +219,9 @@ Simulated_nsFileTransport_Run(nsReader* reader, const char* path)
|
|||
NS_RELEASE(fs);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = NS_NewByteBufferInputStream(&bufStr, PR_FALSE, NS_FILE_TRANSPORT_BUFFER_SIZE);
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, NS_FILE_TRANSPORT_BUFFER_SIZE, NS_FILE_TRANSPORT_BUFFER_SIZE);
|
||||
rv = NS_NewBufferInputStream(&bufStr, buf);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
if ( spec.GetFileSize() == 0) goto done;
|
||||
|
@ -226,7 +229,7 @@ Simulated_nsFileTransport_Run(nsReader* reader, const char* path)
|
|||
while (PR_TRUE) {
|
||||
PRUint32 amt;
|
||||
/* id'l change to FillFrom... */
|
||||
rv = bufStr->Fill(fileStr, spec.GetFileSize(), &amt);
|
||||
rv = bufStr->FillFrom(fileStr, spec.GetFileSize(), &amt);
|
||||
if (rv == NS_BASE_STREAM_EOF) {
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "nsIStreamObserver.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIURL.h"
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
NS_IMETHOD OnStartBinding(nsISupports* context);
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
@ -124,7 +124,7 @@ InputTestConsumer::OnStartBinding(nsISupports* context)
|
|||
|
||||
NS_IMETHODIMP
|
||||
InputTestConsumer::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#include "nsIChannel.h"
|
||||
#include "nsIStreamObserver.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
NS_IMETHOD OnStartBinding(nsISupports* context);
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
@ -100,7 +100,7 @@ InputTestConsumer::OnStartBinding(nsISupports* context)
|
|||
|
||||
NS_IMETHODIMP
|
||||
InputTestConsumer::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
|
@ -235,10 +235,12 @@ main(int argc, char* argv[])
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Create a stream for the data being written to the server...
|
||||
nsIByteBufferInputStream* stream;
|
||||
nsIBufferInputStream* stream;
|
||||
PRUint32 bytesWritten;
|
||||
|
||||
rv = NS_NewByteBufferInputStream(&stream);
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, 1024, 4096);
|
||||
rv = NS_NewBufferInputStream(&stream, buf);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char *buffer = PR_smprintf("GET %s HTML/1.0%s%s", fileName, CRLF, CRLF);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
NS_IMETHOD OnStartBinding(nsISupports* context);
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
@ -93,7 +93,7 @@ InputTestConsumer::OnStartBinding(nsISupports* context)
|
|||
|
||||
NS_IMETHODIMP
|
||||
InputTestConsumer::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
|
|
|
@ -30,8 +30,9 @@
|
|||
#include "nsIChannel.h"
|
||||
#include "nsIStreamObserver.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
|
@ -88,7 +89,7 @@ public:
|
|||
char GetBufferChar(void) { return mBufferChar; }
|
||||
|
||||
protected:
|
||||
nsIByteBufferInputStream* mStream;
|
||||
nsIBufferInputStream* mStream;
|
||||
|
||||
nsIInputStream* mInStream;
|
||||
nsIOutputStream* mOutStream;
|
||||
|
@ -124,7 +125,7 @@ public:
|
|||
NS_IMETHOD OnStartBinding(nsISupports* context);
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
@ -176,7 +177,7 @@ InputConsumer::OnStartBinding(nsISupports* context)
|
|||
|
||||
NS_IMETHODIMP
|
||||
InputConsumer::OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
|
@ -189,7 +190,7 @@ InputConsumer::OnDataAvailable(nsISupports* context,
|
|||
nsresult rv = aIStream->Read(buf, 1024, &amt);
|
||||
mBytesRead += amt;
|
||||
buf[amt] = '\0';
|
||||
/// printf(buf);
|
||||
printf(buf);
|
||||
} while (amt != 0);
|
||||
|
||||
if (mConnection->GetBufferLength() == mBytesRead) {
|
||||
|
@ -340,7 +341,9 @@ TestConnection::TestConnection(const char* aHostName, PRInt32 aPort, PRBool aAsy
|
|||
|
||||
// Create a stream for the data being written to the server...
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_NewByteBufferInputStream(&mStream);
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, 1024, 4096);
|
||||
rv = NS_NewBufferInputStream(&mStream, buf);
|
||||
}
|
||||
}
|
||||
// Synchronous transport...
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
// stream listener methods
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
|
@ -98,11 +98,10 @@ TestConsumer::~TestConsumer()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TestConsumer::OnDataAvailable(
|
||||
nsISupports *context,
|
||||
nsIInputStream* aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
NS_IMETHODIMP TestConsumer::OnDataAvailable(nsISupports *context,
|
||||
nsIBufferInputStream* aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
PRUint32 len;
|
||||
|
||||
if (bTraceEnabled) {
|
||||
|
|
|
@ -48,11 +48,6 @@ public:
|
|||
PRUint32 aLen,
|
||||
PRUint32 *aWriteLength);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush(void) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -113,11 +113,6 @@ public:
|
|||
PRUint32 aLen,
|
||||
PRUint32 *aWriteCount);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush(void) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -158,11 +153,6 @@ public:
|
|||
PRUint32 aLen,
|
||||
PRUint32 *aWriteLength);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush(void) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -205,11 +195,6 @@ public:
|
|||
PRUint32 aLen,
|
||||
PRUint32 *aWriteLength);
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush(void) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -154,11 +154,6 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush(void) {
|
||||
PR_Sync(PR_GetSpecialFD(PR_StandardOutput));
|
||||
return NS_OK;
|
||||
|
|
|
@ -135,11 +135,6 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
|
||||
PRUint32 *aWriteCount) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
PR_Sync(PR_GetSpecialFD(PR_StandardOutput));
|
||||
return NS_OK;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "nsIAtom.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
//#include "nsIByteBufferInputStream.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsFileSpecStreaming.h"
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
|
@ -50,7 +50,7 @@ void XXXNeverCalled()
|
|||
nsVoidArray();
|
||||
NS_GetNumberOfAtoms();
|
||||
nsFileURL(NULL);
|
||||
NS_NewPipe(NULL, NULL);
|
||||
// NS_NewPipe(NULL, NULL);
|
||||
NS_NewPipe2(NULL, NULL, 0, 0);
|
||||
nsFileSpec s;
|
||||
NS_NewIOFileStream(NULL, s, 0, 0);
|
||||
|
|
|
@ -318,7 +318,13 @@ nsBuffer::WriteFrom(nsIInputStream* fromStream, PRUint32 count, PRUint32 *writeC
|
|||
|
||||
PRUint32 readCount;
|
||||
rv = fromStream->Read(writeBuf, PR_MIN(writeBufLen, count), &readCount);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (rv == NS_BASE_STREAM_EOF) {
|
||||
// If the input stream ends, set EOF on the buffer so that
|
||||
// nsBuffer::Read later notices it.
|
||||
SetEOF();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (NS_FAILED(rv)) {
|
||||
// if we failed to read just report what we were
|
||||
// able to write so far
|
||||
return NS_OK;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
class nsIInputStream;
|
||||
class nsIAllocator;
|
||||
class nsIInputStream;
|
||||
class nsIOutputStream;
|
||||
class nsIBufferInputStream;
|
||||
class nsIBufferOutputStream;
|
||||
|
||||
#define NS_IBUFFER_IID \
|
||||
{ /* 1eebb300-fb8b-11d2-9324-00104ba0fd40 */ \
|
||||
|
@ -97,16 +97,16 @@ NS_NewPageBuffer(nsIBuffer* *result,
|
|||
PRUint32 growBySize, PRUint32 maxSize);
|
||||
|
||||
extern NS_COM nsresult
|
||||
NS_NewBufferInputStream(nsIInputStream* *result,
|
||||
NS_NewBufferInputStream(nsIBufferInputStream* *result,
|
||||
nsIBuffer* buffer, PRBool blocking = PR_FALSE);
|
||||
|
||||
extern NS_COM nsresult
|
||||
NS_NewBufferOutputStream(nsIOutputStream* *result,
|
||||
NS_NewBufferOutputStream(nsIBufferOutputStream* *result,
|
||||
nsIBuffer* buffer, PRBool blocking = PR_FALSE);
|
||||
|
||||
extern NS_COM nsresult
|
||||
NS_NewPipe2(nsIInputStream* *inStrResult,
|
||||
nsIOutputStream* *outStrResult,
|
||||
NS_NewPipe2(nsIBufferInputStream* *inStrResult,
|
||||
nsIBufferOutputStream* *outStrResult,
|
||||
PRUint32 growBySize, PRUint32 maxSize);
|
||||
|
||||
#endif // nsIBuffer_h___
|
||||
|
|
|
@ -30,16 +30,16 @@ MODULE = xpcom
|
|||
|
||||
XPIDL_MODULE = xpcom_io
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIFileSpec.idl \
|
||||
nsIBaseStream.idl \
|
||||
nsIInputStream.idl \
|
||||
nsIOutputStream.idl \
|
||||
nsIBufferInputStream.idl \
|
||||
XPIDLSRCS = \
|
||||
nsIFileSpec.idl \
|
||||
nsIBaseStream.idl \
|
||||
nsIInputStream.idl \
|
||||
nsIOutputStream.idl \
|
||||
nsIBufferInputStream.idl \
|
||||
nsIBufferOutputStream.idl \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsByteBufferInputStream.cpp \
|
||||
nsEscape.cpp \
|
||||
nsFileSpec.cpp \
|
||||
nsFileSpecStreaming.cpp \
|
||||
|
@ -58,7 +58,6 @@ EXPORTS = \
|
|||
nsFileSpecImpl.h \
|
||||
nsFileSpecStreaming.h \
|
||||
nsFileStream.h \
|
||||
nsIByteBufferInputStream.h \
|
||||
nsIFileStream.h \
|
||||
nsIStringStream.h \
|
||||
nsIUnicharInputStream.h \
|
||||
|
|
|
@ -29,7 +29,6 @@ EXPORTS = \
|
|||
nsFileSpecImpl.h \
|
||||
nsFileSpecStreaming.h \
|
||||
nsFileStream.h \
|
||||
nsIByteBufferInputStream.h \
|
||||
nsIFileStream.h \
|
||||
nsIStringStream.h \
|
||||
nsIUnicharInputStream.h \
|
||||
|
@ -39,12 +38,13 @@ EXPORTS = \
|
|||
NO_XPT_GEN=1
|
||||
XPIDL_MODULE = xpcom_io
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIFileSpec.idl \
|
||||
.\nsIBaseStream.idl \
|
||||
.\nsIInputStream.idl \
|
||||
.\nsIOutputStream.idl \
|
||||
.\nsIBufferInputStream.idl \
|
||||
XPIDLSRCS = \
|
||||
.\nsIFileSpec.idl \
|
||||
.\nsIBaseStream.idl \
|
||||
.\nsIInputStream.idl \
|
||||
.\nsIOutputStream.idl \
|
||||
.\nsIBufferInputStream.idl \
|
||||
.\nsIBufferOutputStream.idl \
|
||||
$(NULL)
|
||||
|
||||
################################################################################
|
||||
|
@ -63,7 +63,6 @@ LINCS = $(LINCS) -I$(PUBLIC)\raptor # until we sort out the filespec/widgets
|
|||
LCFLAGS = -D_IMPL_NS_COM -D_IMPL_NS_BASE -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsByteBufferInputStream.obj \
|
||||
.\$(OBJDIR)\nsEscape.obj \
|
||||
.\$(OBJDIR)\nsFileSpec.obj \
|
||||
.\$(OBJDIR)\nsFileSpecImpl.obj \
|
||||
|
|
|
@ -27,4 +27,16 @@ interface nsIBufferInputStream : nsIInputStream
|
|||
* Returns the buffer underlying this input stream.
|
||||
*/
|
||||
readonly attribute nsIBuffer Buffer;
|
||||
|
||||
/**
|
||||
* Fill the input stream so that someone can read from it.
|
||||
*/
|
||||
unsigned long Fill(in string inStr,
|
||||
in unsigned long count);
|
||||
|
||||
/**
|
||||
* Fill the input stream so that someone can read from it.
|
||||
*/
|
||||
unsigned long FillFrom(in nsIInputStream inStr,
|
||||
in unsigned long count);
|
||||
};
|
||||
|
|
|
@ -27,4 +27,20 @@ interface nsIBufferOutputStream : nsIOutputStream
|
|||
* Returns the buffer underlying this output stream.
|
||||
*/
|
||||
readonly attribute nsIBuffer Buffer;
|
||||
|
||||
/**
|
||||
* Writes data into the stream from an input stream.
|
||||
* Implementer's note: This method is defined by this interface in order
|
||||
* to allow the output stream to efficiently copy the data from the input
|
||||
* stream into its internal buffer (if any). If this method was provide
|
||||
* as an external facility, a separate char* buffer would need to be used
|
||||
* in order to call the output stream's other Write method.
|
||||
* @param fromStream the stream from which the data is read
|
||||
* @param count the maximun number of bytes to write
|
||||
* @return aWriteCount out parameter to hold the number of
|
||||
* bytes written. if an error occurs, the writecount
|
||||
* is undefined
|
||||
*/
|
||||
unsigned long WriteFrom(in nsIInputStream inStr, in unsigned long count);
|
||||
|
||||
};
|
||||
|
|
|
@ -154,11 +154,6 @@ class FileImpl
|
|||
*aWriteCount = bytesWrit;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount,
|
||||
PRUint32 *aWriteCount)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHOD Flush();
|
||||
|
||||
NS_IMETHOD GetAtEOF(PRBool* outAtEOF)
|
||||
|
|
|
@ -31,21 +31,6 @@ interface nsIOutputStream : nsIBaseStream
|
|||
*/
|
||||
unsigned long Write(in string buf, in unsigned long count);
|
||||
|
||||
/**
|
||||
* Writes data into the stream from an input stream.
|
||||
* Implementer's note: This method is defined by this interface in order
|
||||
* to allow the output stream to efficiently copy the data from the input
|
||||
* stream into its internal buffer (if any). If this method was provide
|
||||
* as an external facility, a separate char* buffer would need to be used
|
||||
* in order to call the output stream's other Write method.
|
||||
* @param fromStream the stream from which the data is read
|
||||
* @param count the maximun number of bytes to write
|
||||
* @return aWriteCount out parameter to hold the number of
|
||||
* bytes written. if an error occurs, the writecount
|
||||
* is undefined
|
||||
*/
|
||||
unsigned long WriteFrom(in nsIInputStream inStr, in unsigned long count);
|
||||
|
||||
/**
|
||||
* Flushes the stream.
|
||||
*/
|
||||
|
|
|
@ -110,11 +110,6 @@ class BasicStringImpl
|
|||
*aWriteCount = bytesWrit;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount,
|
||||
PRUint32 *aWriteCount)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
public:
|
||||
|
||||
// nsISupports interface
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsAutoLock.h"
|
||||
|
||||
class nsBufferInputStream;
|
||||
|
@ -39,6 +39,8 @@ public:
|
|||
|
||||
// nsIBufferInputStream methods:
|
||||
NS_IMETHOD GetBuffer(nsIBuffer* *result);
|
||||
NS_IMETHOD Fill(const char *buf, PRUint32 count, PRUint32 *_retval);
|
||||
NS_IMETHOD FillFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval);
|
||||
|
||||
// nsBufferInputStream methods:
|
||||
nsBufferInputStream(nsIBuffer* buf, PRBool blocking);
|
||||
|
@ -63,7 +65,7 @@ protected:
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsBufferOutputStream : public nsIOutputStream
|
||||
class nsBufferOutputStream : public nsIBufferOutputStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -73,9 +75,12 @@ public:
|
|||
|
||||
// nsIOutputStream methods:
|
||||
NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
|
||||
NS_IMETHOD Flush(void);
|
||||
|
||||
// nsIBufferOutputStream methods:
|
||||
NS_IMETHOD GetBuffer(nsIBuffer * *aBuffer);
|
||||
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount,
|
||||
PRUint32 *aWriteCount);
|
||||
NS_IMETHOD Flush(void);
|
||||
|
||||
// nsBufferOutputStream methods:
|
||||
nsBufferOutputStream(nsIBuffer* buf, PRBool blocking);
|
||||
|
@ -110,7 +115,8 @@ nsBufferInputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
{
|
||||
if (aInstancePtr == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(nsIInputStream::GetIID()) ||
|
||||
if (aIID.Equals(nsIBufferInputStream::GetIID()) ||
|
||||
aIID.Equals(nsIInputStream::GetIID()) ||
|
||||
aIID.Equals(nsIBaseStream::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
*aInstancePtr = this;
|
||||
|
@ -181,11 +187,32 @@ nsBufferInputStream::Read(char* aBuf, PRUint32 aCount, PRUint32 *aReadCount)
|
|||
NS_IMETHODIMP
|
||||
nsBufferInputStream::GetBuffer(nsIBuffer* *result)
|
||||
{
|
||||
if (mBuffer == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
*result = mBuffer;
|
||||
NS_ADDREF(mBuffer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferInputStream::Fill(const char* buf, PRUint32 count, PRUint32 *result)
|
||||
{
|
||||
if (mBuffer == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
return mBuffer->Write(buf, count, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferInputStream::FillFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *result)
|
||||
{
|
||||
if (mBuffer == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
return mBuffer->WriteFrom(inStr, count, result);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBufferInputStream::SetEOF()
|
||||
{
|
||||
|
@ -238,7 +265,8 @@ nsBufferInputStream::Fill()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewBufferInputStream(nsIInputStream* *result, nsIBuffer* buffer, PRBool blocking)
|
||||
NS_NewBufferInputStream(nsIBufferInputStream* *result,
|
||||
nsIBuffer* buffer, PRBool blocking)
|
||||
{
|
||||
nsBufferInputStream* str = new nsBufferInputStream(buffer, blocking);
|
||||
if (str == nsnull)
|
||||
|
@ -272,7 +300,8 @@ nsBufferOutputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
{
|
||||
if (aInstancePtr == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(nsIOutputStream::GetIID()) ||
|
||||
if (aIID.Equals(nsIBufferOutputStream::GetIID()) ||
|
||||
aIID.Equals(nsIOutputStream::GetIID()) ||
|
||||
aIID.Equals(nsIBaseStream::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
*aInstancePtr = this;
|
||||
|
@ -388,10 +417,19 @@ nsBufferOutputStream::Flush(void)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferOutputStream::GetBuffer(nsIBuffer * *aBuffer)
|
||||
{
|
||||
*aBuffer = mBuffer;
|
||||
NS_ADDREF(mBuffer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewBufferOutputStream(nsIOutputStream* *result, nsIBuffer* buffer, PRBool blocking)
|
||||
NS_NewBufferOutputStream(nsIBufferOutputStream* *result,
|
||||
nsIBuffer* buffer, PRBool blocking)
|
||||
{
|
||||
nsBufferOutputStream* ostr = new nsBufferOutputStream(buffer, blocking);
|
||||
if (ostr == nsnull)
|
||||
|
@ -404,13 +442,13 @@ NS_NewBufferOutputStream(nsIOutputStream* *result, nsIBuffer* buffer, PRBool blo
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewPipe2(nsIInputStream* *inStrResult,
|
||||
nsIOutputStream* *outStrResult,
|
||||
NS_NewPipe2(nsIBufferInputStream* *inStrResult,
|
||||
nsIBufferOutputStream* *outStrResult,
|
||||
PRUint32 growBySize, PRUint32 maxSize)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIInputStream* inStr = nsnull;
|
||||
nsIOutputStream* outStr = nsnull;
|
||||
nsIBufferInputStream* inStr = nsnull;
|
||||
nsIBufferOutputStream* outStr = nsnull;
|
||||
nsIBuffer* buf = nsnull;
|
||||
|
||||
rv = NS_NewPageBuffer(&buf, growBySize, maxSize);
|
||||
|
|
|
@ -17,8 +17,12 @@
|
|||
*/
|
||||
|
||||
#include "nsIThread.h"
|
||||
#if 0 // obsolete old implementation
|
||||
#include "nsIByteBufferInputStream.h"
|
||||
#endif
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "prprf.h"
|
||||
#include "prinrval.h"
|
||||
|
@ -135,8 +139,8 @@ int
|
|||
main(int argc, char* argv[])
|
||||
{
|
||||
nsresult rv;
|
||||
nsIInputStream* in;
|
||||
nsIOutputStream* out;
|
||||
nsIBufferInputStream* in;
|
||||
nsIBufferOutputStream* out;
|
||||
nsIServiceManager* servMgr;
|
||||
|
||||
rv = NS_InitXPCOM(&servMgr);
|
||||
|
@ -149,7 +153,7 @@ main(int argc, char* argv[])
|
|||
|
||||
if (argc > 1 && nsCRT::strcmp(argv[1], "-trace") == 0)
|
||||
gTrace = PR_TRUE;
|
||||
|
||||
#if 0 // obsolete old implementation
|
||||
rv = NS_NewPipe(&in, &out, PR_TRUE, 4096 * 4);
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("NewPipe failed\n");
|
||||
|
@ -163,7 +167,7 @@ main(int argc, char* argv[])
|
|||
printf("TestPipe failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
rv = NS_NewPipe2(&in, &out, 4096, 4096 * 4);
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("NewPipe failed\n");
|
||||
|
|
Загрузка…
Ссылка в новой задаче