зеркало из https://github.com/mozilla/pjs.git
got rid of |NS_IMPL_ISUPPORTS|, where possible, in favor of |NS_IMPL_ISUPPORTS0| or ...1 according to the specific use; got rid of |NS_DEFINE_IID| where possible, or where it should have been |NS_DEFINE_CID|; fixed bad implementations of |QueryInterface|, where possible. Built, tested apprunner, reviewed the changes with hyatt (since he was around to look) before checking in
This commit is contained in:
Родитель
06e8699a24
Коммит
0454213f91
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<nsIWeakReference>::GetIID()) )
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIWeakReference*, this);
|
||||
foundInterface = NS_STATIC_CAST(nsIWeakReference*, this);
|
||||
else if ( aIID.Equals(nsCOMTypeInfo<nsISupports>::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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
nsCOMPtr<nsIFileSpec>libSpec;
|
||||
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
|
||||
nsCOMPtr<nsIFileSpec>libSpec;
|
||||
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);
|
||||
nsCOMPtr<nsIDirectoryIterator>dirIterator;
|
||||
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;
|
||||
|
|
|
@ -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<nsISupports>::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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -38,7 +38,7 @@ ArenaImpl::Init(PRUint32 aBlockSize)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(ArenaImpl, nsIArena::GetIID())
|
||||
NS_IMPL_ISUPPORTS1(ArenaImpl, nsIArena)
|
||||
|
||||
ArenaImpl::~ArenaImpl()
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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<nsISupports>::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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<nsIBidirectionalEnumerator>::GetIID()) )
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIBidirectionalEnumerator*, this);
|
||||
else if ( aIID.Equals(nsCOMTypeInfo<nsIEnumerator>::GetIID()) )
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIEnumerator*, this);
|
||||
else if ( aIID.Equals(nsCOMTypeInfo<nsISupports>::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()
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
|
@ -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<nsISupports>::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<nsISupports>::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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
NS_IMPL_ISUPPORTS2(nsSupportsArrayEnumerator, nsIBidirectionalEnumerator, nsIEnumerator)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSupportsArrayEnumerator::First()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -1,233 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsIVariant.h"
|
||||
#include "nsCRT.h"
|
||||
#ifdef NS_DEBUG
|
||||
#include "prprf.h"
|
||||
#endif
|
||||
|
||||
class nsVariant : public nsIVariant {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIVariant methods:
|
||||
NS_IMETHOD GetValue(nsVariantType *type, nsVariantValue *value);
|
||||
NS_IMETHOD GetValue(nsVariantType expectedType, nsVariantValue *value);
|
||||
NS_IMETHOD SetValue(nsVariantType type, nsVariantValue& value);
|
||||
NS_IMETHOD Equals(nsISupports* other);
|
||||
#ifdef NS_DEBUG
|
||||
NS_IMETHOD GetDescription(char* *result);
|
||||
#endif
|
||||
|
||||
// nsVariant methods:
|
||||
nsVariant(nsVariantType type, nsVariantValue& value);
|
||||
virtual ~nsVariant();
|
||||
|
||||
protected:
|
||||
nsVariantType mType;
|
||||
nsVariantValue mValue;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsVariant, nsIVariant::GetIID());
|
||||
|
||||
nsVariant::nsVariant(nsVariantType type, nsVariantValue& value)
|
||||
: mType(type), mValue(value)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsVariant::~nsVariant()
|
||||
{
|
||||
switch (mType) {
|
||||
case nsVariantType_voidPtr:
|
||||
/* XXX: Per comments from Warren, commenting this out.
|
||||
This code isn't done (or used), and is a violation
|
||||
of ANSI C++ to boot. -- Bruce */
|
||||
/* delete (void *)mValue; */
|
||||
break;
|
||||
case nsVariantType_charPtr:
|
||||
nsCRT::free(mValue.mUnion._charPtr);
|
||||
break;
|
||||
case nsVariantType_PRUnicharPtr:
|
||||
nsCRT::free(mValue.mUnion._PRUnicharPtr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsVariant::GetValue(nsVariantType *type, nsVariantValue *value)
|
||||
{
|
||||
NS_PRECONDITION(type && value, "no place to put the result");
|
||||
*type = mType;
|
||||
*value = mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsVariant::GetValue(nsVariantType expectedType, nsVariantValue *value)
|
||||
{
|
||||
NS_PRECONDITION(value, "no place to put the result");
|
||||
if (mType != expectedType)
|
||||
return NS_ERROR_FAILURE;
|
||||
*value = mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsVariant::SetValue(nsVariantType type, nsVariantValue& value)
|
||||
{
|
||||
mType = type;
|
||||
mValue = value;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsVariant::Equals(nsISupports* other)
|
||||
{
|
||||
nsIVariant* otherVariant;
|
||||
nsresult rv = other->QueryInterface(nsIVariant::GetIID(), (void**)&otherVariant);
|
||||
if (NS_FAILED(rv)) return NS_COMFALSE;
|
||||
|
||||
nsVariantType otherType;
|
||||
nsVariantValue otherValue;
|
||||
rv = otherVariant->GetValue(&otherType, &otherValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mType != otherType)
|
||||
return NS_COMFALSE;
|
||||
|
||||
PRBool eq = PR_FALSE;
|
||||
// this is gross, but I think it's the only way to compare unions:
|
||||
switch (mType) {
|
||||
case nsVariantType_PRBool:
|
||||
eq = (PRBool)mValue == (PRBool)otherValue;
|
||||
break;
|
||||
case nsVariantType_PRInt16:
|
||||
eq = (PRInt16)mValue == (PRInt16)otherValue;
|
||||
break;
|
||||
case nsVariantType_PRUint16:
|
||||
eq = (PRUint16)mValue == (PRUint16)otherValue;
|
||||
break;
|
||||
case nsVariantType_PRInt32:
|
||||
eq = (PRInt32)mValue == (PRInt32)otherValue;
|
||||
break;
|
||||
case nsVariantType_PRUint32:
|
||||
eq = (PRUint32)mValue == (PRUint32)otherValue;
|
||||
break;
|
||||
case nsVariantType_PRInt64:
|
||||
eq = LL_EQ((PRInt64)mValue, (PRInt64)otherValue);
|
||||
break;
|
||||
case nsVariantType_PRUint64:
|
||||
eq = LL_EQ((PRUint64)mValue, (PRUint64)otherValue);
|
||||
break;
|
||||
case nsVariantType_float:
|
||||
eq = (float)mValue == (float)otherValue;
|
||||
break;
|
||||
case nsVariantType_PRFloat64:
|
||||
eq = (PRFloat64)mValue == (PRFloat64)otherValue;
|
||||
break;
|
||||
case nsVariantType_PRTime:
|
||||
eq = LL_EQ((PRTime)mValue, (PRTime)otherValue);
|
||||
break;
|
||||
case nsVariantType_voidPtr:
|
||||
eq = (void*)mValue == (void*)otherValue;
|
||||
break;
|
||||
case nsVariantType_charPtr:
|
||||
// I hope this shouldn't be comparing pointers:
|
||||
eq = nsCRT::strcmp((const char*)mValue, (const char*)otherValue) == 0;
|
||||
break;
|
||||
case nsVariantType_PRUnicharPtr:
|
||||
// I hope this shouldn't be comparing pointers:
|
||||
eq = nsCRT::strcmp((const PRUnichar*)mValue, (const PRUnichar*)otherValue) == 0;
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("unknown variant type");
|
||||
}
|
||||
return eq ? NS_OK : NS_COMFALSE;
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
NS_IMETHODIMP
|
||||
nsVariant::GetDescription(char* *result)
|
||||
{
|
||||
char* desc;
|
||||
switch (mType) {
|
||||
case nsVariantType_PRBool:
|
||||
desc = nsCRT::strdup((PRBool)mValue ? "true" : "false");
|
||||
break;
|
||||
case nsVariantType_PRInt16:
|
||||
desc = PR_smprintf("%d", (PRInt16)mValue);
|
||||
break;
|
||||
case nsVariantType_PRUint16:
|
||||
desc = PR_smprintf("%u", (PRUint16)mValue);
|
||||
break;
|
||||
case nsVariantType_PRInt32:
|
||||
desc = PR_smprintf("%l", (PRInt32)mValue);
|
||||
break;
|
||||
case nsVariantType_PRUint32:
|
||||
desc = PR_smprintf("%u", (PRUint32)mValue);
|
||||
break;
|
||||
case nsVariantType_PRInt64:
|
||||
desc = PR_smprintf("%ll", (PRInt64)mValue);
|
||||
break;
|
||||
case nsVariantType_PRUint64:
|
||||
desc = PR_smprintf("%ll", (PRUint64)mValue);
|
||||
break;
|
||||
case nsVariantType_float:
|
||||
desc = PR_smprintf("%g", (float)mValue);
|
||||
break;
|
||||
case nsVariantType_PRFloat64:
|
||||
desc = PR_smprintf("%lg", (PRFloat64)mValue);
|
||||
break;
|
||||
case nsVariantType_PRTime:
|
||||
desc = PR_smprintf("%l", (PRTime)mValue);
|
||||
break;
|
||||
case nsVariantType_voidPtr:
|
||||
desc = PR_smprintf("0x%x", (void*)mValue);
|
||||
break;
|
||||
case nsVariantType_charPtr:
|
||||
desc = PR_smprintf("'%s'", (const char*)mValue);
|
||||
break;
|
||||
case nsVariantType_PRUnicharPtr:
|
||||
desc = PR_smprintf("\"%s\"", (const PRUnichar*)mValue);
|
||||
break;
|
||||
default:
|
||||
desc = PR_smprintf("<Variant 0x%x>", this);
|
||||
}
|
||||
*result = desc;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewIVariant(nsVariantType initialType, nsVariantValue& initialValue,
|
||||
nsIVariant* *result)
|
||||
{
|
||||
nsVariant* v = new nsVariant(initialType, initialValue);
|
||||
if (v == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(v);
|
||||
*result = v;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -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<nsISupports>::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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<nsIWeakReference>::GetIID()) )
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIWeakReference*, this);
|
||||
foundInterface = NS_STATIC_CAST(nsIWeakReference*, this);
|
||||
else if ( aIID.Equals(nsCOMTypeInfo<nsISupports>::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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<nsISupports>::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<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
NS_IMPL_ISUPPORTS2(nsByteBufferOutputStream, nsIOutputStream, nsIBaseStream)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsByteBufferOutputStream::Close(void)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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<nsISupports>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = (void*)((nsISupports*)(nsIOutputStream*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
} // FileImpl::QueryInterface
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP FileImpl::Open(
|
||||
|
|
|
@ -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<nsISupports>::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)
|
||||
|
|
|
@ -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<nsISupports>::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<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
NS_IMPL_ISUPPORTS3(nsBufferOutputStream, nsIBufferOutputStream, nsIOutputStream, nsIBaseStream)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferOutputStream::Close(void)
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <unistd.h>
|
||||
#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);
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -49,7 +49,7 @@ nsEventQueueImpl::InitFromPLQueue(PLEventQueue* aQueue)
|
|||
}
|
||||
|
||||
/* nsISupports interface implementation... */
|
||||
NS_IMPL_ISUPPORTS(nsEventQueueImpl,kIEventQueueIID);
|
||||
NS_IMPL_ISUPPORTS1(nsEventQueueImpl,nsIEventQueue)
|
||||
|
||||
/* nsIEventQueue interface implementation... */
|
||||
|
||||
|
|
|
@ -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<nsISupports>::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;
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Загрузка…
Ссылка в новой задаче