diff --git a/htmlparser/public/nsIParser.h b/htmlparser/public/nsIParser.h
index 326ac77ffb6..134f805c425 100644
--- a/htmlparser/public/nsIParser.h
+++ b/htmlparser/public/nsIParser.h
@@ -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;
diff --git a/htmlparser/src/nsParser.cpp b/htmlparser/src/nsParser.cpp
index 41977e5cf4f..b0fe39d5dfe 100644
--- a/htmlparser/src/nsParser.cpp
+++ b/htmlparser/src/nsParser.cpp
@@ -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('[')) {
diff --git a/htmlparser/src/nsParser.h b/htmlparser/src/nsParser.h
index 62a06186d54..a62a5440842 100644
--- a/htmlparser/src/nsParser.h
+++ b/htmlparser/src/nsParser.h
@@ -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;
diff --git a/htmlparser/src/nsScanner.cpp b/htmlparser/src/nsScanner.cpp
index b72a3d9c29d..cb7f34e72a7 100644
--- a/htmlparser/src/nsScanner.cpp
+++ b/htmlparser/src/nsScanner.cpp
@@ -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;
diff --git a/htmlparser/src/nsScanner.h b/htmlparser/src/nsScanner.h
index 6d46384ff63..dfbb57f0609 100644
--- a/htmlparser/src/nsScanner.h
+++ b/htmlparser/src/nsScanner.h
@@ -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& aStart, const nsReadingIterator& aEnd);
void CurrentPosition(nsReadingIterator& aPosition);
diff --git a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
index 0752c02900a..365f598170e 100644
--- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
+++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
@@ -129,13 +129,10 @@ nsAddbookProtocolHandler::GenerateXMLOutputChannel( nsString &aOutput,
nsresult rv = NS_OK;
nsIChannel *channel;
nsCOMPtr inStr;
- nsCOMPtr 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);
diff --git a/netwerk/base/public/nsNetUtil.h b/netwerk/base/public/nsNetUtil.h
index 62bd88c87d5..346fcf02aeb 100644
--- a/netwerk/base/public/nsNetUtil.h
+++ b/netwerk/base/public/nsNetUtil.h
@@ -273,11 +273,7 @@ NS_NewPostDataStream(nsIInputStream **result,
}
// otherwise, create a string stream for the data
- nsCOMPtr 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
diff --git a/netwerk/protocol/about/src/nsAboutBlank.cpp b/netwerk/protocol/about/src/nsAboutBlank.cpp
index 28af84f0371..a401b2bec00 100644
--- a/netwerk/protocol/about/src/nsAboutBlank.cpp
+++ b/netwerk/protocol/about/src/nsAboutBlank.cpp
@@ -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 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;
diff --git a/netwerk/protocol/about/src/nsAboutBloat.cpp b/netwerk/protocol/about/src/nsAboutBloat.cpp
index 7cbafc4ab25..3e99d150f95 100644
--- a/netwerk/protocol/about/src/nsAboutBloat.cpp
+++ b/netwerk/protocol/about/src/nsAboutBloat.cpp
@@ -86,29 +86,21 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result)
if (clear) {
nsTraceRefcnt::ResetStatistics();
- nsCOMPtr 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 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 file;
diff --git a/netwerk/protocol/http/src/nsHttpConnection.cpp b/netwerk/protocol/http/src/nsHttpConnection.cpp
index da85f903b57..4e228eedb6c 100644
--- a/netwerk/protocol/http/src/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/src/nsHttpConnection.cpp
@@ -516,11 +516,8 @@ nsHttpConnection::SetupSSLProxyConnect()
request.Flatten(buf);
buf.Append("\r\n");
- nsCOMPtr 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;
}
diff --git a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
index 1d38a978698..450465da78a 100644
--- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
+++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
@@ -186,20 +186,7 @@ nsFTPDirListingConv::Convert(nsIInputStream *aFromStream,
#endif // DEBUG_valeski
// send the converted data out.
- nsCOMPtr inputData;
- nsCOMPtr 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 inputData;
- nsCOMPtr 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());
diff --git a/netwerk/streamconv/converters/nsGopherDirListingConv.cpp b/netwerk/streamconv/converters/nsGopherDirListingConv.cpp
index 0fb7be39291..3a9aac1865e 100644
--- a/netwerk/streamconv/converters/nsGopherDirListingConv.cpp
+++ b/netwerk/streamconv/converters/nsGopherDirListingConv.cpp
@@ -109,19 +109,7 @@ nsGopherDirListingConv::Convert(nsIInputStream *aFromStream,
}
// send the converted data out.
- nsCOMPtr inputData;
- nsCOMPtr 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 inputData;
- nsCOMPtr 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,
diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
index 99c11b595a3..e9a3b442782 100644
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -238,12 +238,9 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
if (NS_FAILED(rv)) return rv;
nsCOMPtr inputData;
- nsCOMPtr 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("