Change these QueryInterface implementations to be macros, not hand rolled. No bug, r+sr=dveditz

This commit is contained in:
mrbkap%gmail.com 2006-01-26 22:24:20 +00:00
Родитель 9d1e215327
Коммит efa6824ced
2 изменённых файлов: 2 добавлений и 65 удалений

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

@ -77,39 +77,7 @@ nsLoggingSink::~nsLoggingSink() {
mOutput=0;
}
NS_IMPL_ADDREF(nsLoggingSink)
NS_IMPL_RELEASE(nsLoggingSink)
nsresult
nsLoggingSink::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(nsnull != aInstancePtr, "null ptr");
if (nsnull == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kISupportsIID)) {
nsISupports* tmp = this;
*aInstancePtr = (void*) tmp;
}
else if (aIID.Equals(kIContentSinkIID)) {
nsIContentSink* tmp = this;
*aInstancePtr = (void*) tmp;
}
else if (aIID.Equals(kIHTMLContentSinkIID)) {
nsIHTMLContentSink* tmp = this;
*aInstancePtr = (void*) tmp;
}
else if (aIID.Equals(kILoggingSinkIID)) {
nsILoggingSink* tmp = this;
*aInstancePtr = (void*) tmp;
}
else {
*aInstancePtr = nsnull;
return NS_NOINTERFACE;
}
NS_ADDREF(this);
return NS_OK;
}
NS_IMPL_ISUPPORTS3(nsLoggingSink, nsILoggingSink, nsIContentSink, nsIHTMLContentSink)
NS_IMETHODIMP
nsLoggingSink::SetOutputStream(PRFileDesc *aStream,PRBool autoDeleteOutput) {

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

@ -108,38 +108,7 @@ Stopwatch vsTimer;
static const char kBodyId[] = "viewsource";
static const char kBodyClassWrap[] = "wrap";
/**
* This method gets called as part of our COM-like interfaces.
* Its purpose is to create an interface to parser object
* of some type.
*
* @update gess 4/8/98
* @param nsIID id of object to discover
* @param aInstancePtr ptr to newly discovered interface
* @return NS_xxx result code
*/
nsresult CViewSourceHTML::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if(aIID.Equals(NS_GET_IID(nsISupports))) { //do IUnknown...
*aInstancePtr = (nsIDTD*)(this);
}
else if(aIID.Equals(NS_GET_IID(nsIDTD))) { //do IParser base class...
*aInstancePtr = (nsIDTD*)(this);
}
else {
*aInstancePtr=0;
return NS_NOINTERFACE;
}
NS_ADDREF_THIS();
return NS_OK;
}
NS_IMPL_ADDREF(CViewSourceHTML)
NS_IMPL_RELEASE(CViewSourceHTML)
NS_IMPL_ISUPPORTS1(CViewSourceHTML, nsIDTD)
/********************************************
********************************************/