From bee72685ed67a2b0ab10e5424f44a847ab5bc6f9 Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Thu, 3 Jun 1999 21:50:47 +0000 Subject: [PATCH] IDLized stream interfaces. Required rename of overloaded Write method (now WriteFrom). git-svn-id: svn://10.0.0.236/trunk@33600 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/txmgr/tests/TestTXMgr.cpp | 3 +- .../mime/emitters/html/nsMimeEmitter.cpp | 1 + .../mime/emitters/raw/nsMimeEmitter.cpp | 1 + mozilla/mailnews/mime/src/plugin_inst.cpp | 1 + mozilla/mailnews/mime/src/plugin_inst.h | 3 +- mozilla/mailnews/news/public/makefile.win | 1 - mozilla/mailnews/news/src/nsNNTPProtocol.cpp | 1 + mozilla/modules/oji/src/lcglue.cpp | 1 + mozilla/modules/plugin/bad/badapter.cpp | 3 +- .../plugin/base/src/ns4xPluginInstance.cpp | 1 + .../plugin/base/src/nsPluginInstancePeer.cpp | 3 +- .../plugin/nglsrc/ns4xPluginInstance.cpp | 1 + .../plugin/nglsrc/nsPluginInstancePeer.cpp | 3 +- .../plugin/samples/backward/badapter.cpp | 3 +- mozilla/modules/plugin/src/npglue.h | 3 +- .../plugin/src/nsPluginManagerStream.h | 3 +- mozilla/network/cnvts/cvplugin.cpp | 2 +- mozilla/network/cnvts/nsNetConverterStream.h | 3 +- mozilla/network/module/nsNetStream.h | 9 ++-- mozilla/rdf/tests/rdfcat/rdfcat.cpp | 3 +- mozilla/rdf/tests/rdfsink/rdfsink.cpp | 3 +- mozilla/xpcom/base/nsrootidl.idl | 5 ++ mozilla/xpcom/io/Makefile.in | 10 ++-- mozilla/xpcom/io/makefile.win | 23 +++----- mozilla/xpcom/io/nsByteBufferInputStream.cpp | 15 +++--- mozilla/xpcom/io/nsByteBufferInputStream.h | 8 +-- mozilla/xpcom/io/nsIBaseStream.idl | 45 ++++++++++++++++ mozilla/xpcom/io/nsIBufferInputStream.idl | 47 ++++++++++++++++ mozilla/xpcom/io/nsIFileStream.cpp | 3 +- mozilla/xpcom/io/nsIInputStream.idl | 40 ++++++++++++++ mozilla/xpcom/io/nsIOutputStream.idl | 53 +++++++++++++++++++ mozilla/xpcom/io/nsIStringStream.cpp | 3 +- mozilla/xpcom/io/nsIUnicharInputStream.h | 2 + .../xptinfo/src/nsInterfaceInfoManager.cpp | 2 +- 34 files changed, 256 insertions(+), 52 deletions(-) create mode 100644 mozilla/xpcom/io/nsIBaseStream.idl create mode 100644 mozilla/xpcom/io/nsIBufferInputStream.idl create mode 100644 mozilla/xpcom/io/nsIInputStream.idl create mode 100644 mozilla/xpcom/io/nsIOutputStream.idl diff --git a/mozilla/editor/txmgr/tests/TestTXMgr.cpp b/mozilla/editor/txmgr/tests/TestTXMgr.cpp index c8d12e0cfab..6e082d9f55c 100644 --- a/mozilla/editor/txmgr/tests/TestTXMgr.cpp +++ b/mozilla/editor/txmgr/tests/TestTXMgr.cpp @@ -447,7 +447,8 @@ public: fflush(stdout); return NS_OK; } - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/mailnews/mime/emitters/html/nsMimeEmitter.cpp b/mozilla/mailnews/mime/emitters/html/nsMimeEmitter.cpp index c53b435bfbc..9e7930e8512 100644 --- a/mozilla/mailnews/mime/emitters/html/nsMimeEmitter.cpp +++ b/mozilla/mailnews/mime/emitters/html/nsMimeEmitter.cpp @@ -21,6 +21,7 @@ #include "plstr.h" #include "nsEmitterUtils.h" #include "nsMailHeaders.h" +#include "nscore.h" /* * This function will be used by the factory to generate an diff --git a/mozilla/mailnews/mime/emitters/raw/nsMimeEmitter.cpp b/mozilla/mailnews/mime/emitters/raw/nsMimeEmitter.cpp index 7857d812323..da0d931d2be 100644 --- a/mozilla/mailnews/mime/emitters/raw/nsMimeEmitter.cpp +++ b/mozilla/mailnews/mime/emitters/raw/nsMimeEmitter.cpp @@ -23,6 +23,7 @@ #include "nsMailHeaders.h" #include "nsIPref.h" #include "nsIServiceManager.h" +#include "nscore.h" // For the new pref API's static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID); diff --git a/mozilla/mailnews/mime/src/plugin_inst.cpp b/mozilla/mailnews/mime/src/plugin_inst.cpp index fd086bb9fb6..c851a79bb01 100644 --- a/mozilla/mailnews/mime/src/plugin_inst.cpp +++ b/mozilla/mailnews/mime/src/plugin_inst.cpp @@ -24,6 +24,7 @@ #include "mimemoz2.h" #include "nsIMimeEmitter.h" #include "nsRepository.h" +#include "nscore.h" // Need this for FO_NGLAYOUT #include "net.h" diff --git a/mozilla/mailnews/mime/src/plugin_inst.h b/mozilla/mailnews/mime/src/plugin_inst.h index 4b040d3b938..dbd516a3ea2 100644 --- a/mozilla/mailnews/mime/src/plugin_inst.h +++ b/mozilla/mailnews/mime/src/plugin_inst.h @@ -56,7 +56,8 @@ public: NS_IMETHOD Write(const char *aBuf, PRUint32 aLen, PRUint32 *aWriteLength); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHOD Flush(void) { diff --git a/mozilla/mailnews/news/public/makefile.win b/mozilla/mailnews/news/public/makefile.win index ce6d5f69be5..875d00a33ed 100644 --- a/mozilla/mailnews/news/public/makefile.win +++ b/mozilla/mailnews/news/public/makefile.win @@ -31,7 +31,6 @@ XPIDLSRCS= \ EXPORTS = \ nsIMsgOfflineNewsState.h \ - nsINNTPArticleList.h \ nsINNTPCategory.h \ nsINNTPCategoryContainer.h \ nsINNTPHost.h \ diff --git a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp index 49da4c6d856..62b021a6ca6 100644 --- a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp @@ -22,6 +22,7 @@ #include "nntpCore.h" #include "nsNNTPProtocol.h" +#include "nsINNTPArticleList.h" #include "nsIOutputStream.h" #include "nsIInputStream.h" #include "nsFileStream.h" diff --git a/mozilla/modules/oji/src/lcglue.cpp b/mozilla/modules/oji/src/lcglue.cpp index cd2fa698007..fa24f438c5a 100644 --- a/mozilla/modules/oji/src/lcglue.cpp +++ b/mozilla/modules/oji/src/lcglue.cpp @@ -35,6 +35,7 @@ #include "nsISecurityContext.h" #include "xpgetstr.h" #include "lcglue.h" +#include "nscore.h" extern "C" int XP_PROGRESS_STARTING_JAVA; extern "C" int XP_PROGRESS_STARTING_JAVA_DONE; diff --git a/mozilla/modules/plugin/bad/badapter.cpp b/mozilla/modules/plugin/bad/badapter.cpp index c94c17ac11a..cd9399706af 100644 --- a/mozilla/modules/plugin/bad/badapter.cpp +++ b/mozilla/modules/plugin/bad/badapter.cpp @@ -216,7 +216,8 @@ public: NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp index 9ccfbea36fb..d371f5d89fb 100644 --- a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp @@ -21,6 +21,7 @@ #include "prlog.h" #include "prmem.h" +#include "nscore.h" class ns4xPluginStreamListener : public nsIPluginStreamListener { diff --git a/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp b/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp index e20525f5108..fb0b366ff01 100644 --- a/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp @@ -166,7 +166,8 @@ public: NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp index 9ccfbea36fb..d371f5d89fb 100644 --- a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp @@ -21,6 +21,7 @@ #include "prlog.h" #include "prmem.h" +#include "nscore.h" class ns4xPluginStreamListener : public nsIPluginStreamListener { diff --git a/mozilla/modules/plugin/nglsrc/nsPluginInstancePeer.cpp b/mozilla/modules/plugin/nglsrc/nsPluginInstancePeer.cpp index e20525f5108..fb0b366ff01 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginInstancePeer.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginInstancePeer.cpp @@ -166,7 +166,8 @@ public: NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/modules/plugin/samples/backward/badapter.cpp b/mozilla/modules/plugin/samples/backward/badapter.cpp index c94c17ac11a..cd9399706af 100644 --- a/mozilla/modules/plugin/samples/backward/badapter.cpp +++ b/mozilla/modules/plugin/samples/backward/badapter.cpp @@ -216,7 +216,8 @@ public: NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/modules/plugin/src/npglue.h b/mozilla/modules/plugin/src/npglue.h index 2d0318a318c..3cd4e282fd7 100644 --- a/mozilla/modules/plugin/src/npglue.h +++ b/mozilla/modules/plugin/src/npglue.h @@ -676,7 +676,8 @@ public: NS_IMETHOD Write(const char* aBuf, PRInt32 aCount, PRInt32 *resultingCount); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/modules/plugin/src/nsPluginManagerStream.h b/mozilla/modules/plugin/src/nsPluginManagerStream.h index ffed830dfdd..3e1f51dcb86 100644 --- a/mozilla/modules/plugin/src/nsPluginManagerStream.h +++ b/mozilla/modules/plugin/src/nsPluginManagerStream.h @@ -43,7 +43,8 @@ public: NS_IMETHOD Write(const char* aBuf, PRInt32 aCount, PRInt32 *resultingCount); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/network/cnvts/cvplugin.cpp b/mozilla/network/cnvts/cvplugin.cpp index e80b05063c8..8d76689c0f3 100644 --- a/mozilla/network/cnvts/cvplugin.cpp +++ b/mozilla/network/cnvts/cvplugin.cpp @@ -26,7 +26,7 @@ #include "nsIComponentManager.h" #include "nsNetConverterStream.h" #include "nsCOMPtr.h" - +#include "nscore.h" static NS_DEFINE_CID(kINetPluginCID, NS_INET_PLUGIN_CID); diff --git a/mozilla/network/cnvts/nsNetConverterStream.h b/mozilla/network/cnvts/nsNetConverterStream.h index 3dea98c1a8b..5ef42c7d1f0 100644 --- a/mozilla/network/cnvts/nsNetConverterStream.h +++ b/mozilla/network/cnvts/nsNetConverterStream.h @@ -48,7 +48,8 @@ public: PRUint32 aLen, PRUint32 *aWriteLength); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/network/module/nsNetStream.h b/mozilla/network/module/nsNetStream.h index e3885d22f99..b56bb92af48 100644 --- a/mozilla/network/module/nsNetStream.h +++ b/mozilla/network/module/nsNetStream.h @@ -113,7 +113,8 @@ public: PRUint32 aLen, PRUint32 *aWriteCount); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -157,7 +158,8 @@ public: PRUint32 aLen, PRUint32 *aWriteLength); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -203,7 +205,8 @@ public: PRUint32 aLen, PRUint32 *aWriteLength); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/rdf/tests/rdfcat/rdfcat.cpp b/mozilla/rdf/tests/rdfcat/rdfcat.cpp index fd6465e92de..7a0908ebc39 100644 --- a/mozilla/rdf/tests/rdfcat/rdfcat.cpp +++ b/mozilla/rdf/tests/rdfcat/rdfcat.cpp @@ -154,7 +154,8 @@ public: return NS_OK; } - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/rdf/tests/rdfsink/rdfsink.cpp b/mozilla/rdf/tests/rdfsink/rdfsink.cpp index f4fd0335408..b8b0fc5b15c 100644 --- a/mozilla/rdf/tests/rdfsink/rdfsink.cpp +++ b/mozilla/rdf/tests/rdfsink/rdfsink.cpp @@ -135,7 +135,8 @@ public: return NS_OK; } - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) { + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/xpcom/base/nsrootidl.idl b/mozilla/xpcom/base/nsrootidl.idl index 4892fce1b93..32f54cd107f 100644 --- a/mozilla/xpcom/base/nsrootidl.idl +++ b/mozilla/xpcom/base/nsrootidl.idl @@ -19,6 +19,9 @@ /* Root idl declarations to be used by all. */ %{C++ + +#include "prtime.h" + /* * Start commenting out the C++ versions of the below in the output header */ @@ -30,6 +33,7 @@ typedef octet PRUint8 ; typedef unsigned short PRUint16 ; typedef unsigned long PRUint32 ; typedef unsigned long long PRUint64 ; +typedef unsigned long long PRTime ; typedef short PRInt16 ; typedef long PRInt32 ; typedef long long PRInt64 ; @@ -38,6 +42,7 @@ typedef unsigned long nsrefcnt ; typedef unsigned long nsresult ; [ptr] native voidStar(void); +[ptr] native charStar(char); [ref, nsid] native nsIDRef(nsID); [ref, nsid] native nsIIDRef(nsIID); diff --git a/mozilla/xpcom/io/Makefile.in b/mozilla/xpcom/io/Makefile.in index 1d3c7714e11..0636f0e1d4f 100644 --- a/mozilla/xpcom/io/Makefile.in +++ b/mozilla/xpcom/io/Makefile.in @@ -30,8 +30,11 @@ MODULE = xpcom XPIDL_MODULE = xpcom_io -XPIDLSRCS = \ - nsIFileSpec.idl \ +XPIDLSRCS = \ + nsIFileSpec.idl \ + nsIBaseStream.idl \ + nsIInputStream.idl \ + nsIOutputStream.idl \ $(NULL) CPPSRCS = \ @@ -54,11 +57,8 @@ EXPORTS = \ nsFileSpecImpl.h \ nsFileSpecStreaming.h \ nsFileStream.h \ - nsIBaseStream.h \ nsIByteBufferInputStream.h \ nsIFileStream.h \ - nsIInputStream.h \ - nsIOutputStream.h \ nsIStringStream.h \ nsIUnicharInputStream.h \ nsSpecialSystemDirectory.h \ diff --git a/mozilla/xpcom/io/makefile.win b/mozilla/xpcom/io/makefile.win index a4031cd9e24..268eab5e816 100644 --- a/mozilla/xpcom/io/makefile.win +++ b/mozilla/xpcom/io/makefile.win @@ -29,11 +29,8 @@ EXPORTS = \ nsFileSpecImpl.h \ nsFileSpecStreaming.h \ nsFileStream.h \ - nsIBaseStream.h \ nsIByteBufferInputStream.h \ nsIFileStream.h \ - nsIInputStream.h \ - nsIOutputStream.h \ nsIStringStream.h \ nsIUnicharInputStream.h \ nsSpecialSystemDirectory.h \ @@ -42,20 +39,12 @@ EXPORTS = \ NO_XPT_GEN=1 XPIDL_MODULE = xpcom_io -XPIDLSRCS = \ - .\nsIFileSpec.idl \ - $(NULL) - -xXPIDLSRCS = \ - .\nsIUri.idl \ - .\nsIUrl.idl \ - .\nsIIOService.idl \ - .\nsIIOSpec.idl \ - .\nsIFileSpec.idl \ - .\nsIStreamObserver.idl \ - .\nsIBaseStream.idl \ - .\nsIInputStream.idl \ - .\nsIOutputStream.idl \ +XPIDLSRCS = \ + .\nsIFileSpec.idl \ + .\nsIBaseStream.idl \ + .\nsIInputStream.idl \ + .\nsIOutputStream.idl \ + .\nsIBufferInputStream.idl \ $(NULL) ################################################################################ diff --git a/mozilla/xpcom/io/nsByteBufferInputStream.cpp b/mozilla/xpcom/io/nsByteBufferInputStream.cpp index ddd52c351fa..6b3aef8d5a7 100644 --- a/mozilla/xpcom/io/nsByteBufferInputStream.cpp +++ b/mozilla/xpcom/io/nsByteBufferInputStream.cpp @@ -189,11 +189,11 @@ NS_IMETHODIMP nsByteBufferInputStream::Fill(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount) { nsDummyBufferStream in(aBuf, aCount); - return Fill(&in, aWriteCount); + return Fill(&in, aCount, aWriteCount); } NS_IMETHODIMP -nsByteBufferInputStream::Fill(nsIInputStream* stream, PRUint32 *aWriteCount) +nsByteBufferInputStream::Fill(nsIInputStream* stream, PRUint32 aCount, PRUint32 *aWriteCount) { nsresult rv = NS_OK; @@ -201,9 +201,6 @@ nsByteBufferInputStream::Fill(nsIInputStream* stream, PRUint32 *aWriteCount) return NS_BASE_STREAM_CLOSED; *aWriteCount = 0; - PRUint32 aCount; - rv = stream->GetLength(&aCount); - if (NS_FAILED(rv)) return rv; if (mBlocking) PR_CEnterMonitor(this); @@ -349,15 +346,17 @@ nsByteBufferOutputStream::Close(void) } NS_IMETHODIMP -nsByteBufferOutputStream::Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount) +nsByteBufferOutputStream::Write(const char* aBuf, PRUint32 aCount, + PRUint32 *aWriteCount) { return mInputStream->Fill(aBuf, aCount, aWriteCount); } NS_IMETHODIMP -nsByteBufferOutputStream::Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) +nsByteBufferOutputStream::WriteFrom(nsIInputStream* fromStream, PRUint32 aCount, + PRUint32 *aWriteCount) { - return mInputStream->Fill(fromStream, aWriteCount); + return mInputStream->Fill(fromStream, aCount, aWriteCount); } NS_IMETHODIMP diff --git a/mozilla/xpcom/io/nsByteBufferInputStream.h b/mozilla/xpcom/io/nsByteBufferInputStream.h index d74793b515c..a0a2982bcd8 100644 --- a/mozilla/xpcom/io/nsByteBufferInputStream.h +++ b/mozilla/xpcom/io/nsByteBufferInputStream.h @@ -35,8 +35,10 @@ public: NS_IMETHOD Close(void); // nsIOutputStream methods: - NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount); - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount); + NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, + PRUint32 *aWriteCount); + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount, + PRUint32 *aWriteCount); NS_IMETHOD Flush(void); // nsByteBufferOutputStream methods: @@ -62,7 +64,7 @@ public: NS_IMETHOD Read(char* aBuf, PRUint32 aCount, PRUint32 *aReadCount); // nsIByteBufferInputStream methods: - NS_IMETHOD Fill(nsIInputStream* stream, PRUint32 *aWriteCount); + NS_IMETHOD Fill(nsIInputStream* stream, PRUint32 aCount, PRUint32 *aWriteCount); NS_IMETHOD Fill(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount); // nsByteBufferInputStream methods: diff --git a/mozilla/xpcom/io/nsIBaseStream.idl b/mozilla/xpcom/io/nsIBaseStream.idl new file mode 100644 index 00000000000..b7076a8a501 --- /dev/null +++ b/mozilla/xpcom/io/nsIBaseStream.idl @@ -0,0 +1,45 @@ +/* -*- 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 + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsISupports.idl" + +[scriptable, uuid(6ccb17a0-e95e-11d1-beae-00805f8a66dc)] +interface nsIBaseStream : nsISupports +{ + void Close(); +}; + +/** Error codes */ +%{C++ +//@{ +/// End of file +#define NS_BASE_STREAM_EOF NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 1) +/// Stream closed +#define NS_BASE_STREAM_CLOSED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 2) +/// Error from the operating system +#define NS_BASE_STREAM_OSERROR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 3) +/// Illegal arguments +#define NS_BASE_STREAM_ILLEGAL_ARGS NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 4) +/// For unichar streams +#define NS_BASE_STREAM_NO_CONVERTER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 5) +/// For unichar streams +#define NS_BASE_STREAM_BAD_CONVERSION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 6) + +#define NS_BASE_STREAM_WOULD_BLOCK NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_BASE, 7) +//@} +%} diff --git a/mozilla/xpcom/io/nsIBufferInputStream.idl b/mozilla/xpcom/io/nsIBufferInputStream.idl new file mode 100644 index 00000000000..98b17bfa204 --- /dev/null +++ b/mozilla/xpcom/io/nsIBufferInputStream.idl @@ -0,0 +1,47 @@ +/* -*- 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 + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsIInputStream.idl" + +[scriptable, uuid(93e9a230-1955-11d3-933b-000064657374)] +interface nsIBufferInputStream : nsIInputStream +{ + /** + * Returns a pointer to the buffer underlying an input stream. + * @param startPosition - the position relative to the start of + * the available data for which the segment is to be returned. + * If the startPosition is >= the available amount of data + * (returned by GetLength), NULL is returned for the bufferSegment. + * @param bufferSegment - returns the buffer, starting from the + * "read cursor" location. + * @param bufferSegmentSize - the number of contiguous bytes + * that can be read from this location. + * Note that the bufferSegmentSize may be less than the available + * amount of data (returned by GetLength) if the buffer input + * stream is internally represented by discontiguous segments. + */ + void GetBuffer(in unsigned long startPosition, + out charStar bufferSegment, + out unsigned long bufferSegmentSize); + + /** + * Returns the position of a string in the buffer. Returns -1 if + * not found. + */ + long Find(in charStar aString); +}; diff --git a/mozilla/xpcom/io/nsIFileStream.cpp b/mozilla/xpcom/io/nsIFileStream.cpp index e20efcb5c27..fd5de65bbd5 100644 --- a/mozilla/xpcom/io/nsIFileStream.cpp +++ b/mozilla/xpcom/io/nsIFileStream.cpp @@ -154,7 +154,8 @@ class FileImpl *aWriteCount = bytesWrit; return NS_OK; } - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/xpcom/io/nsIInputStream.idl b/mozilla/xpcom/io/nsIInputStream.idl new file mode 100644 index 00000000000..6b531e85494 --- /dev/null +++ b/mozilla/xpcom/io/nsIInputStream.idl @@ -0,0 +1,40 @@ +/* -*- 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 + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsIBaseStream.idl" + +[scriptable, uuid(022396f0-93b5-11d1-895b-006008911b81)] +interface nsIInputStream : nsIBaseStream +{ + /** Return the number of bytes in the stream + * @param aLength out parameter to hold the length + * of the stream. if an error occurs, the length + * will be undefined + * @return error status + */ + unsigned long GetLength(); + + /** Read data from the stream. + * @param aBuf the buffer into which the data is read + * @param aCount the maximum number of bytes to read + * @return aReadCount out parameter to hold the number of + * bytes read, eof if 0. if an error occurs, the + * read count will be undefined + */ + unsigned long Read(in charStar buf, in unsigned long count); +}; diff --git a/mozilla/xpcom/io/nsIOutputStream.idl b/mozilla/xpcom/io/nsIOutputStream.idl new file mode 100644 index 00000000000..fc86072c742 --- /dev/null +++ b/mozilla/xpcom/io/nsIOutputStream.idl @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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 + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsIBaseStream.idl" +#include "nsIInputStream.idl" + +[scriptable, uuid(7f13b870-e95f-11d1-beae-00805f8a66dc)] +interface nsIOutputStream : nsIBaseStream +{ + /** Write data into the stream. + * @param aBuf the buffer from which the data is read + * @param aCount the maximum 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 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. + */ + void Flush(); +}; diff --git a/mozilla/xpcom/io/nsIStringStream.cpp b/mozilla/xpcom/io/nsIStringStream.cpp index df3bfb5144d..5cd5a06b423 100644 --- a/mozilla/xpcom/io/nsIStringStream.cpp +++ b/mozilla/xpcom/io/nsIStringStream.cpp @@ -110,7 +110,8 @@ class BasicStringImpl *aWriteCount = bytesWrit; return NS_OK; } - NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) + NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount, + PRUint32 *aWriteCount) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/mozilla/xpcom/io/nsIUnicharInputStream.h b/mozilla/xpcom/io/nsIUnicharInputStream.h index e6f9b2d1ac3..cfa7a67f1b4 100644 --- a/mozilla/xpcom/io/nsIUnicharInputStream.h +++ b/mozilla/xpcom/io/nsIUnicharInputStream.h @@ -19,6 +19,8 @@ #define nsIUnicharInputStream_h___ #include "nsIInputStream.h" +#include "nscore.h" + class nsString; #define NS_IUNICHAR_INPUT_STREAM_IID \ diff --git a/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp b/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp index 875b874b4ed..b1651566c82 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp +++ b/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp @@ -137,7 +137,7 @@ XPTHeader *getHeader(const char *filename, nsIAllocator *al) { } if (flen > 0) { - PRInt32 howmany = PR_Read(in, whole, flen); + PRUint32 howmany = PR_Read(in, whole, flen); if (howmany < 0) { NS_ERROR("FAILED: reading typelib file"); goto out;