From 9b0cfefb705e4753a252df98a9bd3789aafd2c3f Mon Sep 17 00:00:00 2001 From: "dp%netscape.com" Date: Tue, 30 Nov 1999 23:36:32 +0000 Subject: [PATCH] NS_GET_IID(). Thanks to patch from pp@ludasdesign.com r=dp@netscape.com git-svn-id: svn://10.0.0.236/trunk@54812 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/base/nsAllocator.cpp | 7 ++++--- mozilla/xpcom/base/nsISupportsUtils.h | 10 +++++----- mozilla/xpcom/base/nsIWeakReference.idl | 3 ++- mozilla/xpcom/base/nsWeakReference.cpp | 5 +++-- mozilla/xpcom/build/nsConstructorPattern.cpp | 5 +++-- mozilla/xpcom/components/nsComponentManager.cpp | 4 ++-- mozilla/xpcom/components/nsGenericFactory.cpp | 3 ++- mozilla/xpcom/components/nsIServiceManager.h | 3 ++- mozilla/xpcom/ds/bufferRoutines.h | 7 +++---- mozilla/xpcom/ds/nsArena.cpp | 3 ++- mozilla/xpcom/ds/nsByteBuffer.cpp | 3 ++- mozilla/xpcom/ds/nsConjoiningEnumerator.cpp | 7 ++++--- mozilla/xpcom/ds/nsEmptyEnumerator.cpp | 3 ++- mozilla/xpcom/ds/nsHashtableEnumerator.cpp | 3 ++- mozilla/xpcom/ds/nsObserver.cpp | 5 +++-- mozilla/xpcom/ds/nsObserverService.cpp | 3 ++- mozilla/xpcom/ds/nsProperties.cpp | 7 ++++--- mozilla/xpcom/ds/nsSupportsArray.cpp | 3 ++- mozilla/xpcom/ds/nsUnicharBuffer.cpp | 3 ++- mozilla/xpcom/glue/nsGenericFactory.cpp | 3 ++- mozilla/xpcom/glue/nsISupportsUtils.h | 10 +++++----- mozilla/xpcom/glue/nsWeakReference.cpp | 5 +++-- mozilla/xpcom/io/nsFileSpecImpl.cpp | 7 ++++--- mozilla/xpcom/io/nsFileUtils.cpp | 4 ++-- mozilla/xpcom/io/nsIFileStream.cpp | 7 ++++--- mozilla/xpcom/io/nsPipe2.cpp | 17 +++++++++-------- mozilla/xpcom/io/nsStorageStream.cpp | 5 +++-- 27 files changed, 83 insertions(+), 62 deletions(-) diff --git a/mozilla/xpcom/base/nsAllocator.cpp b/mozilla/xpcom/base/nsAllocator.cpp index a9ec9a2fe36..f4e43c8ea10 100644 --- a/mozilla/xpcom/base/nsAllocator.cpp +++ b/mozilla/xpcom/base/nsAllocator.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ //////////////////////////////////////////////////////////////////////////////// @@ -43,9 +44,9 @@ nsAllocatorImpl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr { NS_ENSURE_ARG_POINTER(aInstancePtr); - if (aIID.Equals(nsCOMTypeInfo::GetIID())) + if (aIID.Equals(NS_GET_IID(nsISupports))) *aInstancePtr = GetInner(); - else if (aIID.Equals(nsIAllocator::GetIID())) + else if (aIID.Equals(NS_GET_IID(nsIAllocator))) *aInstancePtr = NS_STATIC_CAST(nsIAllocator*, this); else { *aInstancePtr = nsnull; @@ -187,7 +188,7 @@ nsIAllocator* nsAllocator::mAllocator = NULL; PRBool nsAllocator::FetchAllocator() { - nsAllocatorImpl::Create(NULL, nsIAllocator::GetIID(), (void**)&mAllocator); + nsAllocatorImpl::Create(NULL, NS_GET_IID(nsIAllocator), (void**)&mAllocator); NS_ASSERTION(mAllocator, "failed to get Allocator!"); return (mAllocator ? PR_TRUE : PR_FALSE); } diff --git a/mozilla/xpcom/base/nsISupportsUtils.h b/mozilla/xpcom/base/nsISupportsUtils.h index 1354d01d92b..e26b92c050c 100644 --- a/mozilla/xpcom/base/nsISupportsUtils.h +++ b/mozilla/xpcom/base/nsISupportsUtils.h @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #ifndef __nsISupportsUtils_h @@ -418,7 +419,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_ADDREF_THIS(); \ return NS_OK; \ } \ - if (aIID.Equals(nsCOMTypeInfo::GetIID())) { \ + if (aIID.Equals(NS_GET_IID(nsISupports))) { \ *aInstancePtr = (void*) ((nsISupports*)this); \ NS_ADDREF_THIS(); \ return NS_OK; \ @@ -542,7 +543,7 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ NS_IMETHODIMP Class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ { \ if (!aInstancePtr) return NS_ERROR_NULL_POINTER; \ - if (aIID.Equals(AdditionalInterface::GetIID())) { \ + if (aIID.Equals(NS_GET_IID(AdditionalInterface))) { \ *aInstancePtr = NS_STATIC_CAST(AdditionalInterface*, this); \ NS_ADDREF_THIS(); \ return NS_OK; \ @@ -649,7 +650,6 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ \ *aInstancePtr = NULL; \ \ - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); \ static NS_DEFINE_IID(kIsThreadsafeIID, NS_ISTHREADSAFE_IID); \ static NS_DEFINE_IID(kClassIID, _classiiddef); \ if (aIID.Equals(kClassIID)) { \ @@ -657,7 +657,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_ADDREF_THIS(); \ return NS_OK; \ } \ - if (aIID.Equals(kISupportsIID)) { \ + if (aIID.Equals(NS_GET_IID(nsISupports))) { \ *aInstancePtr = (void*) ((nsISupports*)this); \ NS_ADDREF_THIS(); \ return NS_OK; \ @@ -869,7 +869,7 @@ CallQueryInterface( nsISupports* aSource, DestinationType** aDestination ) NS_PRECONDITION(aSource, "null parameter"); NS_PRECONDITION(aDestination, "null parameter"); - return aSource->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)aDestination); + return aSource->QueryInterface(NS_GET_IID(DestinationType), (void**)aDestination); } } // extern "C++" diff --git a/mozilla/xpcom/base/nsIWeakReference.idl b/mozilla/xpcom/base/nsIWeakReference.idl index d0e252da98f..952d7c3569c 100644 --- a/mozilla/xpcom/base/nsIWeakReference.idl +++ b/mozilla/xpcom/base/nsIWeakReference.idl @@ -18,6 +18,7 @@ * * Contributor(s): * Scott Collins + * Pierre Phaneuf */ #include "nsISupports.idl" @@ -105,7 +106,7 @@ CallQueryReferent( nsIWeakReference* aSource, T** aDestination ) NS_PRECONDITION(aSource, "null parameter"); NS_PRECONDITION(aDestination, "null parameter"); - return aSource->QueryReferent(nsCOMTypeInfo::GetIID(), (void**)aDestination); + return aSource->QueryReferent(NS_GET_IID(T), (void**)aDestination); } diff --git a/mozilla/xpcom/base/nsWeakReference.cpp b/mozilla/xpcom/base/nsWeakReference.cpp index 5043e9dc443..d9c826eb3b2 100644 --- a/mozilla/xpcom/base/nsWeakReference.cpp +++ b/mozilla/xpcom/base/nsWeakReference.cpp @@ -18,6 +18,7 @@ * * Contributor(s): * Scott Collins + * Pierre Phaneuf */ // nsWeakReference.cpp @@ -110,9 +111,9 @@ nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr ) return NS_ERROR_NULL_POINTER; nsISupports* foundInterface; - if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) + if ( aIID.Equals(NS_GET_IID(nsIWeakReference)) ) foundInterface = NS_STATIC_CAST(nsIWeakReference*, this); - else if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) + else if ( aIID.Equals(NS_GET_IID(nsISupports)) ) foundInterface = NS_STATIC_CAST(nsISupports*, this); else foundInterface = 0; diff --git a/mozilla/xpcom/build/nsConstructorPattern.cpp b/mozilla/xpcom/build/nsConstructorPattern.cpp index bea20341880..debce173f07 100644 --- a/mozilla/xpcom/build/nsConstructorPattern.cpp +++ b/mozilla/xpcom/build/nsConstructorPattern.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsISupports.h" @@ -152,7 +153,7 @@ nsFoo::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult) } // Implement the nsISupports methods: -NS_IMPL_ISUPPORTS(nsFoo, nsIFoo::GetIID()); +NS_IMPL_ISUPPORTS(nsFoo, NS_GET_IID(nsIFoo)); // Implement the method(s) of the interface: NS_IMETHODIMP @@ -168,7 +169,7 @@ PR_IMPLEMENT(nsresult) NS_NewFoo(nsIFoo* *result, const char* name) { // Use the constructor method to create this. Don't duplicate work. - nsresult rv = nsFoo::Create(NULL, nsIFoo::GetIID(), + nsresult rv = nsFoo::Create(NULL, NS_GET_IID(nsIFoo), (void**)result); if (NS_SUCCEEDED(rv)) { // Only initialize if the constructor succeeded: diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index 88dafd7f4d3..8c6f50f0fa5 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include @@ -337,8 +338,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); } diff --git a/mozilla/xpcom/components/nsGenericFactory.cpp b/mozilla/xpcom/components/nsGenericFactory.cpp index 20f162e2d18..67bf3a74690 100644 --- a/mozilla/xpcom/components/nsGenericFactory.cpp +++ b/mozilla/xpcom/components/nsGenericFactory.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsGenericFactory.h" @@ -82,7 +83,7 @@ NS_NewGenericFactory(nsIGenericFactory* *result, { nsresult rv; nsIGenericFactory* fact; - rv = nsGenericFactory::Create(NULL, nsIGenericFactory::GetIID(), (void**)&fact); + rv = nsGenericFactory::Create(NULL, NS_GET_IID(nsIGenericFactory), (void**)&fact); if (NS_FAILED(rv)) return rv; rv = fact->SetConstructor(constructor); if (NS_FAILED(rv)) goto error; diff --git a/mozilla/xpcom/components/nsIServiceManager.h b/mozilla/xpcom/components/nsIServiceManager.h index 9ea5083fdb9..19e3c55884e 100644 --- a/mozilla/xpcom/components/nsIServiceManager.h +++ b/mozilla/xpcom/components/nsIServiceManager.h @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #ifndef nsIServiceManager_h___ @@ -301,7 +302,7 @@ do_GetService( const char* aProgID, nsISupports* aServiceManager, nsresult* erro // Now you can replace this: // { // nsIMyService* service; -// rv = nsServiceManager::GetService(kMyServiceCID, nsIMyService::GetIID(), +// rv = nsServiceManager::GetService(kMyServiceCID, NS_GET_IID(nsIMyService), // &service); // if (NS_FAILED(rv)) return rv; // service->Doit(...); // use my service diff --git a/mozilla/xpcom/ds/bufferRoutines.h b/mozilla/xpcom/ds/bufferRoutines.h index c908fc239c1..3307e4204f9 100644 --- a/mozilla/xpcom/ds/bufferRoutines.h +++ b/mozilla/xpcom/ds/bufferRoutines.h @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ /****************************************************************************************** @@ -514,11 +515,9 @@ public : }; static NS_DEFINE_CID(kUnicharUtilCID, NS_UNICHARUTIL_CID); -static NS_DEFINE_IID(kICaseConversionIID, NS_ICASECONVERSION_IID); -static NS_DEFINE_IID(kIShutdownListenerIID, NS_ISHUTDOWNLISTENER_IID); static nsICaseConversion * gCaseConv = 0; -NS_IMPL_ISUPPORTS(HandleCaseConversionShutdown3, kIShutdownListenerIID); +NS_IMPL_ISUPPORTS(HandleCaseConversionShutdown3, NS_GET_IID(nsIShutdownListener)); nsresult HandleCaseConversionShutdown3::OnShutdown(const nsCID& cid, nsISupports* service) { if (cid.Equals(kUnicharUtilCID)) { @@ -538,7 +537,7 @@ public: mListener = new HandleCaseConversionShutdown3(); if(mListener){ mListener->AddRef(); - nsServiceManager::GetService(kUnicharUtilCID, kICaseConversionIID,(nsISupports**) &gCaseConv, mListener); + nsServiceManager::GetService(kUnicharUtilCID, NS_GET_IID(nsICaseConversion),(nsISupports**) &gCaseConv, mListener); } } protected: diff --git a/mozilla/xpcom/ds/nsArena.cpp b/mozilla/xpcom/ds/nsArena.cpp index 0f813de7af2..d47304799ef 100644 --- a/mozilla/xpcom/ds/nsArena.cpp +++ b/mozilla/xpcom/ds/nsArena.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsArena.h" @@ -87,7 +88,7 @@ NS_COM nsresult NS_NewHeapArena(nsIArena** aInstancePtrResult, { nsresult rv; nsIArena* arena; - rv = ArenaImpl::Create(NULL, nsIArena::GetIID(), (void**)&arena); + rv = ArenaImpl::Create(NULL, NS_GET_IID(nsIArena), (void**)&arena); if (NS_FAILED(rv)) return rv; rv = arena->Init(aArenaBlockSize); diff --git a/mozilla/xpcom/ds/nsByteBuffer.cpp b/mozilla/xpcom/ds/nsByteBuffer.cpp index e53cdba355f..efe72f961f0 100644 --- a/mozilla/xpcom/ds/nsByteBuffer.cpp +++ b/mozilla/xpcom/ds/nsByteBuffer.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsByteBuffer.h" @@ -142,7 +143,7 @@ NS_COM nsresult NS_NewByteBuffer(nsIByteBuffer** aInstancePtrResult, { nsresult rv; nsIByteBuffer* buf; - rv = ByteBufferImpl::Create(aOuter, nsIByteBuffer::GetIID(), (void**)&buf); + rv = ByteBufferImpl::Create(aOuter, NS_GET_IID(nsIByteBuffer), (void**)&buf); if (NS_FAILED(rv)) return rv; rv = buf->Init(aBufferSize); diff --git a/mozilla/xpcom/ds/nsConjoiningEnumerator.cpp b/mozilla/xpcom/ds/nsConjoiningEnumerator.cpp index aa68d6b0132..3448f0a893d 100644 --- a/mozilla/xpcom/ds/nsConjoiningEnumerator.cpp +++ b/mozilla/xpcom/ds/nsConjoiningEnumerator.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsIEnumerator.h" @@ -101,7 +102,7 @@ nsConjoiningEnumerator::Last(void) { nsresult rv; nsIBidirectionalEnumerator* be; - rv = mSecond->QueryInterface(nsIBidirectionalEnumerator::GetIID(), (void**)&be); + rv = mSecond->QueryInterface(NS_GET_IID(nsIBidirectionalEnumerator), (void**)&be); if (NS_FAILED(rv)) return rv; mCurrent = mSecond; rv = be->Last(); @@ -114,12 +115,12 @@ nsConjoiningEnumerator::Prev(void) { nsresult rv; nsIBidirectionalEnumerator* be; - rv = mCurrent->QueryInterface(nsIBidirectionalEnumerator::GetIID(), (void**)&be); + rv = mCurrent->QueryInterface(NS_GET_IID(nsIBidirectionalEnumerator), (void**)&be); if (NS_FAILED(rv)) return rv; rv = be->Prev(); NS_RELEASE(be); if (NS_FAILED(rv) && mCurrent == mSecond) { - rv = mFirst->QueryInterface(nsIBidirectionalEnumerator::GetIID(), (void**)&be); + rv = mFirst->QueryInterface(NS_GET_IID(nsIBidirectionalEnumerator), (void**)&be); if (NS_FAILED(rv)) return rv; mCurrent = mFirst; rv = be->Last(); diff --git a/mozilla/xpcom/ds/nsEmptyEnumerator.cpp b/mozilla/xpcom/ds/nsEmptyEnumerator.cpp index 89fe8c01e86..06ae81c876b 100644 --- a/mozilla/xpcom/ds/nsEmptyEnumerator.cpp +++ b/mozilla/xpcom/ds/nsEmptyEnumerator.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ /* @@ -49,7 +50,7 @@ public: if (! result) return NS_ERROR_NULL_POINTER; - if (iid.Equals(nsISimpleEnumerator::GetIID()) || + if (iid.Equals(NS_GET_IID(nsISimpleEnumerator)) || iid.Equals(NS_GET_IID(nsISupports))) { *result = (nsISimpleEnumerator*) this; NS_ADDREF(this); diff --git a/mozilla/xpcom/ds/nsHashtableEnumerator.cpp b/mozilla/xpcom/ds/nsHashtableEnumerator.cpp index 00030a52ab2..b2686cadf3d 100644 --- a/mozilla/xpcom/ds/nsHashtableEnumerator.cpp +++ b/mozilla/xpcom/ds/nsHashtableEnumerator.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ /* @@ -77,7 +78,7 @@ NS_NewHashtableEnumerator (nsHashtable *aHash, if (!hte) return NS_ERROR_OUT_OF_MEMORY; - return hte->QueryInterface (nsCOMTypeInfo::GetIID(), + return hte->QueryInterface (NS_GET_IID(nsIEnumerator), (void **)retval); } diff --git a/mozilla/xpcom/ds/nsObserver.cpp b/mozilla/xpcom/ds/nsObserver.cpp index b8d7356f07c..89b3cd2ed33 100644 --- a/mozilla/xpcom/ds/nsObserver.cpp +++ b/mozilla/xpcom/ds/nsObserver.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #define NS_IMPL_IDS @@ -74,9 +75,9 @@ nsObserver::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr) { NS_ENSURE_ARG_POINTER(aInstancePtr); - if (aIID.Equals(nsCOMTypeInfo::GetIID())) + if (aIID.Equals(NS_GET_IID(nsISupports))) *aInstancePtr = GetInner(); - else if(aIID.Equals(nsIObserver::GetIID())) + else if(aIID.Equals(NS_GET_IID(nsIObserver))) *aInstancePtr = NS_STATIC_CAST(nsIObserver*, this); else { *aInstancePtr = nsnull; diff --git a/mozilla/xpcom/ds/nsObserverService.cpp b/mozilla/xpcom/ds/nsObserverService.cpp index 20414dd525e..40db1859c41 100644 --- a/mozilla/xpcom/ds/nsObserverService.cpp +++ b/mozilla/xpcom/ds/nsObserverService.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #define NS_IMPL_IDS @@ -232,7 +233,7 @@ nsresult nsObserverService::Notify( nsISupports *aSubject, if ( NS_SUCCEEDED( rv ) ) { // Convert item to nsIObserver. nsIObserver *observer; - rv = base->QueryInterface( nsIObserver::GetIID(), (void**)&observer ); + rv = base->QueryInterface( NS_GET_IID(nsIObserver), (void**)&observer ); if ( NS_SUCCEEDED( rv ) && observer ) { // Tell the observer what's up. observer->Observe( aSubject, aTopic, someData ); diff --git a/mozilla/xpcom/ds/nsProperties.cpp b/mozilla/xpcom/ds/nsProperties.cpp index f6f13deca80..bd6e2077ad2 100644 --- a/mozilla/xpcom/ds/nsProperties.cpp +++ b/mozilla/xpcom/ds/nsProperties.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #define NS_IMPL_IDS @@ -69,9 +70,9 @@ nsProperties::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr) { NS_ENSURE_ARG_POINTER(aInstancePtr); - if (aIID.Equals(nsCOMTypeInfo::GetIID())) + if (aIID.Equals(NS_GET_IID(nsISupports))) *aInstancePtr = GetInner(); - else if (aIID.Equals(nsIProperties::GetIID())) + else if (aIID.Equals(NS_GET_IID(nsIProperties))) *aInstancePtr = NS_STATIC_CAST(nsIProperties*, this); else { *aInstancePtr = nsnull; @@ -149,7 +150,7 @@ nsProperties::HasProperty(const char* prop, nsISupports* expectedValue) nsresult NS_NewIProperties(nsIProperties* *result) { - return nsProperties::Create(NULL, nsIProperties::GetIID(), (void**)result); + return nsProperties::Create(NULL, NS_GET_IID(nsIProperties), (void**)result); } //////////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/xpcom/ds/nsSupportsArray.cpp b/mozilla/xpcom/ds/nsSupportsArray.cpp index dc8443c234c..36aab0672a1 100644 --- a/mozilla/xpcom/ds/nsSupportsArray.cpp +++ b/mozilla/xpcom/ds/nsSupportsArray.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsSupportsArray.h" @@ -385,7 +386,7 @@ NS_COM nsresult NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult) { nsresult rv; - rv = nsSupportsArray::Create(NULL, nsISupportsArray::GetIID(), + rv = nsSupportsArray::Create(NULL, NS_GET_IID(nsISupportsArray), (void**)aInstancePtrResult); return rv; } diff --git a/mozilla/xpcom/ds/nsUnicharBuffer.cpp b/mozilla/xpcom/ds/nsUnicharBuffer.cpp index 6b5a1d49c92..fb39501611b 100644 --- a/mozilla/xpcom/ds/nsUnicharBuffer.cpp +++ b/mozilla/xpcom/ds/nsUnicharBuffer.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsUnicharBuffer.h" @@ -148,7 +149,7 @@ NS_NewUnicharBuffer(nsIUnicharBuffer** aInstancePtrResult, { nsresult rv; nsIUnicharBuffer* buf; - rv = UnicharBufferImpl::Create(aOuter, nsIUnicharBuffer::GetIID(), + rv = UnicharBufferImpl::Create(aOuter, NS_GET_IID(nsIUnicharBuffer), (void**)&buf); if (NS_FAILED(rv)) return rv; rv = buf->Init(aBufferSize); diff --git a/mozilla/xpcom/glue/nsGenericFactory.cpp b/mozilla/xpcom/glue/nsGenericFactory.cpp index 20f162e2d18..67bf3a74690 100644 --- a/mozilla/xpcom/glue/nsGenericFactory.cpp +++ b/mozilla/xpcom/glue/nsGenericFactory.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsGenericFactory.h" @@ -82,7 +83,7 @@ NS_NewGenericFactory(nsIGenericFactory* *result, { nsresult rv; nsIGenericFactory* fact; - rv = nsGenericFactory::Create(NULL, nsIGenericFactory::GetIID(), (void**)&fact); + rv = nsGenericFactory::Create(NULL, NS_GET_IID(nsIGenericFactory), (void**)&fact); if (NS_FAILED(rv)) return rv; rv = fact->SetConstructor(constructor); if (NS_FAILED(rv)) goto error; diff --git a/mozilla/xpcom/glue/nsISupportsUtils.h b/mozilla/xpcom/glue/nsISupportsUtils.h index 1354d01d92b..e26b92c050c 100644 --- a/mozilla/xpcom/glue/nsISupportsUtils.h +++ b/mozilla/xpcom/glue/nsISupportsUtils.h @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #ifndef __nsISupportsUtils_h @@ -418,7 +419,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_ADDREF_THIS(); \ return NS_OK; \ } \ - if (aIID.Equals(nsCOMTypeInfo::GetIID())) { \ + if (aIID.Equals(NS_GET_IID(nsISupports))) { \ *aInstancePtr = (void*) ((nsISupports*)this); \ NS_ADDREF_THIS(); \ return NS_OK; \ @@ -542,7 +543,7 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ NS_IMETHODIMP Class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ { \ if (!aInstancePtr) return NS_ERROR_NULL_POINTER; \ - if (aIID.Equals(AdditionalInterface::GetIID())) { \ + if (aIID.Equals(NS_GET_IID(AdditionalInterface))) { \ *aInstancePtr = NS_STATIC_CAST(AdditionalInterface*, this); \ NS_ADDREF_THIS(); \ return NS_OK; \ @@ -649,7 +650,6 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ \ *aInstancePtr = NULL; \ \ - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); \ static NS_DEFINE_IID(kIsThreadsafeIID, NS_ISTHREADSAFE_IID); \ static NS_DEFINE_IID(kClassIID, _classiiddef); \ if (aIID.Equals(kClassIID)) { \ @@ -657,7 +657,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_ADDREF_THIS(); \ return NS_OK; \ } \ - if (aIID.Equals(kISupportsIID)) { \ + if (aIID.Equals(NS_GET_IID(nsISupports))) { \ *aInstancePtr = (void*) ((nsISupports*)this); \ NS_ADDREF_THIS(); \ return NS_OK; \ @@ -869,7 +869,7 @@ CallQueryInterface( nsISupports* aSource, DestinationType** aDestination ) NS_PRECONDITION(aSource, "null parameter"); NS_PRECONDITION(aDestination, "null parameter"); - return aSource->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)aDestination); + return aSource->QueryInterface(NS_GET_IID(DestinationType), (void**)aDestination); } } // extern "C++" diff --git a/mozilla/xpcom/glue/nsWeakReference.cpp b/mozilla/xpcom/glue/nsWeakReference.cpp index 5043e9dc443..d9c826eb3b2 100644 --- a/mozilla/xpcom/glue/nsWeakReference.cpp +++ b/mozilla/xpcom/glue/nsWeakReference.cpp @@ -18,6 +18,7 @@ * * Contributor(s): * Scott Collins + * Pierre Phaneuf */ // nsWeakReference.cpp @@ -110,9 +111,9 @@ nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr ) return NS_ERROR_NULL_POINTER; nsISupports* foundInterface; - if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) + if ( aIID.Equals(NS_GET_IID(nsIWeakReference)) ) foundInterface = NS_STATIC_CAST(nsIWeakReference*, this); - else if ( aIID.Equals(nsCOMTypeInfo::GetIID()) ) + else if ( aIID.Equals(NS_GET_IID(nsISupports)) ) foundInterface = NS_STATIC_CAST(nsISupports*, this); else foundInterface = 0; diff --git a/mozilla/xpcom/io/nsFileSpecImpl.cpp b/mozilla/xpcom/io/nsFileSpecImpl.cpp index c6102714411..16be0fab5b2 100644 --- a/mozilla/xpcom/io/nsFileSpecImpl.cpp +++ b/mozilla/xpcom/io/nsFileSpecImpl.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsFileSpecImpl.h"// Always first, to ensure that it compiles alone. @@ -71,7 +72,7 @@ nsresult nsFileSpecImpl::MakeInterface(const nsFileSpec& inSpec, nsIFileSpec** r nsFileSpecImpl* it = new nsFileSpecImpl(inSpec); if (!it) return NS_ERROR_OUT_OF_MEMORY; - return it->QueryInterface(nsIFileSpec::GetIID(), (void **) result); + return it->QueryInterface(NS_GET_IID(nsIFileSpec), (void **) result); } // nsFileSpecImpl::MakeInterface #define FILESPEC(ifilespec) ((nsFileSpecImpl*)ifilespec)->mFileSpec @@ -796,12 +797,12 @@ nsresult NS_NewFileSpecWithSpec(const nsFileSpec& aSrcFileSpec, nsIFileSpec **re nsresult NS_NewFileSpec(nsIFileSpec** result) //---------------------------------------------------------------------------------------- { - return nsFileSpecImpl::Create(nsnull, nsIFileSpec::GetIID(), (void**)result); + return nsFileSpecImpl::Create(nsnull, NS_GET_IID(nsIFileSpec), (void**)result); } //---------------------------------------------------------------------------------------- nsresult NS_NewDirectoryIterator(nsIDirectoryIterator** result) //---------------------------------------------------------------------------------------- { - return nsDirectoryIteratorImpl::Create(nsnull, nsIDirectoryIterator::GetIID(), (void**)result); + return nsDirectoryIteratorImpl::Create(nsnull, NS_GET_IID(nsIDirectoryIterator), (void**)result); } diff --git a/mozilla/xpcom/io/nsFileUtils.cpp b/mozilla/xpcom/io/nsFileUtils.cpp index a945695f454..ebe44de9cd8 100644 --- a/mozilla/xpcom/io/nsFileUtils.cpp +++ b/mozilla/xpcom/io/nsFileUtils.cpp @@ -11,7 +11,7 @@ NS_NewFile(nsIFile** file) { return nsComponentManager::CreateInstance(NS_FILE_PROGID, nsnull, - nsCOMTypeInfo::GetIID(), + NS_GET_IID(nsIFile), (void**)file); } @@ -20,7 +20,7 @@ NS_NewDirectoryEnumerator(nsIFile* parent, PRBool resolveSymlinks, nsIDirectoryE { nsresult rv = nsComponentManager::CreateInstance(NS_DIRECTORY_ENUMERATOR_PROGID, nsnull, - nsCOMTypeInfo::GetIID(), + NS_GET_IID(nsIDirectoryEnumerator), (void**)enumerator); if (NS_SUCCEEDED(rv) && *enumerator) diff --git a/mozilla/xpcom/io/nsIFileStream.cpp b/mozilla/xpcom/io/nsIFileStream.cpp index e3633fa3d54..b389d2865c6 100644 --- a/mozilla/xpcom/io/nsIFileStream.cpp +++ b/mozilla/xpcom/io/nsIFileStream.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsIFileStream.h" @@ -539,7 +540,7 @@ NS_COM nsresult NS_NewTypicalInputFileStream( *aResult = nsnull; if (NS_SUCCEEDED(rv)) { - if (NS_SUCCEEDED(supports->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)&inStr))) { + if (NS_SUCCEEDED(supports->QueryInterface(NS_GET_IID(nsIInputStream), (void**)&inStr))) { *aResult = inStr; } NS_RELEASE(supports); @@ -594,7 +595,7 @@ NS_COM nsresult NS_NewTypicalOutputFileStream( *aResult = nsnull; if (NS_SUCCEEDED(rv)) { - if (NS_SUCCEEDED(supports->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)&outStr))) { + if (NS_SUCCEEDED(supports->QueryInterface(NS_GET_IID(nsIOutputStream), (void**)&outStr))) { *aResult = outStr; } NS_RELEASE(supports); @@ -613,7 +614,7 @@ NS_COM nsresult NS_NewTypicalOutputFileStream( *aResult = nsnull; if (NS_SUCCEEDED(rv)) { - if (NS_SUCCEEDED(supports->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)&outStr))) { + if (NS_SUCCEEDED(supports->QueryInterface(NS_GET_IID(nsIOutputStream), (void**)&outStr))) { *aResult = outStr; } } diff --git a/mozilla/xpcom/io/nsPipe2.cpp b/mozilla/xpcom/io/nsPipe2.cpp index 7d9463a2187..57e301c81aa 100644 --- a/mozilla/xpcom/io/nsPipe2.cpp +++ b/mozilla/xpcom/io/nsPipe2.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Pierre Phaneuf */ #include "nsIPipe.h" @@ -196,24 +197,24 @@ nsPipe::QueryInterface(const nsIID& aIID, void** aInstancePtr) { if (aInstancePtr == nsnull) return NS_ERROR_NULL_POINTER; - if (aIID.Equals(nsIBufferInputStream::GetIID()) || - aIID.Equals(nsIInputStream::GetIID()) || - aIID.Equals(nsIBaseStream::GetIID())) { + if (aIID.Equals(NS_GET_IID(nsIBufferInputStream)) || + aIID.Equals(NS_GET_IID(nsIInputStream)) || + aIID.Equals(NS_GET_IID(nsIBaseStream))) { nsIBufferInputStream* in = GetInputStream(); NS_ADDREF(in); *aInstancePtr = in; return NS_OK; } - if (aIID.Equals(nsIBufferOutputStream::GetIID()) || - aIID.Equals(nsIOutputStream::GetIID()) || - aIID.Equals(nsIBaseStream::GetIID())) { + if (aIID.Equals(NS_GET_IID(nsIBufferOutputStream)) || + aIID.Equals(NS_GET_IID(nsIOutputStream)) || + aIID.Equals(NS_GET_IID(nsIBaseStream))) { nsIBufferOutputStream* out = GetOutputStream(); NS_ADDREF(out); *aInstancePtr = out; return NS_OK; } - if (aIID.Equals(nsIPipe::GetIID()) || - aIID.Equals(nsCOMTypeInfo::GetIID())) { + if (aIID.Equals(NS_GET_IID(nsIPipe)) || + aIID.Equals(NS_GET_IID(nsISupports))) { *aInstancePtr = this; NS_ADDREF_THIS(); return NS_OK; diff --git a/mozilla/xpcom/io/nsStorageStream.cpp b/mozilla/xpcom/io/nsStorageStream.cpp index 9c70bb42add..73b7b121591 100644 --- a/mozilla/xpcom/io/nsStorageStream.cpp +++ b/mozilla/xpcom/io/nsStorageStream.cpp @@ -17,6 +17,8 @@ * Copyright (C) 1998-1999 Netscape Communications Corporation. All * Rights Reserved. * + * Contributor(s): + * Pierre Phaneuf */ /* @@ -282,8 +284,7 @@ private: PRUint32 SegOffset(PRUint32 aPosition) {return aPosition & (mSegmentSize - 1);} }; -static NS_DEFINE_IID(kIInputStream, NS_IINPUTSTREAM_IID); -NS_IMPL_ISUPPORTS(nsStorageInputStream, kIInputStream) +NS_IMPL_ISUPPORTS1(nsStorageInputStream, nsIInputStream) NS_IMETHODIMP nsStorageStream::NewInputStream(PRInt32 aStartingOffset, nsIInputStream* *aInputStream)