mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
NS_GET_IID(). Thanks to patch from pp@ludasdesign.com r=dp@netscape.com
This commit is contained in:
parent
046ba35285
commit
edcdeb94a5
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -43,9 +44,9 @@ nsAllocatorImpl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::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);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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<nsISupports>::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<DestinationType>::GetIID(), (void**)aDestination);
|
||||
return aSource->QueryInterface(NS_GET_IID(DestinationType), (void**)aDestination);
|
||||
}
|
||||
|
||||
} // extern "C++"
|
||||
|
@ -18,6 +18,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Scott Collins <scc@netscape.com>
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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<T>::GetIID(), (void**)aDestination);
|
||||
return aSource->QueryReferent(NS_GET_IID(T), (void**)aDestination);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Scott Collins <scc@netscape.com>
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
// nsWeakReference.cpp
|
||||
@ -110,9 +111,9 @@ nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr )
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsISupports* foundInterface;
|
||||
if ( aIID.Equals(nsCOMTypeInfo<nsIWeakReference>::GetIID()) )
|
||||
if ( aIID.Equals(NS_GET_IID(nsIWeakReference)) )
|
||||
foundInterface = NS_STATIC_CAST(nsIWeakReference*, this);
|
||||
else if ( aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()) )
|
||||
else if ( aIID.Equals(NS_GET_IID(nsISupports)) )
|
||||
foundInterface = NS_STATIC_CAST(nsISupports*, this);
|
||||
else
|
||||
foundInterface = 0;
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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:
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -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);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
/******************************************************************************************
|
||||
@ -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:
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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();
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -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);
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -77,7 +78,7 @@ NS_NewHashtableEnumerator (nsHashtable *aHash,
|
||||
if (!hte)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return hte->QueryInterface (nsCOMTypeInfo<nsIEnumerator>::GetIID(),
|
||||
return hte->QueryInterface (NS_GET_IID(nsIEnumerator),
|
||||
(void **)retval);
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#define NS_IMPL_IDS
|
||||
@ -74,9 +75,9 @@ nsObserver::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::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;
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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 );
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#define NS_IMPL_IDS
|
||||
@ -69,9 +70,9 @@ nsProperties::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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<nsISupports>::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<DestinationType>::GetIID(), (void**)aDestination);
|
||||
return aSource->QueryInterface(NS_GET_IID(DestinationType), (void**)aDestination);
|
||||
}
|
||||
|
||||
} // extern "C++"
|
||||
|
@ -18,6 +18,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Scott Collins <scc@netscape.com>
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
// nsWeakReference.cpp
|
||||
@ -110,9 +111,9 @@ nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr )
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsISupports* foundInterface;
|
||||
if ( aIID.Equals(nsCOMTypeInfo<nsIWeakReference>::GetIID()) )
|
||||
if ( aIID.Equals(NS_GET_IID(nsIWeakReference)) )
|
||||
foundInterface = NS_STATIC_CAST(nsIWeakReference*, this);
|
||||
else if ( aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()) )
|
||||
else if ( aIID.Equals(NS_GET_IID(nsISupports)) )
|
||||
foundInterface = NS_STATIC_CAST(nsISupports*, this);
|
||||
else
|
||||
foundInterface = 0;
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ NS_NewFile(nsIFile** file)
|
||||
{
|
||||
return nsComponentManager::CreateInstance(NS_FILE_PROGID,
|
||||
nsnull,
|
||||
nsCOMTypeInfo<nsIFile>::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<nsIDirectoryEnumerator>::GetIID(),
|
||||
NS_GET_IID(nsIDirectoryEnumerator),
|
||||
(void**)enumerator);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && *enumerator)
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#include "nsIFileStream.h"
|
||||
@ -539,7 +540,7 @@ NS_COM nsresult NS_NewTypicalInputFileStream(
|
||||
|
||||
*aResult = nsnull;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (NS_SUCCEEDED(supports->QueryInterface(nsCOMTypeInfo<nsIInputStream>::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<nsIOutputStream>::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<nsIOutputStream>::GetIID(), (void**)&outStr))) {
|
||||
if (NS_SUCCEEDED(supports->QueryInterface(NS_GET_IID(nsIOutputStream), (void**)&outStr))) {
|
||||
*aResult = outStr;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#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<nsISupports>::GetIID())) {
|
||||
if (aIID.Equals(NS_GET_IID(nsIPipe)) ||
|
||||
aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -17,6 +17,8 @@
|
||||
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user