diff --git a/mozilla/modules/libreg/xpcom/nsRegistry.cpp b/mozilla/modules/libreg/xpcom/nsRegistry.cpp index 5a90745f3cf..92ab8a24977 100644 --- a/mozilla/modules/libreg/xpcom/nsRegistry.cpp +++ b/mozilla/modules/libreg/xpcom/nsRegistry.cpp @@ -349,27 +349,14 @@ static char *PR_strdup( const char *in ) { return result; } -/*----------------------------------- IIDs ------------------------------------- -| Static IID values for each imterface implemented here; required by the | -| NS_IMPL_ISUPPORTS macro. | -------------------------------------------------------------------------------*/ -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIRegistryIID, NS_IREGISTRY_IID); -static NS_DEFINE_IID(kIRegistryNodeIID, NS_IREGISTRYNODE_IID); -static NS_DEFINE_IID(kIRegistryValueIID, NS_IREGISTRYVALUE_IID); - -static NS_DEFINE_IID(kIEnumeratorIID, NS_IENUMERATOR_IID); - -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); - /*------------------------ nsISupports Implementation -------------------------- | This code generates the implementation of the nsISupports member functions | | for each class implemented in this file. | ------------------------------------------------------------------------------*/ -NS_IMPL_ISUPPORTS( nsRegistry, kIRegistryIID ); -NS_IMPL_ISUPPORTS( nsRegSubtreeEnumerator, kIEnumeratorIID ); -NS_IMPL_ISUPPORTS( nsRegistryNode, kIRegistryNodeIID ); -NS_IMPL_ISUPPORTS( nsRegistryValue, kIRegistryValueIID ); +NS_IMPL_ISUPPORTS1( nsRegistry, nsIRegistry ) +NS_IMPL_ISUPPORTS1( nsRegSubtreeEnumerator, nsIEnumerator ) +NS_IMPL_ISUPPORTS1( nsRegistryNode, nsIRegistryNode ) +NS_IMPL_ISUPPORTS1( nsRegistryValue, nsIRegistryValue ) /*-------------------------- nsRegistry::nsRegistry ---------------------------- | Vanilla nsRegistry constructor. The first time called, it does | @@ -1415,7 +1402,7 @@ nsRegistryFactory::nsRegistryFactory() { NS_INIT_REFCNT(); } -NS_IMPL_ISUPPORTS(nsRegistryFactory, kIFactoryIID); +NS_IMPL_ISUPPORTS1(nsRegistryFactory, nsIFactory) NS_IMETHODIMP nsRegistryFactory::CreateInstance(nsISupports *aOuter, diff --git a/mozilla/xpcom/base/nsAllocator.cpp b/mozilla/xpcom/base/nsAllocator.cpp index f6b35a09a2e..8fd7ef62af7 100644 --- a/mozilla/xpcom/base/nsAllocator.cpp +++ b/mozilla/xpcom/base/nsAllocator.cpp @@ -112,8 +112,7 @@ nsAllocatorFactory::~nsAllocatorFactory(void) { } -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); -NS_IMPL_ISUPPORTS(nsAllocatorFactory, kIFactoryIID); +NS_IMPL_ISUPPORTS1(nsAllocatorFactory, nsIFactory) NS_METHOD nsAllocatorFactory::CreateInstance(nsISupports *aOuter, diff --git a/mozilla/xpcom/base/nsISupportsUtils.h b/mozilla/xpcom/base/nsISupportsUtils.h index a308a3a23ae..0a93472d393 100644 --- a/mozilla/xpcom/base/nsISupportsUtils.h +++ b/mozilla/xpcom/base/nsISupportsUtils.h @@ -277,6 +277,13 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_BODY(_i2) \ NS_IMPL_QUERY_TAIL(_i1) +#define NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) \ + NS_IMPL_QUERY_HEAD(_class) \ + NS_IMPL_QUERY_BODY(_i1) \ + NS_IMPL_QUERY_BODY(_i2) \ + NS_IMPL_QUERY_BODY(_i3) \ + NS_IMPL_QUERY_TAIL(_i1) + /* @@ -336,6 +343,11 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_RELEASE(_class) \ NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2) +#define NS_IMPL_ISUPPORTS3(_class, _i1, _i2, _i3) \ + NS_IMPL_ADDREF(_class) \ + NS_IMPL_RELEASE(_class) \ + NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) + //////////////////////////////////////////////////////////////////////////////// /** diff --git a/mozilla/xpcom/base/nsWeakReference.cpp b/mozilla/xpcom/base/nsWeakReference.cpp index 5af1f7c6f52..7b2f2550e61 100644 --- a/mozilla/xpcom/base/nsWeakReference.cpp +++ b/mozilla/xpcom/base/nsWeakReference.cpp @@ -80,25 +80,29 @@ nsWeakReference::Release() NS_IMETHODIMP nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr ) { + NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!"); + if ( !aInstancePtr ) return NS_ERROR_NULL_POINTER; + nsISupports* foundInterface; if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) - *aInstancePtr = NS_STATIC_CAST(nsIWeakReference*, this); + foundInterface = NS_STATIC_CAST(nsIWeakReference*, this); else if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) - *aInstancePtr = NS_STATIC_CAST(nsISupports*, this); + foundInterface = NS_STATIC_CAST(nsISupports*, this); else - *aInstancePtr = 0; + foundInterface = 0; nsresult status; - if ( !*aInstancePtr ) + if ( !foundInterface ) status = NS_NOINTERFACE; else { - NS_ADDREF( NS_REINTERPRET_CAST(nsISupports*, *aInstancePtr) ); + NS_ADDREF(foundInterface); status = NS_OK; } + *aInstancePtr = foundInterface; return status; } diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index 4cfe3d49b1e..c469a133035 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -252,7 +252,7 @@ nsComponentManagerImpl::~nsComponentManagerImpl() } -NS_IMPL_ISUPPORTS(nsComponentManagerImpl, nsIComponentManager::GetIID()); +NS_IMPL_ISUPPORTS1(nsComponentManagerImpl, nsIComponentManager) //////////////////////////////////////////////////////////////////////////////// // nsComponentManagerImpl: Platform methods @@ -273,8 +273,7 @@ nsComponentManagerImpl::PlatformInit(void) rv = NS_RegistryGetFactory(®istryFactory); if (NS_SUCCEEDED(rv)) { - NS_DEFINE_IID(kRegistryIID, NS_IREGISTRY_IID); - rv = registryFactory->CreateInstance(NULL, kRegistryIID,(void **)&mRegistry); + rv = registryFactory->CreateInstance(NULL, NS_GET_IID(nsIRegistry),(void **)&mRegistry); if (NS_FAILED(rv)) return rv; NS_RELEASE(registryFactory); } @@ -1518,8 +1517,7 @@ nsComponentManagerImpl::RegisterComponent(const nsCID &aClass, // Convert the persistent descriptor into a nsIFileSpec nsCOMPtrlibSpec; - NS_DEFINE_IID(kFileSpecIID, NS_IFILESPEC_IID); - rv = CreateInstance(NS_FILESPEC_PROGID, NULL, kFileSpecIID, getter_AddRefs(libSpec)); + rv = CreateInstance(NS_FILESPEC_PROGID, NULL, NS_GET_IID(nsIFileSpec), getter_AddRefs(libSpec)); if (NS_FAILED(rv)) return rv; rv = libSpec->SetPersistentDescriptorString((char *)aLibraryPersistentDescriptor); if (NS_FAILED(rv)) return rv; @@ -1747,8 +1745,7 @@ nsComponentManagerImpl::UnregisterComponent(const nsCID &aClass, // Convert the persistent descriptor into a nsIFileSpec nsCOMPtrlibSpec; - NS_DEFINE_IID(kFileSpecIID, NS_IFILESPEC_IID); - rv = CreateInstance(NS_FILESPEC_PROGID, NULL, kFileSpecIID, getter_AddRefs(libSpec)); + rv = CreateInstance(NS_FILESPEC_PROGID, NULL, NS_GET_IID(nsIFileSpec), getter_AddRefs(libSpec)); if (NS_FAILED(rv)) return rv; rv = libSpec->SetPersistentDescriptorString((char *)aLibrary); if (NS_FAILED(rv)) return rv; @@ -1986,9 +1983,8 @@ nsComponentManagerImpl::SyncComponentsInDir(RegistrationTime when, nsIFileSpec * } // Create a directory iterator - NS_DEFINE_IID(kDirectoryIteratorIID, NS_IDIRECTORYITERATOR_IID); nsCOMPtrdirIterator; - rv = CreateInstance(NS_DIRECTORYITERATOR_PROGID, NULL, kDirectoryIteratorIID, getter_AddRefs(dirIterator)); + rv = CreateInstance(NS_DIRECTORYITERATOR_PROGID, NULL, NS_GET_IID(nsIDirectoryIterator), getter_AddRefs(dirIterator)); if (NS_FAILED(rv)) return rv; rv = dirIterator->Init(dirSpec, PR_FALSE); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/xpcom/components/nsGenericFactory.cpp b/mozilla/xpcom/components/nsGenericFactory.cpp index c0ef64d0099..ecff2c40ced 100644 --- a/mozilla/xpcom/components/nsGenericFactory.cpp +++ b/mozilla/xpcom/components/nsGenericFactory.cpp @@ -30,23 +30,7 @@ nsGenericFactory::~nsGenericFactory() (*mDestructor) (); } -NS_METHOD nsGenericFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - if (aIID.Equals(nsIGenericFactory::GetIID()) || - aIID.Equals(nsIFactory::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = (nsIGenericFactory*) this; - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} - -NS_IMPL_ADDREF(nsGenericFactory) -NS_IMPL_RELEASE(nsGenericFactory) +NS_IMPL_ISUPPORTS2(nsGenericFactory, nsIGenericFactory, nsIFactory) NS_IMETHODIMP nsGenericFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult) { diff --git a/mozilla/xpcom/components/nsRegistry.cpp b/mozilla/xpcom/components/nsRegistry.cpp index 5a90745f3cf..92ab8a24977 100644 --- a/mozilla/xpcom/components/nsRegistry.cpp +++ b/mozilla/xpcom/components/nsRegistry.cpp @@ -349,27 +349,14 @@ static char *PR_strdup( const char *in ) { return result; } -/*----------------------------------- IIDs ------------------------------------- -| Static IID values for each imterface implemented here; required by the | -| NS_IMPL_ISUPPORTS macro. | -------------------------------------------------------------------------------*/ -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIRegistryIID, NS_IREGISTRY_IID); -static NS_DEFINE_IID(kIRegistryNodeIID, NS_IREGISTRYNODE_IID); -static NS_DEFINE_IID(kIRegistryValueIID, NS_IREGISTRYVALUE_IID); - -static NS_DEFINE_IID(kIEnumeratorIID, NS_IENUMERATOR_IID); - -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); - /*------------------------ nsISupports Implementation -------------------------- | This code generates the implementation of the nsISupports member functions | | for each class implemented in this file. | ------------------------------------------------------------------------------*/ -NS_IMPL_ISUPPORTS( nsRegistry, kIRegistryIID ); -NS_IMPL_ISUPPORTS( nsRegSubtreeEnumerator, kIEnumeratorIID ); -NS_IMPL_ISUPPORTS( nsRegistryNode, kIRegistryNodeIID ); -NS_IMPL_ISUPPORTS( nsRegistryValue, kIRegistryValueIID ); +NS_IMPL_ISUPPORTS1( nsRegistry, nsIRegistry ) +NS_IMPL_ISUPPORTS1( nsRegSubtreeEnumerator, nsIEnumerator ) +NS_IMPL_ISUPPORTS1( nsRegistryNode, nsIRegistryNode ) +NS_IMPL_ISUPPORTS1( nsRegistryValue, nsIRegistryValue ) /*-------------------------- nsRegistry::nsRegistry ---------------------------- | Vanilla nsRegistry constructor. The first time called, it does | @@ -1415,7 +1402,7 @@ nsRegistryFactory::nsRegistryFactory() { NS_INIT_REFCNT(); } -NS_IMPL_ISUPPORTS(nsRegistryFactory, kIFactoryIID); +NS_IMPL_ISUPPORTS1(nsRegistryFactory, nsIFactory) NS_IMETHODIMP nsRegistryFactory::CreateInstance(nsISupports *aOuter, diff --git a/mozilla/xpcom/components/nsServiceManager.cpp b/mozilla/xpcom/components/nsServiceManager.cpp index e6637bc94c5..d10985b32ce 100644 --- a/mozilla/xpcom/components/nsServiceManager.cpp +++ b/mozilla/xpcom/components/nsServiceManager.cpp @@ -188,27 +188,7 @@ nsServiceManagerImpl::~nsServiceManagerImpl(void) } } -static NS_DEFINE_IID(kIServiceManagerIID, NS_ISERVICEMANAGER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - -NS_IMPL_ADDREF(nsServiceManagerImpl); -NS_IMPL_RELEASE(nsServiceManagerImpl); - -NS_IMETHODIMP -nsServiceManagerImpl::QueryInterface(const nsIID& aIID, void* *aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - *aInstancePtr = NULL; - if (aIID.Equals(kIServiceManagerIID) || - aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS1(nsServiceManagerImpl, nsIServiceManager) NS_IMETHODIMP nsServiceManagerImpl::GetService(const nsCID& aClass, const nsIID& aIID, diff --git a/mozilla/xpcom/components/xcDll.cpp b/mozilla/xpcom/components/xcDll.cpp index 5343010f58c..b9cab9189db 100644 --- a/mozilla/xpcom/components/xcDll.cpp +++ b/mozilla/xpcom/components/xcDll.cpp @@ -129,8 +129,7 @@ nsDll::Init(const char *libPersistentDescriptor) // Create a FileSpec from the persistentDescriptor nsIFileSpec *dllSpec = NULL; - NS_DEFINE_IID(kFileSpecIID, NS_IFILESPEC_IID); - rv = nsComponentManager::CreateInstance(NS_FILESPEC_PROGID, NULL, kFileSpecIID, (void **) &dllSpec); + rv = nsComponentManager::CreateInstance(NS_FILESPEC_PROGID, NULL, NS_GET_IID(nsIFileSpec), (void **) &dllSpec); if (NS_FAILED(rv)) { m_status = DLL_INVALID_PARAM; diff --git a/mozilla/xpcom/ds/nsArena.cpp b/mozilla/xpcom/ds/nsArena.cpp index 6f464d064df..c39251a2f28 100644 --- a/mozilla/xpcom/ds/nsArena.cpp +++ b/mozilla/xpcom/ds/nsArena.cpp @@ -38,7 +38,7 @@ ArenaImpl::Init(PRUint32 aBlockSize) return NS_OK; } -NS_IMPL_ISUPPORTS(ArenaImpl, nsIArena::GetIID()) +NS_IMPL_ISUPPORTS1(ArenaImpl, nsIArena) ArenaImpl::~ArenaImpl() { diff --git a/mozilla/xpcom/ds/nsAtomTable.cpp b/mozilla/xpcom/ds/nsAtomTable.cpp index 5cae85b6f08..bc67bb3decc 100644 --- a/mozilla/xpcom/ds/nsAtomTable.cpp +++ b/mozilla/xpcom/ds/nsAtomTable.cpp @@ -50,8 +50,7 @@ AtomImpl::~AtomImpl() } } -static NS_DEFINE_IID(kIAtomIID, NS_IATOM_IID); -NS_IMPL_ISUPPORTS(AtomImpl, kIAtomIID); +NS_IMPL_ISUPPORTS1(AtomImpl, nsIAtom) void* AtomImpl::operator new(size_t size, const PRUnichar* us, PRInt32 uslen) { diff --git a/mozilla/xpcom/ds/nsBuffer.cpp b/mozilla/xpcom/ds/nsBuffer.cpp index 5839646ac56..70e850488b9 100644 --- a/mozilla/xpcom/ds/nsBuffer.cpp +++ b/mozilla/xpcom/ds/nsBuffer.cpp @@ -73,7 +73,7 @@ nsBuffer::~nsBuffer() NS_IF_RELEASE(mAllocator); } -NS_IMPL_ISUPPORTS(nsBuffer, nsIBuffer::GetIID()); +NS_IMPL_ISUPPORTS1(nsBuffer, nsIBuffer) NS_METHOD nsBuffer::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) diff --git a/mozilla/xpcom/ds/nsByteBuffer.cpp b/mozilla/xpcom/ds/nsByteBuffer.cpp index de9b26e6130..980a9312493 100644 --- a/mozilla/xpcom/ds/nsByteBuffer.cpp +++ b/mozilla/xpcom/ds/nsByteBuffer.cpp @@ -40,8 +40,7 @@ ByteBufferImpl::Init(PRUint32 aBufferSize) return mBuffer ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } -NS_DEFINE_IID(kByteBufferIID,NS_IBYTE_BUFFER_IID); -NS_IMPL_ISUPPORTS(ByteBufferImpl,kByteBufferIID) +NS_IMPL_ISUPPORTS1(ByteBufferImpl,nsIByteBuffer) ByteBufferImpl::~ByteBufferImpl() { diff --git a/mozilla/xpcom/ds/nsCRT.cpp b/mozilla/xpcom/ds/nsCRT.cpp index 1149cc905d8..596ba8a3b83 100644 --- a/mozilla/xpcom/ds/nsCRT.cpp +++ b/mozilla/xpcom/ds/nsCRT.cpp @@ -126,12 +126,10 @@ public : NS_DECL_ISUPPORTS }; static NS_DEFINE_CID(kUnicharUtilCID, NS_UNICHARUTIL_CID); -static NS_DEFINE_IID(kICaseConversionIID, NS_ICASECONVERSION_IID); static nsICaseConversion * gCaseConv = NULL; -static NS_DEFINE_IID(kIShutdownListenerIID, NS_ISHUTDOWNLISTENER_IID); -NS_IMPL_ISUPPORTS(HandleCaseConversionShutdown, kIShutdownListenerIID); +NS_IMPL_ISUPPORTS1(HandleCaseConversionShutdown, nsIShutdownListener) nsresult HandleCaseConversionShutdown::OnShutdown(const nsCID& cid, @@ -156,7 +154,7 @@ static void StartUpCaseConversion() gListener = new HandleCaseConversionShutdown(); gListener->AddRef(); } - err = nsServiceManager::GetService(kUnicharUtilCID, kICaseConversionIID, + err = nsServiceManager::GetService(kUnicharUtilCID, NS_GET_IID(nsICaseConversion), (nsISupports**) &gCaseConv, gListener); } static void CheckCaseConversion() diff --git a/mozilla/xpcom/ds/nsConjoiningEnumerator.cpp b/mozilla/xpcom/ds/nsConjoiningEnumerator.cpp index b7d9a2f326f..6ae48a2d42e 100644 --- a/mozilla/xpcom/ds/nsConjoiningEnumerator.cpp +++ b/mozilla/xpcom/ds/nsConjoiningEnumerator.cpp @@ -56,24 +56,7 @@ nsConjoiningEnumerator::~nsConjoiningEnumerator(void) NS_RELEASE(mSecond); } -NS_IMPL_ADDREF(nsConjoiningEnumerator); -NS_IMPL_RELEASE(nsConjoiningEnumerator); - -NS_IMETHODIMP -nsConjoiningEnumerator::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) - return NS_ERROR_NULL_POINTER; - - if (aIID.Equals(nsIBidirectionalEnumerator::GetIID()) || - aIID.Equals(nsIEnumerator::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = (void*) this; - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS2(nsConjoiningEnumerator, nsIBidirectionalEnumerator, nsIEnumerator) NS_IMETHODIMP nsConjoiningEnumerator::First(void) @@ -210,7 +193,7 @@ nsIntersectionEnumerator::~nsIntersectionEnumerator(void) NS_RELEASE(mSecond); } -NS_IMPL_ISUPPORTS(nsIntersectionEnumerator, nsIEnumerator::GetIID()); +NS_IMPL_ISUPPORTS1(nsIntersectionEnumerator, nsIEnumerator) NS_IMETHODIMP nsIntersectionEnumerator::First(void) @@ -307,7 +290,7 @@ nsUnionEnumerator::~nsUnionEnumerator(void) NS_RELEASE(mSecond); } -NS_IMPL_ISUPPORTS(nsUnionEnumerator, nsIEnumerator::GetIID()); +NS_IMPL_ISUPPORTS1(nsUnionEnumerator, nsIEnumerator) NS_IMETHODIMP nsUnionEnumerator::First(void) diff --git a/mozilla/xpcom/ds/nsEmptyEnumerator.cpp b/mozilla/xpcom/ds/nsEmptyEnumerator.cpp index e6fc17e51a6..fd5de96d098 100644 --- a/mozilla/xpcom/ds/nsEmptyEnumerator.cpp +++ b/mozilla/xpcom/ds/nsEmptyEnumerator.cpp @@ -24,8 +24,6 @@ #include "nsIEnumerator.h" -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - //////////////////////////////////////////////////////////////////////// class EmptyEnumeratorImpl : public nsISimpleEnumerator @@ -48,7 +46,7 @@ public: return NS_ERROR_NULL_POINTER; if (iid.Equals(nsISimpleEnumerator::GetIID()) || - iid.Equals(kISupportsIID)) { + iid.Equals(NS_GET_IID(nsISupports))) { *result = (nsISimpleEnumerator*) this; NS_ADDREF(this); return NS_OK; diff --git a/mozilla/xpcom/ds/nsEnumeratorUtils.cpp b/mozilla/xpcom/ds/nsEnumeratorUtils.cpp index 7e66b47b34f..f265296d2fe 100644 --- a/mozilla/xpcom/ds/nsEnumeratorUtils.cpp +++ b/mozilla/xpcom/ds/nsEnumeratorUtils.cpp @@ -32,7 +32,7 @@ nsArrayEnumerator::~nsArrayEnumerator(void) NS_IF_RELEASE(mValueArray); } -NS_IMPL_ISUPPORTS(nsArrayEnumerator, nsISimpleEnumerator::GetIID()); +NS_IMPL_ISUPPORTS1(nsArrayEnumerator, nsISimpleEnumerator) NS_IMETHODIMP nsArrayEnumerator::HasMoreElements(PRBool* aResult) @@ -92,7 +92,7 @@ nsSingletonEnumerator::~nsSingletonEnumerator() NS_IF_RELEASE(mValue); } -NS_IMPL_ISUPPORTS(nsSingletonEnumerator, nsISimpleEnumerator::GetIID()); +NS_IMPL_ISUPPORTS1(nsSingletonEnumerator, nsISimpleEnumerator) NS_IMETHODIMP nsSingletonEnumerator::HasMoreElements(PRBool* aResult) @@ -153,7 +153,7 @@ nsAdapterEnumerator::~nsAdapterEnumerator() } -NS_IMPL_ISUPPORTS(nsAdapterEnumerator, nsISimpleEnumerator::GetIID()); +NS_IMPL_ISUPPORTS1(nsAdapterEnumerator, nsISimpleEnumerator) NS_IMETHODIMP nsAdapterEnumerator::HasMoreElements(PRBool* aResult) diff --git a/mozilla/xpcom/ds/nsHashtableEnumerator.cpp b/mozilla/xpcom/ds/nsHashtableEnumerator.cpp index e1050892302..316e0dd591b 100644 --- a/mozilla/xpcom/ds/nsHashtableEnumerator.cpp +++ b/mozilla/xpcom/ds/nsHashtableEnumerator.cpp @@ -145,37 +145,7 @@ nsHashtableEnumerator::ReleaseElements() } -NS_IMPL_ADDREF(nsHashtableEnumerator); -NS_IMPL_RELEASE(nsHashtableEnumerator); - -NS_IMETHODIMP -nsHashtableEnumerator::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if ( !aInstancePtr ) - return NS_ERROR_NULL_POINTER; - - if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) - *aInstancePtr = NS_STATIC_CAST(nsIBidirectionalEnumerator*, this); - else if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) - *aInstancePtr = NS_STATIC_CAST(nsIEnumerator*, this); - else if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) - *aInstancePtr = NS_STATIC_CAST(nsISupports*, - NS_STATIC_CAST(nsISupports*, this)); - else - *aInstancePtr = nsnull; - - nsresult status; - if ( !*aInstancePtr ) - status = NS_NOINTERFACE; - else - { - NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aInstancePtr)); - status = NS_OK; - } - - return status; - -} +NS_IMPL_ISUPPORTS2(nsHashtableEnumerator, nsIBidirectionalEnumerator, nsIEnumerator) nsHashtableEnumerator::~nsHashtableEnumerator() { diff --git a/mozilla/xpcom/ds/nsObserver.cpp b/mozilla/xpcom/ds/nsObserver.cpp index 46c8bd9a528..01abacefb3c 100644 --- a/mozilla/xpcom/ds/nsObserver.cpp +++ b/mozilla/xpcom/ds/nsObserver.cpp @@ -25,8 +25,7 @@ #include "nsObserver.h" #include "nsString.h" -static NS_DEFINE_IID(kIObserverIID, NS_IOBSERVER_IID); -static NS_DEFINE_IID(kObserverCID, NS_OBSERVER_CID); +static NS_DEFINE_CID(kObserverCID, NS_OBSERVER_CID); //////////////////////////////////////////////////////////////////////////////// // nsObserver Implementation @@ -36,7 +35,7 @@ NS_IMPL_AGGREGATED(nsObserver) NS_COM nsresult NS_NewObserver(nsIObserver** anObserver, nsISupports* outer) { - return nsObserver::Create(outer, kIObserverIID, (void**)anObserver); + return nsObserver::Create(outer, NS_GET_IID(nsIObserver), (void**)anObserver); } NS_METHOD diff --git a/mozilla/xpcom/ds/nsObserverList.cpp b/mozilla/xpcom/ds/nsObserverList.cpp index 29069ef80da..c045898e31d 100644 --- a/mozilla/xpcom/ds/nsObserverList.cpp +++ b/mozilla/xpcom/ds/nsObserverList.cpp @@ -26,15 +26,14 @@ #define NS_AUTOLOCK(__monitor) nsAutoLock __lock(__monitor) -static NS_DEFINE_IID(kIObserverListIID, NS_IOBSERVERLIST_IID); -static NS_DEFINE_IID(kObserverListCID, NS_OBSERVERLIST_CID); +static NS_DEFINE_CID(kObserverListCID, NS_OBSERVERLIST_CID); //////////////////////////////////////////////////////////////////////////////// // nsObserverList Implementation -NS_IMPL_ISUPPORTS(nsObserverList, kIObserverListIID); +NS_IMPL_ISUPPORTS1(nsObserverList, nsIObserverList) NS_COM nsresult NS_NewObserverList(nsIObserverList** anObserverList) { @@ -49,7 +48,7 @@ NS_COM nsresult NS_NewObserverList(nsIObserverList** anObserverList) return NS_ERROR_OUT_OF_MEMORY; } - return it->QueryInterface(kIObserverListIID, (void **) anObserverList); + return it->QueryInterface(NS_GET_IID(nsIObserverList), (void **) anObserverList); } nsObserverList::nsObserverList() diff --git a/mozilla/xpcom/ds/nsObserverService.cpp b/mozilla/xpcom/ds/nsObserverService.cpp index 7ada175006f..e998ad2d3e9 100644 --- a/mozilla/xpcom/ds/nsObserverService.cpp +++ b/mozilla/xpcom/ds/nsObserverService.cpp @@ -28,8 +28,7 @@ #include "nsHashtable.h" #include "nsString.h" -static NS_DEFINE_IID(kIObserverServiceIID, NS_IOBSERVERSERVICE_IID); -static NS_DEFINE_IID(kObserverServiceCID, NS_OBSERVERSERVICE_CID); +static NS_DEFINE_CID(kObserverServiceCID, NS_OBSERVERSERVICE_CID); //////////////////////////////////////////////////////////////////////////////// @@ -39,7 +38,7 @@ static nsObserverService* gObserverService = nsnull; // The one-and-only Observe // nsObserverService Implementation -NS_IMPL_ISUPPORTS(nsObserverService, kIObserverServiceIID); +NS_IMPL_ISUPPORTS1(nsObserverService, nsIObserverService) NS_COM nsresult NS_NewObserverService(nsIObserverService** anObserverService) { diff --git a/mozilla/xpcom/ds/nsPageMgr.cpp b/mozilla/xpcom/ds/nsPageMgr.cpp index 6aad4dedd14..0189dd9d361 100644 --- a/mozilla/xpcom/ds/nsPageMgr.cpp +++ b/mozilla/xpcom/ds/nsPageMgr.cpp @@ -538,27 +538,7 @@ nsPageMgr::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) return NS_OK; } -NS_IMPL_ADDREF(nsPageMgr); -NS_IMPL_RELEASE(nsPageMgr); - -NS_IMETHODIMP -nsPageMgr::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - NS_ASSERTION(aInstancePtr != nsnull, "null ptr"); - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - if (aIID.Equals(nsIPageManager::GetIID()) || - aIID.Equals(kISupportsIID)) { - *aInstancePtr = NS_STATIC_CAST(nsIPageManager*, this); - NS_ADDREF_THIS(); - return NS_OK; - } - if (aIID.Equals(nsIAllocator::GetIID())) { - *aInstancePtr = NS_STATIC_CAST(nsIAllocator*, this); - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS2(nsPageMgr, nsIPageManager, nsIAllocator) /******************************************************************************/ diff --git a/mozilla/xpcom/ds/nsProperties.cpp b/mozilla/xpcom/ds/nsProperties.cpp index e936a2a768f..908b776968a 100644 --- a/mozilla/xpcom/ds/nsProperties.cpp +++ b/mozilla/xpcom/ds/nsProperties.cpp @@ -215,22 +215,7 @@ nsPersistentProperties::Create(nsISupports *aOuter, REFNSIID aIID, void **aResul return rv; } -NS_IMPL_ADDREF(nsPersistentProperties) -NS_IMPL_RELEASE(nsPersistentProperties) - -NS_IMETHODIMP -nsPersistentProperties::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - NS_ASSERTION(aInstancePtr != nsnull, "null ptr"); - if (aIID.Equals(nsIPersistentProperties::GetIID()) || - aIID.Equals(nsIProperties::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = NS_STATIC_CAST(nsIPersistentProperties*, this); - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS2(nsPersistentProperties, nsIPersistentProperties, nsIProperties) NS_IMETHODIMP nsPersistentProperties::Load(nsIInputStream *aIn) @@ -520,21 +505,7 @@ nsPropertyElement::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) return rv; } -NS_IMPL_ADDREF(nsPropertyElement) -NS_IMPL_RELEASE(nsPropertyElement) - -NS_IMETHODIMP -nsPropertyElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - NS_ASSERTION(aInstancePtr != nsnull, "null ptr"); - if (aIID.Equals(nsIPropertyElement::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = NS_STATIC_CAST(nsIPropertyElement*, this); - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS1(nsPropertyElement, nsIPropertyElement) NS_IMETHODIMP nsPropertyElement::GetKey(nsString** aReturnKey) diff --git a/mozilla/xpcom/ds/nsSizeOfHandler.cpp b/mozilla/xpcom/ds/nsSizeOfHandler.cpp index 715a69148e4..6045386d532 100644 --- a/mozilla/xpcom/ds/nsSizeOfHandler.cpp +++ b/mozilla/xpcom/ds/nsSizeOfHandler.cpp @@ -18,8 +18,6 @@ #include "nsISizeOfHandler.h" #include "plhash.h" -static NS_DEFINE_IID(kISizeOfHandlerIID, NS_ISIZEOF_HANDLER_IID); - class nsSizeOfHandler : public nsISizeOfHandler { public: nsSizeOfHandler(); @@ -67,7 +65,7 @@ nsSizeOfHandler::~nsSizeOfHandler() } } -NS_IMPL_ISUPPORTS(nsSizeOfHandler, kISizeOfHandlerIID) +NS_IMPL_ISUPPORTS1(nsSizeOfHandler, nsISizeOfHandler) NS_IMETHODIMP nsSizeOfHandler::Add(size_t aSize) @@ -117,5 +115,5 @@ NS_NewSizeOfHandler(nsISizeOfHandler** aInstancePtrResult) if (it == nsnull) { return NS_ERROR_OUT_OF_MEMORY; } - return it->QueryInterface(kISizeOfHandlerIID, (void **) aInstancePtrResult); + return it->QueryInterface(NS_GET_IID(nsISizeOfHandler), (void **) aInstancePtrResult); } diff --git a/mozilla/xpcom/ds/nsSupportsArray.cpp b/mozilla/xpcom/ds/nsSupportsArray.cpp index 8089c2b0a15..e9a9564bde1 100644 --- a/mozilla/xpcom/ds/nsSupportsArray.cpp +++ b/mozilla/xpcom/ds/nsSupportsArray.cpp @@ -50,7 +50,7 @@ nsSupportsArray::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) return rv; } -NS_IMPL_ISUPPORTS(nsSupportsArray, nsISupportsArray::GetIID()); +NS_IMPL_ISUPPORTS1(nsSupportsArray, nsISupportsArray) void nsSupportsArray::DeleteArray(void) { diff --git a/mozilla/xpcom/ds/nsSupportsArrayEnumerator.cpp b/mozilla/xpcom/ds/nsSupportsArrayEnumerator.cpp index f3c777662ae..5061155cd6d 100644 --- a/mozilla/xpcom/ds/nsSupportsArrayEnumerator.cpp +++ b/mozilla/xpcom/ds/nsSupportsArrayEnumerator.cpp @@ -32,24 +32,7 @@ nsSupportsArrayEnumerator::~nsSupportsArrayEnumerator() NS_RELEASE(mArray); } -NS_IMPL_ADDREF(nsSupportsArrayEnumerator); -NS_IMPL_RELEASE(nsSupportsArrayEnumerator); - -NS_IMETHODIMP -nsSupportsArrayEnumerator::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) - return NS_ERROR_NULL_POINTER; - - if (aIID.Equals(nsIBidirectionalEnumerator::GetIID()) || - aIID.Equals(nsIEnumerator::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = (void*) this; - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS2(nsSupportsArrayEnumerator, nsIBidirectionalEnumerator, nsIEnumerator) NS_IMETHODIMP nsSupportsArrayEnumerator::First() diff --git a/mozilla/xpcom/ds/nsSupportsPrimitives.cpp b/mozilla/xpcom/ds/nsSupportsPrimitives.cpp index 0980d2340cc..5ce036cf9a1 100644 --- a/mozilla/xpcom/ds/nsSupportsPrimitives.cpp +++ b/mozilla/xpcom/ds/nsSupportsPrimitives.cpp @@ -23,7 +23,7 @@ /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsIDImpl, NS_GET_IID(nsISupportsID)) +NS_IMPL_ISUPPORTS1(nsSupportsIDImpl, nsISupportsID) nsSupportsIDImpl::nsSupportsIDImpl() : mData(nsnull) @@ -98,7 +98,7 @@ NS_IMETHODIMP nsSupportsIDImpl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsStringImpl, NS_GET_IID(nsISupportsString)) +NS_IMPL_ISUPPORTS1(nsSupportsStringImpl, nsISupportsString) nsSupportsStringImpl::nsSupportsStringImpl() : mData(nsnull) @@ -151,7 +151,7 @@ NS_IMETHODIMP nsSupportsStringImpl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsWStringImpl, NS_GET_IID(nsISupportsWString)) +NS_IMPL_ISUPPORTS1(nsSupportsWStringImpl, nsISupportsWString) nsSupportsWStringImpl::nsSupportsWStringImpl() : mData(nsnull) @@ -204,7 +204,7 @@ NS_IMETHODIMP nsSupportsWStringImpl::toString(PRUnichar **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRBoolImpl, NS_GET_IID(nsISupportsPRBool)) +NS_IMPL_ISUPPORTS1(nsSupportsPRBoolImpl, nsISupportsPRBool) nsSupportsPRBoolImpl::nsSupportsPRBoolImpl() : mData(PR_FALSE) @@ -247,7 +247,7 @@ NS_IMETHODIMP nsSupportsPRBoolImpl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRUint8Impl, NS_GET_IID(nsISupportsPRUint8)) +NS_IMPL_ISUPPORTS1(nsSupportsPRUint8Impl, nsISupportsPRUint8) nsSupportsPRUint8Impl::nsSupportsPRUint8Impl() : mData(0) @@ -294,7 +294,7 @@ NS_IMETHODIMP nsSupportsPRUint8Impl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRUint16Impl, NS_GET_IID(nsISupportsPRUint16)) +NS_IMPL_ISUPPORTS1(nsSupportsPRUint16Impl, nsISupportsPRUint16) nsSupportsPRUint16Impl::nsSupportsPRUint16Impl() : mData(0) @@ -341,7 +341,7 @@ NS_IMETHODIMP nsSupportsPRUint16Impl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRUint32Impl, NS_GET_IID(nsISupportsPRUint32)) +NS_IMPL_ISUPPORTS1(nsSupportsPRUint32Impl, nsISupportsPRUint32) nsSupportsPRUint32Impl::nsSupportsPRUint32Impl() : mData(0) @@ -388,7 +388,7 @@ NS_IMETHODIMP nsSupportsPRUint32Impl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRUint64Impl, NS_GET_IID(nsISupportsPRUint64)) +NS_IMPL_ISUPPORTS1(nsSupportsPRUint64Impl, nsISupportsPRUint64) nsSupportsPRUint64Impl::nsSupportsPRUint64Impl() : mData(LL_ZERO) @@ -435,7 +435,7 @@ NS_IMETHODIMP nsSupportsPRUint64Impl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRTimeImpl, NS_GET_IID(nsISupportsPRTime)) +NS_IMPL_ISUPPORTS1(nsSupportsPRTimeImpl, nsISupportsPRTime) nsSupportsPRTimeImpl::nsSupportsPRTimeImpl() : mData(LL_ZERO) @@ -482,7 +482,7 @@ NS_IMETHODIMP nsSupportsPRTimeImpl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsCharImpl, NS_GET_IID(nsISupportsChar)) +NS_IMPL_ISUPPORTS1(nsSupportsCharImpl, nsISupportsChar) nsSupportsCharImpl::nsSupportsCharImpl() : mData(0) @@ -529,7 +529,7 @@ NS_IMETHODIMP nsSupportsCharImpl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRInt16Impl, NS_GET_IID(nsISupportsPRInt16)) +NS_IMPL_ISUPPORTS1(nsSupportsPRInt16Impl, nsISupportsPRInt16) nsSupportsPRInt16Impl::nsSupportsPRInt16Impl() : mData(0) @@ -576,7 +576,7 @@ NS_IMETHODIMP nsSupportsPRInt16Impl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRInt32Impl, NS_GET_IID(nsISupportsPRInt32)) +NS_IMPL_ISUPPORTS1(nsSupportsPRInt32Impl, nsISupportsPRInt32) nsSupportsPRInt32Impl::nsSupportsPRInt32Impl() : mData(0) @@ -623,7 +623,7 @@ NS_IMETHODIMP nsSupportsPRInt32Impl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsPRInt64Impl, NS_GET_IID(nsISupportsPRInt64)) +NS_IMPL_ISUPPORTS1(nsSupportsPRInt64Impl, nsISupportsPRInt64) nsSupportsPRInt64Impl::nsSupportsPRInt64Impl() : mData(LL_ZERO) @@ -670,7 +670,7 @@ NS_IMETHODIMP nsSupportsPRInt64Impl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsFloatImpl, NS_GET_IID(nsISupportsFloat)) +NS_IMPL_ISUPPORTS1(nsSupportsFloatImpl, nsISupportsFloat) nsSupportsFloatImpl::nsSupportsFloatImpl() : mData(float(0.0)) @@ -717,7 +717,7 @@ NS_IMETHODIMP nsSupportsFloatImpl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsDoubleImpl, NS_GET_IID(nsISupportsDouble)) +NS_IMPL_ISUPPORTS1(nsSupportsDoubleImpl, nsISupportsDouble) nsSupportsDoubleImpl::nsSupportsDoubleImpl() : mData(double(0.0)) @@ -765,7 +765,7 @@ NS_IMETHODIMP nsSupportsDoubleImpl::toString(char **_retval) /***************************************************************************/ -NS_IMPL_ISUPPORTS(nsSupportsVoidImpl, NS_GET_IID(nsISupportsVoid)) +NS_IMPL_ISUPPORTS1(nsSupportsVoidImpl, nsISupportsVoid) nsSupportsVoidImpl::nsSupportsVoidImpl() : mData(nsnull) diff --git a/mozilla/xpcom/ds/nsUnicharBuffer.cpp b/mozilla/xpcom/ds/nsUnicharBuffer.cpp index 3f4cac49ef9..6664b621d67 100644 --- a/mozilla/xpcom/ds/nsUnicharBuffer.cpp +++ b/mozilla/xpcom/ds/nsUnicharBuffer.cpp @@ -56,7 +56,7 @@ UnicharBufferImpl::Init(PRUint32 aBufferSize) return mBuffer ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } -NS_IMPL_ISUPPORTS(UnicharBufferImpl, nsIUnicharBuffer::GetIID()) +NS_IMPL_ISUPPORTS1(UnicharBufferImpl, nsIUnicharBuffer) UnicharBufferImpl::~UnicharBufferImpl() { diff --git a/mozilla/xpcom/ds/nsVariant.cpp b/mozilla/xpcom/ds/nsVariant.cpp index 2f43fa0f7b7..22d6ea4a956 100644 --- a/mozilla/xpcom/ds/nsVariant.cpp +++ b/mozilla/xpcom/ds/nsVariant.cpp @@ -44,7 +44,7 @@ protected: nsVariantValue mValue; }; -NS_IMPL_ISUPPORTS(nsVariant, nsIVariant::GetIID()); +NS_IMPL_ISUPPORTS1(nsVariant, nsIVariant) nsVariant::nsVariant(nsVariantType type, nsVariantValue& value) : mType(type), mValue(value) diff --git a/mozilla/xpcom/glue/nsGenericFactory.cpp b/mozilla/xpcom/glue/nsGenericFactory.cpp index c0ef64d0099..ecff2c40ced 100644 --- a/mozilla/xpcom/glue/nsGenericFactory.cpp +++ b/mozilla/xpcom/glue/nsGenericFactory.cpp @@ -30,23 +30,7 @@ nsGenericFactory::~nsGenericFactory() (*mDestructor) (); } -NS_METHOD nsGenericFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - if (aIID.Equals(nsIGenericFactory::GetIID()) || - aIID.Equals(nsIFactory::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = (nsIGenericFactory*) this; - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} - -NS_IMPL_ADDREF(nsGenericFactory) -NS_IMPL_RELEASE(nsGenericFactory) +NS_IMPL_ISUPPORTS2(nsGenericFactory, nsIGenericFactory, nsIFactory) NS_IMETHODIMP nsGenericFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult) { diff --git a/mozilla/xpcom/glue/nsISupportsUtils.h b/mozilla/xpcom/glue/nsISupportsUtils.h index a308a3a23ae..0a93472d393 100644 --- a/mozilla/xpcom/glue/nsISupportsUtils.h +++ b/mozilla/xpcom/glue/nsISupportsUtils.h @@ -277,6 +277,13 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_BODY(_i2) \ NS_IMPL_QUERY_TAIL(_i1) +#define NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) \ + NS_IMPL_QUERY_HEAD(_class) \ + NS_IMPL_QUERY_BODY(_i1) \ + NS_IMPL_QUERY_BODY(_i2) \ + NS_IMPL_QUERY_BODY(_i3) \ + NS_IMPL_QUERY_TAIL(_i1) + /* @@ -336,6 +343,11 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_RELEASE(_class) \ NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2) +#define NS_IMPL_ISUPPORTS3(_class, _i1, _i2, _i3) \ + NS_IMPL_ADDREF(_class) \ + NS_IMPL_RELEASE(_class) \ + NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) + //////////////////////////////////////////////////////////////////////////////// /** diff --git a/mozilla/xpcom/glue/nsWeakReference.cpp b/mozilla/xpcom/glue/nsWeakReference.cpp index 5af1f7c6f52..7b2f2550e61 100644 --- a/mozilla/xpcom/glue/nsWeakReference.cpp +++ b/mozilla/xpcom/glue/nsWeakReference.cpp @@ -80,25 +80,29 @@ nsWeakReference::Release() NS_IMETHODIMP nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr ) { + NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!"); + if ( !aInstancePtr ) return NS_ERROR_NULL_POINTER; + nsISupports* foundInterface; if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) - *aInstancePtr = NS_STATIC_CAST(nsIWeakReference*, this); + foundInterface = NS_STATIC_CAST(nsIWeakReference*, this); else if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) - *aInstancePtr = NS_STATIC_CAST(nsISupports*, this); + foundInterface = NS_STATIC_CAST(nsISupports*, this); else - *aInstancePtr = 0; + foundInterface = 0; nsresult status; - if ( !*aInstancePtr ) + if ( !foundInterface ) status = NS_NOINTERFACE; else { - NS_ADDREF( NS_REINTERPRET_CAST(nsISupports*, *aInstancePtr) ); + NS_ADDREF(foundInterface); status = NS_OK; } + *aInstancePtr = foundInterface; return status; } diff --git a/mozilla/xpcom/io/nsByteBufferInputStream.cpp b/mozilla/xpcom/io/nsByteBufferInputStream.cpp index 31f4fb1ad99..3427fed9b75 100644 --- a/mozilla/xpcom/io/nsByteBufferInputStream.cpp +++ b/mozilla/xpcom/io/nsByteBufferInputStream.cpp @@ -66,24 +66,7 @@ nsByteBufferInputStream::~nsByteBufferInputStream() if (mBuffer) delete mBuffer; } -NS_IMPL_ADDREF(nsByteBufferInputStream); -NS_IMPL_RELEASE(nsByteBufferInputStream); - -NS_IMETHODIMP -nsByteBufferInputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (aInstancePtr == nsnull) - return NS_ERROR_NULL_POINTER; - if (aIID.Equals(nsIByteBufferInputStream::GetIID()) || - aIID.Equals(nsIInputStream::GetIID()) || - aIID.Equals(nsIBaseStream::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = this; - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS3(nsByteBufferInputStream, nsIByteBufferInputStream, nsIInputStream, nsIBaseStream) NS_IMETHODIMP nsByteBufferInputStream::Close(void) @@ -320,23 +303,7 @@ nsByteBufferOutputStream::~nsByteBufferOutputStream() NS_IF_RELEASE(mInputStream); } -NS_IMPL_ADDREF(nsByteBufferOutputStream); -NS_IMPL_RELEASE(nsByteBufferOutputStream); - -NS_IMETHODIMP -nsByteBufferOutputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (aInstancePtr == nsnull) - return NS_ERROR_NULL_POINTER; - if (aIID.Equals(nsIOutputStream::GetIID()) || - aIID.Equals(nsIBaseStream::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = this; - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS2(nsByteBufferOutputStream, nsIOutputStream, nsIBaseStream) NS_IMETHODIMP nsByteBufferOutputStream::Close(void) diff --git a/mozilla/xpcom/io/nsFileSpecImpl.cpp b/mozilla/xpcom/io/nsFileSpecImpl.cpp index b6e92884ee7..1b861de527a 100644 --- a/mozilla/xpcom/io/nsFileSpecImpl.cpp +++ b/mozilla/xpcom/io/nsFileSpecImpl.cpp @@ -23,8 +23,7 @@ #include "prmem.h" -//static NS_DEFINE_IID(kIFileSpecIID, NS_IFILESPEC_IID); -NS_IMPL_ISUPPORTS(nsFileSpecImpl, nsIFileSpec::GetIID()) +NS_IMPL_ISUPPORTS1(nsFileSpecImpl, nsIFileSpec) #ifdef NS_DEBUG #define TEST_OUT_PTR(p) \ @@ -641,7 +640,7 @@ NS_IMETHODIMP nsFileSpecImpl::endline() return s.error(); } -NS_IMPL_ISUPPORTS(nsDirectoryIteratorImpl, nsIDirectoryIterator::GetIID()) +NS_IMPL_ISUPPORTS1(nsDirectoryIteratorImpl, nsIDirectoryIterator) //---------------------------------------------------------------------------------------- nsDirectoryIteratorImpl::nsDirectoryIteratorImpl() diff --git a/mozilla/xpcom/io/nsIFileStream.cpp b/mozilla/xpcom/io/nsIFileStream.cpp index 92bc0a6ce26..e6e729c8b20 100644 --- a/mozilla/xpcom/io/nsIFileStream.cpp +++ b/mozilla/xpcom/io/nsIFileStream.cpp @@ -180,50 +180,21 @@ class FileImpl PRInt32 mLength; }; // class FileImpl -#define SAY_I_IMPLEMENT(classname) \ - if (aIID.Equals(classname::GetIID())) \ - { \ - *aInstancePtr = (void*)((classname*)this); \ - NS_ADDREF_THIS(); \ - return NS_OK; \ - } - NS_IMPL_RELEASE(FileImpl) NS_IMPL_ADDREF(FileImpl) -//---------------------------------------------------------------------------------------- -NS_IMETHODIMP FileImpl::QueryInterface(REFNSIID aIID, void** aInstancePtr) -//---------------------------------------------------------------------------------------- -{ - if (!aInstancePtr) - return NS_ERROR_NULL_POINTER; +NS_IMPL_QUERY_HEAD(FileImpl) + NS_IMPL_QUERY_BODY(nsIFile) + NS_IMPL_QUERY_BODY(nsIRandomAccessStore) + NS_IMPL_QUERY_BODY(nsIOutputStream) + NS_IMPL_QUERY_BODY(nsIInputStream) + NS_IMPL_QUERY_BODY(nsIFileInputStream) + NS_IMPL_QUERY_BODY(nsIFileOutputStream) + if ( aIID.Equals(NS_GET_IID(nsIBaseStream)) ) + foundInterface = NS_STATIC_CAST(nsIBaseStream*, NS_STATIC_CAST(nsIOutputStream*, this)); + else +NS_IMPL_QUERY_TAIL(nsIOutputStream) - *aInstancePtr = nsnull; - - SAY_I_IMPLEMENT(nsIFile) - SAY_I_IMPLEMENT(nsIRandomAccessStore) - SAY_I_IMPLEMENT(nsIOutputStream) - SAY_I_IMPLEMENT(nsIInputStream) - SAY_I_IMPLEMENT(nsIFileInputStream) - SAY_I_IMPLEMENT(nsIFileOutputStream) - // Note that we derive from two copies of nsIBaseStream (and hence - // of nsISupports), one through - // nsIOutputStream, the other through nsIInputStream. Resolve this - // by giving them a specific one - if (aIID.Equals(((nsIBaseStream*)(nsIOutputStream*)this)->GetIID())) - { - *aInstancePtr = (void*)((nsIBaseStream*)(nsIOutputStream*)this); - NS_ADDREF_THIS(); - return NS_OK; - } - if (aIID.Equals(nsCOMTypeInfo::GetIID())) - { - *aInstancePtr = (void*)((nsISupports*)(nsIOutputStream*)this); - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} // FileImpl::QueryInterface //---------------------------------------------------------------------------------------- NS_IMETHODIMP FileImpl::Open( diff --git a/mozilla/xpcom/io/nsIStringStream.cpp b/mozilla/xpcom/io/nsIStringStream.cpp index 4aefc75f7b1..998308ef4e0 100644 --- a/mozilla/xpcom/io/nsIStringStream.cpp +++ b/mozilla/xpcom/io/nsIStringStream.cpp @@ -316,47 +316,17 @@ class StringImpl }; // class StringImpl -#define SAY_I_IMPLEMENT(classname) \ - if (aIID.Equals(classname::GetIID())) \ - { \ - *aInstancePtr = (void*)((classname*)this); \ - NS_ADDREF_THIS(); \ - return NS_OK; \ - } - NS_IMPL_RELEASE(BasicStringImpl) NS_IMPL_ADDREF(BasicStringImpl) -//---------------------------------------------------------------------------------------- -NS_IMETHODIMP BasicStringImpl::QueryInterface(REFNSIID aIID, void** aInstancePtr) -//---------------------------------------------------------------------------------------- -{ - if (!aInstancePtr) - return NS_ERROR_NULL_POINTER; - - *aInstancePtr = nsnull; - - SAY_I_IMPLEMENT(nsIRandomAccessStore) - SAY_I_IMPLEMENT(nsIOutputStream) - SAY_I_IMPLEMENT(nsIInputStream) - // Note that we derive from two copies of nsIBaseStream (and hence - // of nsISupports), one through - // nsIOutputStream, the other through nsIInputStream. Resolve this - // by giving them a specific one - if (aIID.Equals(((nsIBaseStream*)(nsIOutputStream*)this)->GetIID())) - { - *aInstancePtr = (void*)((nsIBaseStream*)(nsIOutputStream*)this); - NS_ADDREF_THIS(); - return NS_OK; - } - if (aIID.Equals(nsCOMTypeInfo::GetIID())) - { - *aInstancePtr = (void*)((nsISupports*)(nsIOutputStream*)this); - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} // StringImpl::QueryInterface +NS_IMPL_QUERY_HEAD(BasicStringImpl) + NS_IMPL_QUERY_BODY(nsIRandomAccessStore) + NS_IMPL_QUERY_BODY(nsIOutputStream) + NS_IMPL_QUERY_BODY(nsIInputStream) + if ( aIID.Equals(NS_GET_IID(nsIBaseStream)) ) + foundInterface = NS_STATIC_CAST(nsIBaseStream*, NS_STATIC_CAST(nsIOutputStream*, this)); + else +NS_IMPL_QUERY_TAIL(nsIOutputStream) //---------------------------------------------------------------------------------------- NS_IMETHODIMP BasicStringImpl::Seek(PRSeekWhence whence, PRInt32 offset) diff --git a/mozilla/xpcom/io/nsPipe.cpp b/mozilla/xpcom/io/nsPipe.cpp index 8038afa05ec..984591965fe 100644 --- a/mozilla/xpcom/io/nsPipe.cpp +++ b/mozilla/xpcom/io/nsPipe.cpp @@ -97,24 +97,7 @@ nsBufferInputStream::~nsBufferInputStream() NS_RELEASE(mBuffer); } -NS_IMPL_ADDREF(nsBufferInputStream); -NS_IMPL_RELEASE(nsBufferInputStream); - -NS_IMETHODIMP -nsBufferInputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (aInstancePtr == nsnull) - return NS_ERROR_NULL_POINTER; - if (aIID.Equals(nsIBufferInputStream::GetIID()) || - aIID.Equals(nsIInputStream::GetIID()) || - aIID.Equals(nsIBaseStream::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = this; - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS3(nsBufferInputStream, nsIBufferInputStream, nsIInputStream, nsIBaseStream) NS_IMETHODIMP nsBufferInputStream::Close(void) @@ -300,24 +283,7 @@ nsBufferOutputStream::~nsBufferOutputStream() NS_RELEASE(mBuffer); } -NS_IMPL_ADDREF(nsBufferOutputStream); -NS_IMPL_RELEASE(nsBufferOutputStream); - -NS_IMETHODIMP -nsBufferOutputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (aInstancePtr == nsnull) - return NS_ERROR_NULL_POINTER; - if (aIID.Equals(nsIBufferOutputStream::GetIID()) || - aIID.Equals(nsIOutputStream::GetIID()) || - aIID.Equals(nsIBaseStream::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { - *aInstancePtr = this; - NS_ADDREF_THIS(); - return NS_OK; - } - return NS_NOINTERFACE; -} +NS_IMPL_ISUPPORTS3(nsBufferOutputStream, nsIBufferOutputStream, nsIOutputStream, nsIBaseStream) NS_IMETHODIMP nsBufferOutputStream::Close(void) diff --git a/mozilla/xpcom/io/nsUnicharInputStream.cpp b/mozilla/xpcom/io/nsUnicharInputStream.cpp index abcc6237e88..6edd8a12e6f 100644 --- a/mozilla/xpcom/io/nsUnicharInputStream.cpp +++ b/mozilla/xpcom/io/nsUnicharInputStream.cpp @@ -32,7 +32,6 @@ #include #endif -static NS_DEFINE_IID(kIUnicharInputStreamIID, NS_IUNICHAR_INPUT_STREAM_IID); static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); class StringUnicharInputStream : public nsIUnicharInputStream { @@ -98,7 +97,7 @@ nsresult StringUnicharInputStream::Close() return NS_OK; } -NS_IMPL_ISUPPORTS(StringUnicharInputStream, kIUnicharInputStreamIID); +NS_IMPL_ISUPPORTS1(StringUnicharInputStream, nsIUnicharInputStream) NS_COM nsresult NS_NewStringUnicharInputStream(nsIUnicharInputStream** aInstancePtrResult, @@ -115,7 +114,7 @@ NS_NewStringUnicharInputStream(nsIUnicharInputStream** aInstancePtrResult, return NS_ERROR_OUT_OF_MEMORY; } - return it->QueryInterface(kIUnicharInputStreamIID, + return it->QueryInterface(NS_GET_IID(nsIUnicharInputStream), (void**) aInstancePtrResult); } @@ -201,7 +200,7 @@ ConverterInputStream::ConverterInputStream(nsIInputStream* aStream, mUnicharDataLength = 0; } -NS_IMPL_ISUPPORTS(ConverterInputStream,kIUnicharInputStreamIID); +NS_IMPL_ISUPPORTS1(ConverterInputStream,nsIUnicharInputStream) ConverterInputStream::~ConverterInputStream() { @@ -315,6 +314,6 @@ NS_NewConverterStream(nsIUnicharInputStream** aInstancePtrResult, if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } - return it->QueryInterface(kIUnicharInputStreamIID, + return it->QueryInterface(NS_GET_IID(nsIUnicharInputStream), (void **) aInstancePtrResult); } diff --git a/mozilla/xpcom/proxy/src/nsProxyEvent.cpp b/mozilla/xpcom/proxy/src/nsProxyEvent.cpp index 7fcd8bd775e..ec88f2a21df 100644 --- a/mozilla/xpcom/proxy/src/nsProxyEvent.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyEvent.cpp @@ -28,9 +28,6 @@ #include "nsIServiceManager.h" #include "nsIAllocator.h" -static NS_DEFINE_IID(kProxyObjectManagerIID, NS_IPROXYEVENT_MANAGER_IID); -static NS_DEFINE_IID(kProxyObject_Identity_Class_IID, NS_PROXYEVENT_IDENTITY_CLASS_IID); - static void* EventHandler(PLEvent *self); static void DestroyHandler(PLEvent *self); @@ -56,8 +53,7 @@ nsProxyObjectCallInfo::~nsProxyObjectCallInfo() free( (void*) mParameterList); } -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -NS_IMPL_ISUPPORTS(nsProxyObject, kISupportsIID) +NS_IMPL_ISUPPORTS0(nsProxyObject) nsProxyObject::nsProxyObject() { @@ -251,6 +247,9 @@ nsProxyObject::AutoProxyParameterList(PRUint32 methodIndex, nsXPTMethodInfo *met continue; nsISupports *aProxyObject; + + // I wish I could get rid of this instance of |NS_DEFINE_IID|, but |ProxyEventClassIdentity| is not visible from here + static NS_DEFINE_IID(kProxyObject_Identity_Class_IID, NS_PROXYEVENT_IDENTITY_CLASS_IID); rv = anInterface->QueryInterface(kProxyObject_Identity_Class_IID, (void**)&aProxyObject); if (NS_FAILED(rv)) @@ -259,7 +258,7 @@ nsProxyObject::AutoProxyParameterList(PRUint32 methodIndex, nsXPTMethodInfo *met nsIProxyObjectManager* manager; rv = nsServiceManager::GetService( NS_XPCOMPROXY_PROGID, - kProxyObjectManagerIID, + NS_GET_IID(nsIProxyObjectManager), (nsISupports **)&manager); if (NS_SUCCEEDED(rv)) diff --git a/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp b/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp index 3749f89f7d0..2b923ce4ed3 100644 --- a/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp @@ -32,7 +32,7 @@ #include "nsIThread.h" -static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); +static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); /***************************************************************************/ /* nsProxyCreateInstance */ @@ -58,8 +58,8 @@ nsProxyCreateInstance::nsProxyCreateInstance() nsProxyCreateInstance::~nsProxyCreateInstance() { } -static NS_DEFINE_IID(kIProxyCreateInstanceIID,NS_IPROXYCREATEINSTANCE_IID); -NS_IMPL_ISUPPORTS(nsProxyCreateInstance, kIProxyCreateInstanceIID); + +NS_IMPL_ISUPPORTS1(nsProxyCreateInstance, nsIProxyCreateInstance) NS_IMETHODIMP nsProxyCreateInstance::CreateInstanceByIID(const nsIID & cid, nsISupports *aOuter, const nsIID & iid, void * *result) { @@ -94,8 +94,7 @@ NS_IMETHODIMP nsProxyCreateInstance::CreateInstanceByProgID(const char *aProgID, nsProxyObjectManager* nsProxyObjectManager::mInstance = nsnull; -static NS_DEFINE_IID(kIProxyEventManager, NS_IPROXYEVENT_MANAGER_IID); -NS_IMPL_ISUPPORTS(nsProxyObjectManager, kIProxyEventManager) +NS_IMPL_ISUPPORTS1(nsProxyObjectManager, nsIProxyObjectManager) nsProxyObjectManager::nsProxyObjectManager() { @@ -284,7 +283,7 @@ nsProxyEventFactory::~nsProxyEventFactory(void) { } -NS_IMPL_ISUPPORTS(nsProxyEventFactory,nsIFactory::GetIID()) +NS_IMPL_ISUPPORTS1(nsProxyEventFactory,nsIFactory) NS_IMETHODIMP nsProxyEventFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult) @@ -327,7 +326,7 @@ nsProxyEventFactory::LockFactory(PRBool aLock) //////////////////////////////////////////////////////////////////////////////// // DLL Entry Points: //////////////////////////////////////////////////////////////////////////////// -static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); +static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); extern "C" NS_EXPORT PRBool diff --git a/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfo.cpp b/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfo.cpp index 373fc9599fa..b85a0170c64 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfo.cpp +++ b/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfo.cpp @@ -29,8 +29,7 @@ #include "nsInterfaceInfoManager.h" #include "xptinfo.h" -static NS_DEFINE_IID(kIInterfaceInfoIID, NS_IINTERFACEINFO_IID); -NS_IMPL_ISUPPORTS(nsInterfaceInfo, kIInterfaceInfoIID); +NS_IMPL_ISUPPORTS1(nsInterfaceInfo, nsIInterfaceInfo) nsInterfaceInfo::nsInterfaceInfo(nsInterfaceRecord *record, nsInterfaceInfo *parent) diff --git a/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp b/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp index dcddd3f8e4f..d94cae59b49 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp +++ b/mozilla/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp @@ -55,8 +55,7 @@ #endif -static NS_DEFINE_IID(kIIIManagerIID, NS_IINTERFACEINFO_MANAGER_IID); -NS_IMPL_ISUPPORTS(nsInterfaceInfoManager, kIIIManagerIID); +NS_IMPL_ISUPPORTS1(nsInterfaceInfoManager, nsIInterfaceInfoManager) // static nsInterfaceInfoManager* @@ -90,8 +89,7 @@ nsInterfaceInfoManager::GetAllocator(nsInterfaceInfoManager* iim /*= NULL*/) return al; } -static NS_DEFINE_IID(kAllocatorCID, NS_ALLOCATOR_CID); -static NS_DEFINE_IID(kIAllocatorIID, NS_IALLOCATOR_IID); +static NS_DEFINE_CID(kAllocatorCID, NS_ALLOCATOR_CID); nsInterfaceInfoManager::nsInterfaceInfoManager() : typelibRecords(NULL), allocator(NULL), ctor_succeeded(PR_FALSE) @@ -100,7 +98,7 @@ nsInterfaceInfoManager::nsInterfaceInfoManager() NS_ADDREF_THIS(); nsServiceManager::GetService(kAllocatorCID, - kIAllocatorIID, + NS_GET_IID(nsIAllocator), (nsISupports **)&this->allocator); PR_ASSERT(this->allocator != NULL); diff --git a/mozilla/xpcom/threads/nsEventQueue.cpp b/mozilla/xpcom/threads/nsEventQueue.cpp index b1ef3715e6e..b9e9157003e 100644 --- a/mozilla/xpcom/threads/nsEventQueue.cpp +++ b/mozilla/xpcom/threads/nsEventQueue.cpp @@ -49,7 +49,7 @@ nsEventQueueImpl::InitFromPLQueue(PLEventQueue* aQueue) } /* nsISupports interface implementation... */ -NS_IMPL_ISUPPORTS(nsEventQueueImpl,kIEventQueueIID); +NS_IMPL_ISUPPORTS1(nsEventQueueImpl,nsIEventQueue) /* nsIEventQueue interface implementation... */ diff --git a/mozilla/xpcom/threads/nsEventQueueService.cpp b/mozilla/xpcom/threads/nsEventQueueService.cpp index ad08d843d6d..513da2b8904 100644 --- a/mozilla/xpcom/threads/nsEventQueueService.cpp +++ b/mozilla/xpcom/threads/nsEventQueueService.cpp @@ -22,16 +22,13 @@ #include "nsComponentManager.h" #include "nsIEventQueue.h" -static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); - -static NS_DEFINE_IID(kIEventQueueIID, NS_IEVENTQUEUE_IID); -static NS_DEFINE_IID(kEventQueueCID, NS_EVENTQUEUE_CID); +static NS_DEFINE_CID(kEventQueueCID, NS_EVENTQUEUE_CID); EventQueueStack::EventQueueStack(EventQueueStack* next) :mNextQueue(next) { // Create our thread queue using the component manager - if (NS_FAILED(nsComponentManager::CreateInstance(kEventQueueCID, NULL, kIEventQueueIID, + if (NS_FAILED(nsComponentManager::CreateInstance(kEventQueueCID, NULL, NS_GET_IID(nsIEventQueue), (void**)&mEventQueue))) { mEventQueue = NULL; } @@ -74,7 +71,7 @@ void EventQueueStack::SetNext(EventQueueStack* aStack) //////////////////////////////////////////////////////////////////////////////// /* nsISupports interface implementation... */ -NS_IMPL_ISUPPORTS(EventQueueEntry,nsCOMTypeInfo::GetIID()); +NS_IMPL_ISUPPORTS0(EventQueueEntry) EventQueueEntry::EventQueueEntry() { @@ -162,7 +159,7 @@ nsEventQueueServiceImpl::Create(nsISupports *aOuter, REFNSIID aIID, void **aResu } /* nsISupports interface implementation... */ -NS_IMPL_ISUPPORTS(nsEventQueueServiceImpl,kIEventQueueServiceIID); +NS_IMPL_ISUPPORTS1(nsEventQueueServiceImpl,nsIEventQueueService) /* nsIEventQueueService interface implementation... */ @@ -229,7 +226,7 @@ nsEventQueueServiceImpl::CreateFromPLEventQueue(PLEventQueue* aPLEventQueue, nsI // Create our thread queue using the component manager nsresult rv; nsIEventQueue* aQueue; - if (NS_FAILED(rv = nsComponentManager::CreateInstance(kEventQueueCID, NULL, kIEventQueueIID, + if (NS_FAILED(rv = nsComponentManager::CreateInstance(kEventQueueCID, NULL, NS_GET_IID(nsIEventQueue), (void**)&aQueue))) { return rv; } diff --git a/mozilla/xpcom/threads/nsThread.cpp b/mozilla/xpcom/threads/nsThread.cpp index b6ad25c235a..83db02e8a9c 100644 --- a/mozilla/xpcom/threads/nsThread.cpp +++ b/mozilla/xpcom/threads/nsThread.cpp @@ -119,7 +119,7 @@ nsThread::Exit(void* arg) NS_RELEASE(self); } -NS_IMPL_ISUPPORTS(nsThread, nsIThread::GetIID()); +NS_IMPL_ISUPPORTS1(nsThread, nsIThread) NS_IMETHODIMP nsThread::Join() @@ -367,7 +367,7 @@ nsThreadPool::~nsThreadPool() } } -NS_IMPL_ISUPPORTS(nsThreadPool, nsIThreadPool::GetIID()); +NS_IMPL_ISUPPORTS1(nsThreadPool, nsIThreadPool) NS_IMETHODIMP nsThreadPool::DispatchRequest(nsIRunnable* runnable) @@ -540,7 +540,7 @@ nsThreadPoolRunnable::~nsThreadPoolRunnable() NS_RELEASE(mPool); } -NS_IMPL_ISUPPORTS(nsThreadPoolRunnable, nsIRunnable::GetIID()); +NS_IMPL_ISUPPORTS1(nsThreadPoolRunnable, nsIRunnable) NS_IMETHODIMP nsThreadPoolRunnable::Run()