From 4441d352adcebffd4b33fea8fcc862f146a8601c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 16 Nov 2011 08:50:19 +0100 Subject: [PATCH] Bug 697494 - Outparamdel nsIParser::GetStreamListener; r=hsivonen --- content/html/document/src/nsHTMLDocument.cpp | 6 ++---- parser/html/nsHtml5Parser.cpp | 7 +++---- parser/html/nsHtml5Parser.h | 2 +- parser/htmlparser/public/nsIParser.h | 8 +++----- parser/htmlparser/src/nsParser.cpp | 7 +++---- parser/htmlparser/src/nsParser.h | 4 +--- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 79c8c3b1201..a2724be426d 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -950,10 +950,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, // Set the parser as the stream listener for the document loader... if (mParser) { - rv = mParser->GetStreamListener(aDocListener); - if (NS_FAILED(rv)) { - return rv; - } + nsCOMPtr listener = mParser->GetStreamListener(); + listener.forget(aDocListener); #ifdef DEBUG_charset printf(" charset = %s source %d\n", diff --git a/parser/html/nsHtml5Parser.cpp b/parser/html/nsHtml5Parser.cpp index 20ce8911ce3..bf86a933583 100644 --- a/parser/html/nsHtml5Parser.cpp +++ b/parser/html/nsHtml5Parser.cpp @@ -177,11 +177,10 @@ nsHtml5Parser::GetDTD(nsIDTD** aDTD) return NS_OK; } -NS_IMETHODIMP -nsHtml5Parser::GetStreamListener(nsIStreamListener** aListener) +nsIStreamListener* +nsHtml5Parser::GetStreamListener() { - NS_IF_ADDREF(*aListener = mStreamParser); - return NS_OK; + return mStreamParser; } NS_IMETHODIMP diff --git a/parser/html/nsHtml5Parser.h b/parser/html/nsHtml5Parser.h index 529a80e96b3..4efa1037af7 100644 --- a/parser/html/nsHtml5Parser.h +++ b/parser/html/nsHtml5Parser.h @@ -137,7 +137,7 @@ class nsHtml5Parser : public nsIParser, /** * Get the stream parser for this parser */ - NS_IMETHOD GetStreamListener(nsIStreamListener** aListener); + virtual nsIStreamListener* GetStreamListener(); /** * Don't call. For interface compat only. diff --git a/parser/htmlparser/public/nsIParser.h b/parser/htmlparser/public/nsIParser.h index 4e232b36f29..c14baed0413 100644 --- a/parser/htmlparser/public/nsIParser.h +++ b/parser/htmlparser/public/nsIParser.h @@ -55,8 +55,8 @@ #include "nsIAtom.h" #define NS_IPARSER_IID \ -{ 0xcbc0cbd8, 0xbbb7, 0x46d6, \ - { 0xa5, 0x51, 0x37, 0x8a, 0x69, 0x53, 0xa7, 0x14 } } +{ 0xc9169398, 0x897a, 0x481d, \ + { 0xa9, 0x5f, 0xd6, 0x60, 0x6e, 0xf8, 0x37, 0x56 } } // {41421C60-310A-11d4-816F-000064657374} #define NS_IDEBUG_DUMP_CONTENT_IID \ @@ -196,10 +196,8 @@ class nsIParser : public nsISupports { /** * Get the nsIStreamListener for this parser - * @param aDTD out param that will contain the result - * @return NS_OK if successful */ - NS_IMETHOD GetStreamListener(nsIStreamListener** aListener) = 0; + virtual nsIStreamListener* GetStreamListener() = 0; /************************************************************************** * Parse methods always begin with an input source, and perform diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp index 005acf9b318..ab6639a4b0c 100644 --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -2976,9 +2976,8 @@ nsParser::GetDTD(nsIDTD** aDTD) /** * Get this as nsIStreamListener */ -NS_IMETHODIMP -nsParser::GetStreamListener(nsIStreamListener** aListener) +nsIStreamListener* +nsParser::GetStreamListener() { - NS_ADDREF(*aListener = this); - return NS_OK; + return this; } diff --git a/parser/htmlparser/src/nsParser.h b/parser/htmlparser/src/nsParser.h index 7cdb13e3e40..9d9c4f11fd8 100644 --- a/parser/htmlparser/src/nsParser.h +++ b/parser/htmlparser/src/nsParser.h @@ -294,10 +294,8 @@ class nsParser : public nsIParser, /** * Get the nsIStreamListener for this parser - * @param aDTD out param that will contain the result - * @return NS_OK if successful */ - NS_IMETHOD GetStreamListener(nsIStreamListener** aListener); + virtual nsIStreamListener* GetStreamListener(); /** * Detects the existence of a META tag with charset information in