diff --git a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp index 0fba8caff67..84d6c091423 100644 --- a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp @@ -307,7 +307,7 @@ GenericTableRule::~GenericTableRule() { } -NS_IMPL_ISUPPORTS(GenericTableRule, NS_GET_IID(nsIStyleRule)); +NS_IMPL_ISUPPORTS1(GenericTableRule, nsIStyleRule) NS_IMETHODIMP GenericTableRule::Equals(const nsIStyleRule* aRule, PRBool& aResult) const diff --git a/mozilla/intl/chardet/src/windows/nsNativeDetectors.cpp b/mozilla/intl/chardet/src/windows/nsNativeDetectors.cpp index e2d019217a9..fc569f4e82d 100644 --- a/mozilla/intl/chardet/src/windows/nsNativeDetectors.cpp +++ b/mozilla/intl/chardet/src/windows/nsNativeDetectors.cpp @@ -197,7 +197,7 @@ protected: char mCharset[65]; }; -NS_IMPL_ISUPPORTS(nsNativeStringDetector, NS_GET_IID(nsIStringCharsetDetector)); +NS_IMPL_ISUPPORTS1(nsNativeStringDetector, nsIStringCharsetDetector) //---------------------------------------------------------- nsNativeStringDetector::nsNativeStringDetector(PRUint32 aCodePage) @@ -273,8 +273,7 @@ private: }; //-------------------------------------------------------------- -NS_DEFINE_IID( kIFactoryIID, NS_IFACTORY_IID); -NS_IMPL_ISUPPORTS( nsNativeDetectorFactory , kIFactoryIID); +NS_IMPL_ISUPPORTS1(nsNativeDetectorFactory, nsIFactory) NS_IMETHODIMP nsNativeDetectorFactory::CreateInstance( nsISupports* aDelegate, const nsIID &aIID, void** aResult) diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp index 0fba8caff67..84d6c091423 100644 --- a/mozilla/layout/style/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp @@ -307,7 +307,7 @@ GenericTableRule::~GenericTableRule() { } -NS_IMPL_ISUPPORTS(GenericTableRule, NS_GET_IID(nsIStyleRule)); +NS_IMPL_ISUPPORTS1(GenericTableRule, nsIStyleRule) NS_IMETHODIMP GenericTableRule::Equals(const nsIStyleRule* aRule, PRBool& aResult) const diff --git a/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.cpp b/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.cpp index b04dff3228c..44f9a5fc043 100755 --- a/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.cpp +++ b/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.cpp @@ -24,9 +24,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIOJITestLoaderIID, OJITESTLOADER_IID); -NS_IMPL_QUERY_INTERFACE(OJITestLoader, kIOJITestLoaderIID); -NS_IMPL_ADDREF(OJITestLoader) -NS_IMPL_RELEASE(OJITestLoader) +NS_IMPL_ISUPPORTS1(OJITestLoader, OJITestLoader) OJITestLoader::OJITestLoader(void) { diff --git a/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.h b/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.h index 0bd617fb009..18ceca38c42 100755 --- a/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.h +++ b/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.h @@ -52,6 +52,8 @@ typedef TestResult* (*OJI_TESTPROC)(void); class OJITestLoader : nsISupports { public: + NS_DEFINE_STATIC_IID_ACCESSOR(OJITESTLOADER_IID) + NS_DECL_ISUPPORTS OJITestLoader(); diff --git a/mozilla/xpcom/io/nsLocalFileMac.cpp b/mozilla/xpcom/io/nsLocalFileMac.cpp index ec209b85415..43e42b42c51 100644 --- a/mozilla/xpcom/io/nsLocalFileMac.cpp +++ b/mozilla/xpcom/io/nsLocalFileMac.cpp @@ -800,7 +800,7 @@ class nsDirEnumerator : public nsISimpleEnumerator nsCOMPtr mNext; }; -NS_IMPL_ISUPPORTS(nsDirEnumerator, NS_GET_IID(nsISimpleEnumerator)); +NS_IMPL_ISUPPORTS1(nsDirEnumerator, nsISimpleEnumerator) #pragma mark - diff --git a/mozilla/xpcom/tests/Makefile.in b/mozilla/xpcom/tests/Makefile.in index 3d88b50cc6e..61fb47bd1cb 100644 --- a/mozilla/xpcom/tests/Makefile.in +++ b/mozilla/xpcom/tests/Makefile.in @@ -30,13 +30,10 @@ MODULE = xpcom DIRS = dynamic services REQUIRES = necko string -TESTS_NOT_COMPILING = \ - TestArray.cpp \ - $(NULL) - CPPSRCS = \ nsIFileTest.cpp \ nsIFileEnumerator.cpp \ + TestArray.cpp \ TestServMgr.cpp \ TestFactory.cpp \ TestCallTemplates.cpp \ diff --git a/mozilla/xpcom/tests/TestArray.cpp b/mozilla/xpcom/tests/TestArray.cpp index d6b0db06093..a9aaa0ce413 100644 --- a/mozilla/xpcom/tests/TestArray.cpp +++ b/mozilla/xpcom/tests/TestArray.cpp @@ -34,34 +34,47 @@ static const PRBool kExitOnError = PR_TRUE; class IFoo : public nsISupports { public: + + NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFOO_IID) + + NS_IMETHOD_(nsrefcnt) RefCnt() = 0; + NS_IMETHOD_(PRInt32) ID() = 0; +}; + +class Foo : public IFoo { +public: + + Foo(PRInt32 aID); + virtual ~Foo(); + + // nsISupports implementation NS_DECL_ISUPPORTS - IFoo(PRInt32 aID); - ~IFoo(); - - nsrefcnt RefCnt() { return mRefCnt; } + // IFoo implementation + NS_IMETHOD_(nsrefcnt) RefCnt() { return mRefCnt; } + NS_IMETHOD_(PRInt32) ID() { return mID; } PRInt32 mID; static PRInt32 gCount; }; -PRInt32 IFoo::gCount; +PRInt32 Foo::gCount; -IFoo::IFoo(PRInt32 aID) +Foo::Foo(PRInt32 aID) { - NS_INIT_REFCNT(); + NS_INIT_ISUPPORTS(); mID = aID; - gCount++; - fprintf(stdout, "init: %d (%x), %d total)\n", mID, this, gCount); + ++gCount; + fprintf(stdout, "init: %d (%p), %d total)\n", mID, this, gCount); } -IFoo::~IFoo() +Foo::~Foo() { - gCount--; - fprintf(stdout, "destruct: %d (%x), %d remain)\n", mID, this, gCount); + --gCount; + fprintf(stdout, "destruct: %d (%p), %d remain)\n", mID, this, gCount); } -NS_IMPL_ISUPPORTS(IFoo, NS_IFOO_IID); +NS_IMPL_ISUPPORTS1(Foo, IFoo) const char* AssertEqual(PRInt32 aValue1, PRInt32 aValue2) { @@ -82,16 +95,16 @@ void DumpArray(nsISupportsArray* aArray, PRInt32 aExpectedCount, PRInt32 aElemen PRInt32 count = cnt; PRInt32 index; - fprintf(stdout, "object count %d = %d %s\n", IFoo::gCount, aExpectedTotal, - AssertEqual(IFoo::gCount, aExpectedTotal)); + fprintf(stdout, "object count %d = %d %s\n", Foo::gCount, aExpectedTotal, + AssertEqual(Foo::gCount, aExpectedTotal)); fprintf(stdout, "array count %d = %d %s\n", count, aExpectedCount, AssertEqual(count, aExpectedCount)); for (index = 0; (index < count) && (index < aExpectedCount); index++) { IFoo* foo = (IFoo*)(aArray->ElementAt(index)); - fprintf(stdout, "%2d: %d=%d (%x) c: %d %s\n", - index, aElementIDs[index], foo->mID, foo, foo->RefCnt() - 1, - AssertEqual(foo->mID, aElementIDs[index])); + fprintf(stdout, "%2d: %d=%d (%p) c: %d %s\n", + index, aElementIDs[index], foo->ID(), foo, foo->RefCnt() - 1, + AssertEqual(foo->ID(), aElementIDs[index])); foo->Release(); } } @@ -100,10 +113,8 @@ void FillArray(nsISupportsArray* aArray, PRInt32 aCount) { PRInt32 index; for (index = 0; index < aCount; index++) { - IFoo* foo = new IFoo(index); - foo->AddRef(); + nsCOMPtr foo = new Foo(index); aArray->AppendElement(foo); - foo->Release(); } }