XPCOM: Addref() and Release() usage fixed.

This commit is contained in:
dp%netscape.com 1999-05-04 18:38:21 +00:00
parent e272b2e1de
commit 262d0f491f
20 changed files with 36 additions and 192 deletions

View File

@ -207,7 +207,7 @@ nsHTMLFormElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_NOINTERFACE;
}
NS_IMETHODIMP
NS_IMETHODIMP_(nsrefcnt)
nsHTMLFormElement::AddRef(void)
{
nsTraceRefcnt::AddRef((nsIForm*)this, mRefCnt+1, __FILE__, __LINE__);

View File

@ -137,11 +137,7 @@ nsHTMLOptionElement::~nsHTMLOptionElement()
// ISupports
NS_IMETHODIMP
nsHTMLOptionElement::AddRef(void)
{
return ++mRefCnt;
}
NS_IMPL_ADDREF(nsHTMLOptionElement)
nsresult
nsHTMLOptionElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)

View File

@ -192,11 +192,7 @@ nsHTMLSelectElement::~nsHTMLSelectElement()
// ISupports
NS_IMETHODIMP
nsHTMLSelectElement::AddRef(void)
{
return ++mRefCnt;
}
NS_IMPL_ADDREF(nsHTMLSelectElement)
nsresult
nsHTMLSelectElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)

View File

@ -151,11 +151,7 @@ nsHTMLTextAreaElement::~nsHTMLTextAreaElement()
}
}
NS_IMETHODIMP
nsHTMLTextAreaElement::AddRef(void)
{
return ++mRefCnt;
}
NS_IMPL_ADDREF(nsHTMLTextAreaElement)
nsresult
nsHTMLTextAreaElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)

View File

@ -207,7 +207,7 @@ nsHTMLFormElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_NOINTERFACE;
}
NS_IMETHODIMP
NS_IMETHODIMP_(nsrefcnt)
nsHTMLFormElement::AddRef(void)
{
nsTraceRefcnt::AddRef((nsIForm*)this, mRefCnt+1, __FILE__, __LINE__);

View File

@ -137,11 +137,7 @@ nsHTMLOptionElement::~nsHTMLOptionElement()
// ISupports
NS_IMETHODIMP
nsHTMLOptionElement::AddRef(void)
{
return ++mRefCnt;
}
NS_IMPL_ADDREF(nsHTMLOptionElement)
nsresult
nsHTMLOptionElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)

View File

@ -192,11 +192,7 @@ nsHTMLSelectElement::~nsHTMLSelectElement()
// ISupports
NS_IMETHODIMP
nsHTMLSelectElement::AddRef(void)
{
return ++mRefCnt;
}
NS_IMPL_ADDREF(nsHTMLSelectElement)
nsresult
nsHTMLSelectElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)

View File

@ -151,11 +151,7 @@ nsHTMLTextAreaElement::~nsHTMLTextAreaElement()
}
}
NS_IMETHODIMP
nsHTMLTextAreaElement::AddRef(void)
{
return ++mRefCnt;
}
NS_IMPL_ADDREF(nsHTMLTextAreaElement)
nsresult
nsHTMLTextAreaElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)

View File

@ -29,16 +29,8 @@ NS_DEFINE_CID(kGIFCallbkCID, NS_GIFCALLBK_CID);
/* callbks: */
/*-------------class----------*/
NS_IMETHODIMP GIFCallbk::AddRef()
{
NS_INIT_REFCNT();
return NS_OK;
}
NS_IMETHODIMP GIFCallbk::Release()
{
return NS_OK;
}
NS_IMPL_ADDREF(GIFCallbk)
NS_IMPL_RELEASE(GIFCallbk)
NS_IMETHODIMP GIFCallbk::QueryInterface(const nsIID& aIID, void** aResult)
{

View File

@ -46,8 +46,8 @@ public:
il_container *GetContainer() {return mContainer;};
il_container *SetContainer(il_container *ic) {mContainer=ic; return ic;};
GIFCallbk(il_container *aContainer){mContainer=aContainer;};
~GIFCallbk();
GIFCallbk(il_container *aContainer){ NS_INIT_ISUPPORTS(); mContainer=aContainer; };
~GIFCallbk() { }; // XXX Pam needs to fix this
private:
il_container* mContainer;

View File

@ -83,6 +83,8 @@ GIFDecoder::~GIFDecoder(void)
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
};
NS_IMPL_ADDREF(GIFDecoder)
NS_IMPL_RELEASE(GIFDecoder)
NS_IMETHODIMP
GIFDecoder::QueryInterface(const nsIID& aIID, void** aInstPtr)
@ -90,7 +92,7 @@ GIFDecoder::QueryInterface(const nsIID& aIID, void** aInstPtr)
if (NULL == aInstPtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kGIFDecoderIID) ||
aIID.Equals(kImgDecoderIID) ||
aIID.Equals(kISupportsIID)) {
@ -101,19 +103,6 @@ GIFDecoder::QueryInterface(const nsIID& aIID, void** aInstPtr)
return NS_NOINTERFACE;
}
NS_IMETHODIMP
GIFDecoder::AddRef()
{
NS_INIT_REFCNT();
return NS_OK;
}
NS_IMETHODIMP
GIFDecoder::Release()
{
return NS_OK;
}
/*-----------class----------------*/
class nsGIFDecFactory : public nsIFactory
{
@ -139,7 +128,8 @@ private:
/*-----------------------------------------*/
nsGIFDecFactory* gFactory = NULL;
NS_IMPL_ISUPPORTS(nsGIFDecFactory, kIFactoryIID);
NS_IMPL_ISUPPORTS(nsGIFDecFactory, kIFactoryIID)
nsGIFDecFactory::nsGIFDecFactory(const nsCID &aClass)

View File

@ -28,31 +28,7 @@
/* callbks: */
/*-------------class----------*/
NS_IMETHODIMP JPGCallbk::AddRef()
{
NS_INIT_REFCNT();
return NS_OK;
}
NS_IMETHODIMP JPGCallbk::Release()
{
return NS_OK;
}
NS_IMETHODIMP JPGCallbk::QueryInterface(const nsIID& aIID, void** aResult)
{
if (NULL == aResult) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kImgDCallbkIID)) {
*aResult = (void*) this;
NS_INIT_REFCNT();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ISUPPORTS(JPGCallbk, kImgDCallbkIID)
/*-----------------------------*/

View File

@ -47,7 +47,7 @@ public:
il_container *SetContainer(il_container *ic) {mContainer=ic; return ic;};
JPGCallbk(il_container *aContainer){mContainer=aContainer;};
~JPGCallbk();
~JPGCallbk() {}; // XXX Pam needs to fix this
private:
il_container* mContainer;

View File

@ -84,6 +84,9 @@ JPGDecoder::~JPGDecoder(void)
};
NS_IMPL_ADDREF(JPGDecoder)
NS_IMPL_RELEASE(JPGDecoder)
NS_IMETHODIMP
JPGDecoder::QueryInterface(const nsIID& aIID, void** aInstPtr)
{
@ -148,20 +151,6 @@ extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char
return rv;
}
/*--------------------*/
NS_IMETHODIMP
JPGDecoder::AddRef()
{
NS_INIT_REFCNT();
return NS_OK;
}
NS_IMETHODIMP
JPGDecoder::Release()
{
return NS_OK;
}
/*-----------class----------------*/
class nsJPGDecFactory : public nsIFactory

View File

@ -28,31 +28,7 @@
/* callbks: */
/*-------------class----------*/
NS_IMETHODIMP PNGCallbk::AddRef()
{
NS_INIT_REFCNT();
return NS_OK;
}
NS_IMETHODIMP PNGCallbk::Release()
{
return NS_OK;
}
NS_IMETHODIMP PNGCallbk::QueryInterface(const nsIID& aIID, void** aResult)
{
if (NULL == aResult) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kImgDCallbkIID)) {
*aResult = (void*) this;
NS_INIT_REFCNT();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ISUPPORTS(PNGCallbk, kImgDCallbkIID)
/*-----------------------------*/

View File

@ -47,7 +47,7 @@ public:
il_container *SetContainer(il_container *ic) {mContainer=ic; return ic;};
PNGCallbk(il_container *aContainer){mContainer=aContainer;};
~PNGCallbk();
~PNGCallbk() {}; // XXX Pam needs to fix this
private:
il_container* mContainer;

View File

@ -101,18 +101,8 @@ PNGDecoder::QueryInterface(const nsIID& aIID, void** aInstPtr)
return NS_NOINTERFACE;
}
NS_IMETHODIMP
PNGDecoder::AddRef()
{
NS_INIT_REFCNT();
return NS_OK;
}
NS_IMETHODIMP
PNGDecoder::Release()
{
return NS_OK;
}
NS_IMPL_ADDREF(PNGDecoder)
NS_IMPL_RELEASE(PNGDecoder)
/*-----------class----------------*/
class nsPNGDecFactory : public nsIFactory
@ -139,7 +129,9 @@ private:
/*-----------------------------------------*/
nsPNGDecFactory* gFactory = NULL;
NS_IMPL_ISUPPORTS(nsPNGDecFactory, kIFactoryIID);
NS_IMPL_ISUPPORTS(nsPNGDecFactory, kIFactoryIID)
nsPNGDecFactory::nsPNGDecFactory(const nsCID &aClass)

View File

@ -30,7 +30,7 @@ class ImgDCallbk : public nsIImgDCallbk
{
public:
NS_DECL_ISUPPORTS
ImgDCallbk(il_container *aContainer){mContainer=aContainer;};
ImgDCallbk(il_container *aContainer) { NS_INIT_ISUPPORTS(); mContainer=aContainer; };
~ImgDCallbk(){};

View File

@ -64,38 +64,14 @@ public:
il_container *GetContainer() {return mContainer;};
il_container *SetContainer(il_container *ic) {mContainer=ic; return ic;};
ImgDecoder(il_container *aContainer){mContainer=aContainer;};
~ImgDecoder();
ImgDecoder(il_container *aContainer){ NS_INIT_ISUPPORTS(); mContainer=aContainer;};
~ImgDecoder() { }; // XXX Pam needs to fix this
private:
il_container* mContainer;
};
NS_IMETHODIMP ImgDecoder::AddRef()
{
NS_INIT_REFCNT();
return NS_OK;
}
NS_IMETHODIMP ImgDecoder::Release()
{
return NS_OK;
}
NS_IMETHODIMP ImgDecoder::QueryInterface(const nsIID& aIID, void** aResult)
{
if (NULL == aResult) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kImgDecoderIID)) {
*aResult = (void*) this;
NS_INIT_REFCNT();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ISUPPORTS(ImgDecoder, kImgDecoderIID)
/*-----------------------------------------*/
/*-----------------------------------------*/

View File

@ -20,7 +20,7 @@
* ilclient.c --- Management of imagelib client data structures,
* including image cache.
*
* $Id: ilclient.cpp,v 3.5 1999/04/22 22:39:55 pnunn%netscape.com Exp $
* $Id: ilclient.cpp,v 3.6 1999/05/04 18:36:07 dp%netscape.com Exp $
*/
@ -77,22 +77,9 @@ struct il_cache_struct {
struct il_cache_struct il_cache;
/*---------------------------------------------*/
/*-------------------------------*/
NS_IMETHODIMP
ImgDCallbk::QueryInterface(const nsIID& aIID, void** aInstPtr)
{
if (NULL == aInstPtr) {
return NS_ERROR_NULL_POINTER;
}
/*-------------------------------*/
if (aIID.Equals(kImgDCallbkIID) ||
aIID.Equals(kISupportsIID)) {
*aInstPtr = (void*) this;
NS_INIT_REFCNT();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ISUPPORTS(ImgDCallbk, kImgDCallbkIID)
NS_IMETHODIMP
ImgDCallbk::CreateInstance(const nsCID &aClass,
@ -116,16 +103,6 @@ ImgDCallbk::CreateInstance(const nsCID &aClass,
}
return res;
}
NS_IMETHODIMP ImgDCallbk::AddRef()
{
NS_INIT_REFCNT();
return NS_OK;
}
NS_IMETHODIMP ImgDCallbk::Release()
{
return NS_OK;
}
/*-------------------------*/