fix for bug 121508 - clean up nsStringStream and nsIParser APIs.. r=dougt, sr=jst

This commit is contained in:
alecf%netscape.com 2002-01-27 22:02:00 +00:00
Родитель 9eeb236622
Коммит 8c9bfa6586
25 изменённых файлов: 66 добавлений и 155 удалений

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

@ -187,8 +187,8 @@ class nsIParser : public nsISupports {
* @param aCharsetSource- the soure of the chares
* @return nada
*/
virtual void SetDocumentCharset(nsString& aCharset, PRInt32 aSource)=0;
virtual void GetDocumentCharset(nsString& oCharset, PRInt32& oSource)=0;
virtual void SetDocumentCharset(const nsAString& aCharset, PRInt32 aSource)=0;
virtual void GetDocumentCharset(nsAString& oCharset, PRInt32& oSource)=0;
virtual nsIParserFilter* SetParserFilter(nsIParserFilter* aFilter) = 0;

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

@ -501,7 +501,7 @@ void nsParser::SetCommand(eParserCommands aParserCommand){
* @param aCharsetSource- the soure of the chares
* @return nada
*/
void nsParser::SetDocumentCharset(nsString& aCharset, PRInt32 aCharsetSource){
void nsParser::SetDocumentCharset(const nsAString& aCharset, PRInt32 aCharsetSource){
mCharset = aCharset;
mCharsetSource = aCharsetSource;
if(mParserContext && mParserContext->mScanner)
@ -756,7 +756,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
// The PI-skipping is a bit of a hack.
PRInt32 theIndex = 0;
do {
theIndex = aBuffer.FindChar('<', PR_FALSE, theIndex, -1);
theIndex = aBuffer.FindChar('<', theIndex);
if (theIndex == kNotFound) break;
PRUnichar nextChar = aBuffer.CharAt(theIndex+1);
if (nextChar == PRUnichar('!')) {
@ -769,9 +769,9 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
}
theIndex = ParsePS(aBuffer,tmpIndex);
// -1, not 0, in case it's another markup declaration
theIndex = aBuffer.FindChar('>', PR_FALSE, theIndex, -1);
theIndex = aBuffer.FindChar('>', theIndex);
} else if (nextChar == PRUnichar('?')) {
theIndex = aBuffer.FindChar('>', PR_FALSE, theIndex, -1);
theIndex = aBuffer.FindChar('>', theIndex);
} else {
break;
}
@ -806,7 +806,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
PRInt32 PublicIDStart = theIndex + 1;
PRInt32 PublicIDEnd =
aBuffer.FindChar(lit, PR_FALSE, PublicIDStart, -1);
aBuffer.FindChar(lit, PublicIDStart);
if (kNotFound == PublicIDEnd)
return PR_FALSE;
theIndex = ParsePS(aBuffer, PublicIDEnd + 1);
@ -823,7 +823,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
*aResultFlags |= PARSE_DTD_HAVE_SYSTEM_ID;
PRInt32 SystemIDStart = theIndex + 1;
PRInt32 SystemIDEnd =
aBuffer.FindChar(next, PR_FALSE, SystemIDStart, -1);
aBuffer.FindChar(next, SystemIDStart);
if (kNotFound == SystemIDEnd)
return PR_FALSE;
} else if (next == PRUnichar('[')) {

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

@ -160,9 +160,9 @@ class nsParser : public nsIParser,
* @param aCharsetSource- the soure of the chares
* @return nada
*/
virtual void SetDocumentCharset(nsString& aCharset, PRInt32 aSource);
virtual void SetDocumentCharset(const nsAString& aCharset, PRInt32 aSource);
void GetDocumentCharset(nsString& aCharset, PRInt32& aSource)
void GetDocumentCharset(nsAString& aCharset, PRInt32& aSource)
{
aCharset = mCharset;
aSource = mCharsetSource;

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

@ -181,7 +181,7 @@ nsScanner::nsScanner(nsString& aFilename,nsInputStream& aStream,const nsString&
}
nsresult nsScanner::SetDocumentCharset(const nsString& aCharset , PRInt32 aSource) {
nsresult nsScanner::SetDocumentCharset(const nsAString& aCharset , PRInt32 aSource) {
nsresult res = NS_OK;

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

@ -343,7 +343,7 @@ class nsScanner {
* @param aCharsetSource- where the charset info came from
* @return
*/
nsresult SetDocumentCharset(const nsString& aCharset, PRInt32 aSource);
nsresult SetDocumentCharset(const nsAString& aCharset, PRInt32 aSource);
void BindSubstring(nsSlidingSubstring& aSubstring, const nsReadingIterator<PRUnichar>& aStart, const nsReadingIterator<PRUnichar>& aEnd);
void CurrentPosition(nsReadingIterator<PRUnichar>& aPosition);

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

@ -129,13 +129,10 @@ nsAddbookProtocolHandler::GenerateXMLOutputChannel( nsString &aOutput,
nsresult rv = NS_OK;
nsIChannel *channel;
nsCOMPtr<nsIInputStream> inStr;
nsCOMPtr<nsISupports> s;
rv = NS_NewStringInputStream(getter_AddRefs(s), aOutput);
rv = NS_NewStringInputStream(getter_AddRefs(inStr), aOutput);
NS_ENSURE_SUCCESS(rv, rv);
inStr = do_QueryInterface(s, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewInputStreamChannel(&channel, aURI, inStr, "text/xml", aOutput.Length());
NS_ENSURE_SUCCESS(rv, rv);

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

@ -273,11 +273,7 @@ NS_NewPostDataStream(nsIInputStream **result,
}
// otherwise, create a string stream for the data
nsCOMPtr<nsISupports> sup;
rv = NS_NewCStringInputStream(getter_AddRefs(sup), nsCAutoString(data));
if (NS_FAILED(rv)) return rv;
return CallQueryInterface(sup, result);
return NS_NewCStringInputStream(result, nsDependentCString(data));
}
inline nsresult

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

@ -51,18 +51,13 @@ nsAboutBlank::NewChannel(nsIURI *aURI, nsIChannel **result)
{
nsresult rv;
nsIChannel* channel;
nsISupports* s;
rv = NS_NewCStringInputStream(&s, nsCAutoString(kBlankPage));
if (NS_FAILED(rv)) return rv;
nsIInputStream* in;
rv = CallQueryInterface(s, &in);
NS_RELEASE(s);
nsCOMPtr<nsIInputStream> in;
rv = NS_NewCStringInputStream(getter_AddRefs(in), nsDependentCString(kBlankPage));
if (NS_FAILED(rv)) return rv;
rv = NS_NewInputStreamChannel(&channel, aURI, in, "text/html",
nsCRT::strlen(kBlankPage));
NS_RELEASE(in);
if (NS_FAILED(rv)) return rv;
*result = channel;

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

@ -86,29 +86,21 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result)
if (clear) {
nsTraceRefcnt::ResetStatistics();
nsCOMPtr<nsISupports> s;
const char* msg = "Bloat statistics cleared.";
rv = NS_NewCStringInputStream(getter_AddRefs(s), nsCAutoString(msg));
rv = NS_NewCStringInputStream(getter_AddRefs(inStr), nsDependentCString(msg));
if (NS_FAILED(rv)) return rv;
size = nsCRT::strlen(msg);
inStr = do_QueryInterface(s, &rv);
if (NS_FAILED(rv)) return rv;
}
else if (leaks) {
// dump the current set of leaks.
GC_gcollect();
nsCOMPtr<nsISupports> s;
const char* msg = "Memory leaks dumped.";
rv = NS_NewCStringInputStream(getter_AddRefs(s), nsCAutoString(msg));
rv = NS_NewCStringInputStream(getter_AddRefs(inStr), nsDependentCString(msg));
if (NS_FAILED(rv)) return rv;
size = nsCRT::strlen(msg);
inStr = do_QueryInterface(s, &rv);
if (NS_FAILED(rv)) return rv;
}
else {
nsCOMPtr<nsIFile> file;

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

@ -516,11 +516,8 @@ nsHttpConnection::SetupSSLProxyConnect()
request.Flatten(buf);
buf.Append("\r\n");
nsCOMPtr<nsISupports> sup;
rv = NS_NewCStringInputStream(getter_AddRefs(sup), buf);
if (NS_FAILED(rv)) return rv;
rv = NS_NewCStringInputStream(getter_AddRefs(mSSLProxyConnectStream), buf);
mSSLProxyConnectStream = do_QueryInterface(sup, &rv);
return rv;
}

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

@ -186,20 +186,7 @@ nsFTPDirListingConv::Convert(nsIInputStream *aFromStream,
#endif // DEBUG_valeski
// send the converted data out.
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewCStringInputStream(getter_AddRefs(inputDataSup), convertedData);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup, &rv);
if (NS_FAILED(rv)) return rv;
*_retval = inputData.get();
NS_ADDREF(*_retval);
return NS_OK;
return NS_NewCStringInputStream(_retval, convertedData);
}
@ -323,12 +310,8 @@ nsFTPDirListingConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt,
// send the converted data out.
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewCStringInputStream(getter_AddRefs(inputDataSup), indexFormat);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup, &rv);
rv = NS_NewCStringInputStream(getter_AddRefs(inputData), indexFormat);
if (NS_FAILED(rv)) return rv;
rv = mFinalListener->OnDataAvailable(mPartChannel, ctxt, inputData, 0, indexFormat.Length());

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

@ -109,19 +109,7 @@ nsGopherDirListingConv::Convert(nsIInputStream *aFromStream,
}
// send the converted data out.
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewCStringInputStream(getter_AddRefs(inputDataSup), convertedData);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup, &rv);
if (NS_FAILED(rv)) return rv;
*_retval = inputData.get();
NS_ADDREF(*_retval);
return NS_OK;
return NS_NewCStringInputStream(_retval, convertedData);
}
// Stream converter service calls this to initialize the actual
@ -218,12 +206,8 @@ nsGopherDirListingConv::OnDataAvailable(nsIRequest *request,
// send the converted data out.
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewCStringInputStream(getter_AddRefs(inputDataSup), indexFormat);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup, &rv);
rv = NS_NewCStringInputStream(getter_AddRefs(inputData), indexFormat);
if (NS_FAILED(rv)) return rv;
rv = mFinalListener->OnDataAvailable(mPartChannel, ctxt, inputData,

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

@ -238,12 +238,9 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewStringInputStream(getter_AddRefs(inputDataSup), buffer);
rv = NS_NewStringInputStream(getter_AddRefs(inputData), buffer);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup);
rv = mListener->OnDataAvailable(request, aContext,
inputData, 0, buffer.Length());
return rv;
@ -257,13 +254,10 @@ nsIndexedToHTML::OnStopRequest(nsIRequest* request, nsISupports *aContext,
buffer.Assign(NS_LITERAL_STRING("</table><hr></body></html>\n"));
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewStringInputStream(getter_AddRefs(inputDataSup), buffer);
rv = NS_NewStringInputStream(getter_AddRefs(inputData), buffer);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup);
rv = mListener->OnDataAvailable(request, aContext,
inputData, 0, buffer.Length());
if (NS_FAILED(rv)) return rv;
@ -384,15 +378,13 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
}
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
nsresult rv = NS_NewStringInputStream(getter_AddRefs(inputDataSup),
nsresult rv = NS_NewStringInputStream(getter_AddRefs(inputData),
pushBuffer);
if (NS_FAILED(rv))
return rv;
inputData = do_QueryInterface(inputDataSup);
rv = mListener->OnDataAvailable(aRequest,
aCtxt,
inputData,

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

@ -85,11 +85,9 @@ nsTXTToHTMLConv::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewStringInputStream(getter_AddRefs(inputDataSup), mBuffer);
rv = NS_NewStringInputStream(getter_AddRefs(inputData), mBuffer);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup);
rv = mListener->OnDataAvailable(request, aContext,
inputData, 0, mBuffer.Length());
if (NS_FAILED(rv)) return rv;
@ -113,13 +111,10 @@ nsTXTToHTMLConv::OnStopRequest(nsIRequest* request, nsISupports *aContext,
mBuffer.Append(NS_LITERAL_STRING("\n</body></html>"));
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewStringInputStream(getter_AddRefs(inputDataSup), mBuffer);
rv = NS_NewStringInputStream(getter_AddRefs(inputData), mBuffer);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup);
rv = mListener->OnDataAvailable(request, aContext,
inputData, 0, mBuffer.Length());
if (NS_FAILED(rv)) return rv;
@ -186,15 +181,13 @@ nsTXTToHTMLConv::OnDataAvailable(nsIRequest* request, nsISupports *aContext,
if (!pushBuffer.IsEmpty()) {
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewStringInputStream(getter_AddRefs(inputDataSup), pushBuffer);
rv = NS_NewStringInputStream(getter_AddRefs(inputData), pushBuffer);
if (NS_FAILED(rv)) {
nsMemory::Free(buffer);
return rv;
}
inputData = do_QueryInterface(inputDataSup);
rv = mListener->OnDataAvailable(request, aContext,
inputData, 0, pushBuffer.Length());
if (NS_FAILED(rv)) {

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

@ -51,17 +51,7 @@ TestConverter::Convert(nsIInputStream *aFromStream,
buf[read] = '\0';
nsString convDataStr;
convDataStr.AssignWithConversion(buf);
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewStringInputStream(getter_AddRefs(inputDataSup), convDataStr);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIInputStream> inputData(do_QueryInterface(inputDataSup));
*_retval = inputData;
NS_ADDREF(*_retval);
return NS_OK;
return NS_NewCStringInputStream(_retval, nsDependentCString(buf));
}
/* This method initializes any internal state before the stream converter

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

@ -127,11 +127,10 @@ NS_IMPL_ISUPPORTS1(EndListener, nsIStreamListener);
nsresult SendData(const char * aData, nsIStreamListener* aListener, nsIRequest* request) {
nsString data;
data.AssignWithConversion(aData);
nsCOMPtr<nsISupports> dataSup;
nsresult rv = NS_NewStringInputStream(getter_AddRefs(dataSup), data);
nsCOMPtr<nsIInputStream> dataStream;
nsresult rv = NS_NewStringInputStream(getter_AddRefs(dataStream), data);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIInputStream> dataStream(do_QueryInterface(dataSup));
return aListener->OnDataAvailable(request, nsnull, dataStream, 0, -1);
}
#define SEND_DATA(x) SendData(x, converterListener, request)

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

@ -187,8 +187,8 @@ class nsIParser : public nsISupports {
* @param aCharsetSource- the soure of the chares
* @return nada
*/
virtual void SetDocumentCharset(nsString& aCharset, PRInt32 aSource)=0;
virtual void GetDocumentCharset(nsString& oCharset, PRInt32& oSource)=0;
virtual void SetDocumentCharset(const nsAString& aCharset, PRInt32 aSource)=0;
virtual void GetDocumentCharset(nsAString& oCharset, PRInt32& oSource)=0;
virtual nsIParserFilter* SetParserFilter(nsIParserFilter* aFilter) = 0;

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

@ -501,7 +501,7 @@ void nsParser::SetCommand(eParserCommands aParserCommand){
* @param aCharsetSource- the soure of the chares
* @return nada
*/
void nsParser::SetDocumentCharset(nsString& aCharset, PRInt32 aCharsetSource){
void nsParser::SetDocumentCharset(const nsAString& aCharset, PRInt32 aCharsetSource){
mCharset = aCharset;
mCharsetSource = aCharsetSource;
if(mParserContext && mParserContext->mScanner)
@ -756,7 +756,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
// The PI-skipping is a bit of a hack.
PRInt32 theIndex = 0;
do {
theIndex = aBuffer.FindChar('<', PR_FALSE, theIndex, -1);
theIndex = aBuffer.FindChar('<', theIndex);
if (theIndex == kNotFound) break;
PRUnichar nextChar = aBuffer.CharAt(theIndex+1);
if (nextChar == PRUnichar('!')) {
@ -769,9 +769,9 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
}
theIndex = ParsePS(aBuffer,tmpIndex);
// -1, not 0, in case it's another markup declaration
theIndex = aBuffer.FindChar('>', PR_FALSE, theIndex, -1);
theIndex = aBuffer.FindChar('>', theIndex);
} else if (nextChar == PRUnichar('?')) {
theIndex = aBuffer.FindChar('>', PR_FALSE, theIndex, -1);
theIndex = aBuffer.FindChar('>', theIndex);
} else {
break;
}
@ -806,7 +806,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
PRInt32 PublicIDStart = theIndex + 1;
PRInt32 PublicIDEnd =
aBuffer.FindChar(lit, PR_FALSE, PublicIDStart, -1);
aBuffer.FindChar(lit, PublicIDStart);
if (kNotFound == PublicIDEnd)
return PR_FALSE;
theIndex = ParsePS(aBuffer, PublicIDEnd + 1);
@ -823,7 +823,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
*aResultFlags |= PARSE_DTD_HAVE_SYSTEM_ID;
PRInt32 SystemIDStart = theIndex + 1;
PRInt32 SystemIDEnd =
aBuffer.FindChar(next, PR_FALSE, SystemIDStart, -1);
aBuffer.FindChar(next, SystemIDStart);
if (kNotFound == SystemIDEnd)
return PR_FALSE;
} else if (next == PRUnichar('[')) {

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

@ -160,9 +160,9 @@ class nsParser : public nsIParser,
* @param aCharsetSource- the soure of the chares
* @return nada
*/
virtual void SetDocumentCharset(nsString& aCharset, PRInt32 aSource);
virtual void SetDocumentCharset(const nsAString& aCharset, PRInt32 aSource);
void GetDocumentCharset(nsString& aCharset, PRInt32& aSource)
void GetDocumentCharset(nsAString& aCharset, PRInt32& aSource)
{
aCharset = mCharset;
aSource = mCharsetSource;

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

@ -181,7 +181,7 @@ nsScanner::nsScanner(nsString& aFilename,nsInputStream& aStream,const nsString&
}
nsresult nsScanner::SetDocumentCharset(const nsString& aCharset , PRInt32 aSource) {
nsresult nsScanner::SetDocumentCharset(const nsAString& aCharset , PRInt32 aSource) {
nsresult res = NS_OK;

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

@ -343,7 +343,7 @@ class nsScanner {
* @param aCharsetSource- where the charset info came from
* @return
*/
nsresult SetDocumentCharset(const nsString& aCharset, PRInt32 aSource);
nsresult SetDocumentCharset(const nsAString& aCharset, PRInt32 aSource);
void BindSubstring(nsSlidingSubstring& aSubstring, const nsReadingIterator<PRUnichar>& aStart, const nsReadingIterator<PRUnichar>& aEnd);
void CurrentPosition(nsReadingIterator<PRUnichar>& aPosition);

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

@ -80,8 +80,8 @@ nsRDFXMLParser::ParseAsync(nsIRDFDataSource* aSink, nsIURI* aBaseURI, nsIStreamL
nsCOMPtr<nsIParser> parser = do_CreateInstance(kParserCID, &rv);
if (NS_FAILED(rv)) return rv;
nsAutoString charset(NS_LITERAL_STRING("UTF-8"));
parser->SetDocumentCharset(charset, kCharsetFromDocTypeDefault);
parser->SetDocumentCharset(NS_LITERAL_STRING("UTF-8"),
kCharsetFromDocTypeDefault);
parser->SetContentSink(sink);
rv = parser->Parse(aBaseURI);
@ -111,8 +111,8 @@ nsRDFXMLParser::ParseString(nsIRDFDataSource* aSink, nsIURI* aBaseURI, const nsA
nsCOMPtr<nsIParser> parser = do_CreateInstance(kParserCID, &rv);
if (NS_FAILED(rv)) return rv;
nsAutoString charset(NS_LITERAL_STRING("UTF-8"));
parser->SetDocumentCharset(charset, kCharsetFromDocTypeDefault);
parser->SetDocumentCharset(NS_LITERAL_STRING("UTF-8"),
kCharsetFromDocTypeDefault);
parser->SetContentSink(sink);
rv = parser->Parse(aBaseURI);
@ -124,12 +124,8 @@ nsRDFXMLParser::ParseString(nsIRDFDataSource* aSink, nsIURI* aBaseURI, const nsA
if (! listener)
return NS_ERROR_FAILURE;
nsString copy(aString); // XXX sucks, but I ain't touchin' nsIStringStream!
nsCOMPtr<nsISupports> isupports;
rv = NS_NewStringInputStream(getter_AddRefs(isupports), copy);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIInputStream> stream = do_QueryInterface(isupports, &rv);
nsCOMPtr<nsIInputStream> stream;
rv = NS_NewStringInputStream(getter_AddRefs(stream), aString);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIChannel> channel;

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

@ -261,12 +261,9 @@ nsInputStringStream::nsInputStringStream(const char* stringToRead)
nsInputStringStream::nsInputStringStream(const nsString& stringToRead)
//----------------------------------------------------------------------------------------
{
nsISupports* stream;
if (NS_FAILED(NS_NewStringInputStream(&stream, stringToRead)))
if (NS_FAILED(NS_NewStringInputStream(getter_AddRefs(mInputStream), stringToRead)))
return;
mInputStream = do_QueryInterface(stream);
mStore = do_QueryInterface(stream);
NS_RELEASE(stream);
mStore = do_QueryInterface(mInputStream);
}
//========================================================================================

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

@ -103,15 +103,15 @@ interface nsIStringInputStream : nsISupports
//----------------------------------------------------------------------------------------
extern "C" NS_COM nsresult NS_NewStringInputStream(
nsISupports** aStreamResult,
const nsString& aStringToRead);
nsIInputStream** aStreamResult,
const nsAString& aStringToRead);
// Factory method to get an nsInputStream from a string. Result will implement all the
// file stream interfaces in nsIFileStream.h
//----------------------------------------------------------------------------------------
extern "C" NS_COM nsresult NS_NewCStringInputStream(
nsISupports** aStreamResult,
const nsCString& aStringToRead);
nsIInputStream** aStreamResult,
const nsACString& aStringToRead);
// Factory method to get an nsInputStream from a cstring. Result will implement all the
// file stream interfaces in nsIFileStream.h

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

@ -446,13 +446,13 @@ class ConstStringImpl
//========================================================================================
{
public:
ConstStringImpl(const nsString& inString)
ConstStringImpl(const nsAString& inString)
: ConstCharImpl(ToNewCString(inString),
inString.Length())
{
}
ConstStringImpl(const nsCString& inString)
ConstStringImpl(const nsACString& inString)
: ConstCharImpl(ToNewCString(inString),
inString.Length())
{
@ -525,8 +525,8 @@ NS_IMPL_QUERY_TAIL(nsIOutputStream)
//----------------------------------------------------------------------------------------
extern "C" NS_COM nsresult NS_NewStringInputStream(
nsISupports** aStreamResult,
const nsString& aStringToRead)
nsIInputStream** aStreamResult,
const nsAString& aStringToRead)
// Factory method to get an nsInputStream from a string. Result will implement all the
// file stream interfaces in nsIFileStream.h
//----------------------------------------------------------------------------------------
@ -540,14 +540,14 @@ extern "C" NS_COM nsresult NS_NewStringInputStream(
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(stream);
*aStreamResult = (nsISupports*)(void*)stream;
*aStreamResult = NS_STATIC_CAST(nsIInputStream*,stream);
return NS_OK;
}
//----------------------------------------------------------------------------------------
extern "C" NS_COM nsresult NS_NewCStringInputStream(
nsISupports** aStreamResult,
const nsCString& aStringToRead)
nsIInputStream** aStreamResult,
const nsACString& aStringToRead)
// Factory method to get an nsInputStream from a cstring. Result will implement all the
// file stream interfaces in nsIFileStream.h
//----------------------------------------------------------------------------------------
@ -561,7 +561,7 @@ extern "C" NS_COM nsresult NS_NewCStringInputStream(
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(stream);
*aStreamResult = (nsISupports*)(void*)stream;
*aStreamResult = NS_STATIC_CAST(nsIInputStream*,stream);
return NS_OK;
}