зеркало из https://github.com/mozilla/pjs.git
|nsISupports::GetIID()| --> |nsCOMTypeInfo<nsISupports>::GetIID()|
This commit is contained in:
Родитель
fbe308a1f7
Коммит
54c96baa72
|
@ -87,7 +87,7 @@ nsresult nsMorkFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
@ -207,7 +207,7 @@ nsMorkFactoryFactory::QueryInterface(REFNSIID iid, void** result)
|
|||
|
||||
*result = nsnull;
|
||||
if(iid.Equals(nsIMdbFactoryFactory::GetIID()) ||
|
||||
iid.Equals(nsISupports::GetIID())) {
|
||||
iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIMdbFactoryFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
|
|
|
@ -41,7 +41,7 @@ nsAOLCiter::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = (void*)this;
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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://wwwt.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 "nsEditFactory.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsEditor.h"
|
||||
#include "nsEditorCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
static NS_DEFINE_IID(kIEditFactoryIID, NS_IEDITORFACTORY_IID);
|
||||
static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
GetEditFactory(nsIFactory **aFactory, const nsCID & aClass)
|
||||
{
|
||||
|
||||
// XXX Note static which never gets released, even on library unload.
|
||||
// XXX Was an nsCOMPtr but that caused a crash on exit,
|
||||
// XXX http://bugzilla.mozilla.org/show_bug.cgi?id=7938
|
||||
PR_EnterMonitor(GetEditorMonitor());
|
||||
|
||||
nsEditFactory *factory = new nsEditFactory(aClass);
|
||||
if (!factory)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<nsIFactory> pNSIFactory = do_QueryInterface(factory);
|
||||
if (!pNSIFactory)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
nsresult result = pNSIFactory->QueryInterface(nsIFactory::GetIID(),
|
||||
(void **)aFactory);
|
||||
PR_ExitMonitor(GetEditorMonitor());
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsISupports
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (nsnull == aInstancePtr) {
|
||||
NS_NOTREACHED("!nsEditor");
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsIFactory::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsEditFactory)
|
||||
NS_IMPL_RELEASE(nsEditFactory)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIFactory:
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
nsISupports *obj = nsnull;
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aOuter && !aIID.Equals(nsISupports::GetIID()))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
|
||||
|
||||
if (mCID.Equals(kEditorCID))
|
||||
obj = (nsISupports *)(nsIEditor*)new nsEditor();
|
||||
//more class ids to support. here
|
||||
|
||||
|
||||
if (obj && NS_FAILED(obj->QueryInterface(aIID, (void**)aResult)) )
|
||||
{
|
||||
delete obj;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsEditFactory:
|
||||
|
||||
nsEditFactory::nsEditFactory(const nsCID &aClass)
|
||||
:mCID(aClass)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsEditFactory::~nsEditFactory()
|
||||
{
|
||||
//nsComponentManager::UnregisterFactory(mCID, (nsIFactory *)this); //we are out of ref counts anyway
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ nsEditProperty::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -392,7 +392,7 @@ nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
nsIEditor *tmp = this;
|
||||
nsISupports *tmp2 = tmp;
|
||||
*aInstancePtr = (void*)tmp2;
|
||||
|
|
|
@ -79,7 +79,7 @@ nsTextEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -887,7 +887,7 @@ nsTextEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -1059,7 +1059,7 @@ nsTextEditorTextListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -1131,7 +1131,7 @@ nsTextEditorDragListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -1294,7 +1294,7 @@ nsTextEditorCompositionListener::QueryInterface(REFNSIID aIID, void** aInstanceP
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -41,7 +41,7 @@ nsInternetCiter::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = (void*)this;
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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://wwwt.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 "nsTextEditFactory.h"
|
||||
#include "nsITextEditor.h"
|
||||
#include "nsTextEditor.h"
|
||||
#include "nsEditor.h"
|
||||
#include "nsEditorCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
|
||||
|
||||
|
||||
nsresult
|
||||
GetTextEditFactory(nsIFactory **aFactory, const nsCID & aClass)
|
||||
{
|
||||
PR_EnterMonitor(GetEditorMonitor());
|
||||
|
||||
nsTextEditFactory *factory = new nsTextEditFactory(aClass);
|
||||
if (!factory)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<nsIFactory> pNSIFactory = do_QueryInterface(factory);
|
||||
if (!pNSIFactory)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
nsresult result = pNSIFactory->QueryInterface(nsIFactory::GetIID(),
|
||||
(void **)aFactory);
|
||||
PR_ExitMonitor(GetEditorMonitor());
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsISupports
|
||||
|
||||
nsresult
|
||||
nsTextEditFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (nsnull == aInstancePtr) {
|
||||
NS_NOTREACHED("!nsEditor");
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsIFactory::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsTextEditFactory)
|
||||
NS_IMPL_RELEASE(nsTextEditFactory)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIFactory:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextEditFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
nsISupports *obj = nsnull;
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aOuter && !aIID.Equals(nsISupports::GetIID()))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
|
||||
|
||||
if (mCID.Equals(kTextEditorCID))
|
||||
{
|
||||
//Need to cast to interface first to avoid "ambiguous conversion..." error
|
||||
// because of multiple nsISupports in the class hierarchy
|
||||
obj = (nsISupports *)(nsITextEditor*)new nsTextEditor();
|
||||
}
|
||||
//more class ids to support. here
|
||||
|
||||
|
||||
if (obj && NS_FAILED(obj->QueryInterface(aIID, (void**)aResult)) )
|
||||
{
|
||||
delete obj;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextEditFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsTextEditFactory:
|
||||
|
||||
nsTextEditFactory::nsTextEditFactory(const nsCID &aClass)
|
||||
:mCID(aClass)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsTextEditFactory::~nsTextEditFactory()
|
||||
{
|
||||
//nsComponentManager::UnregisterFactory(mCID, (nsIFactory *)this); //we are out of ref counts anyway
|
||||
}
|
|
@ -115,7 +115,7 @@ TypeInState::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -392,7 +392,7 @@ nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
nsIEditor *tmp = this;
|
||||
nsISupports *tmp2 = tmp;
|
||||
*aInstancePtr = (void*)tmp2;
|
||||
|
|
|
@ -293,7 +293,7 @@ nsEditProperty::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -41,7 +41,7 @@ nsAOLCiter::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = (void*)this;
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -79,7 +79,7 @@ nsTextEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -887,7 +887,7 @@ nsTextEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -1059,7 +1059,7 @@ nsTextEditorTextListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -1131,7 +1131,7 @@ nsTextEditorDragListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -1294,7 +1294,7 @@ nsTextEditorCompositionListener::QueryInterface(REFNSIID aIID, void** aInstanceP
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -41,7 +41,7 @@ nsInternetCiter::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = (void*)this;
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -52,7 +52,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
|||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (aIID.Equals(nsISupports::GetIID())) { \
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) { \
|
||||
*aInstancePtr = (void*) ((nsISupports*)this); \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
|
|
|
@ -463,7 +463,7 @@ nsresult _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
|||
if (NULL == aInstancePtr) { \
|
||||
return NS_ERROR_NULL_POINTER; \
|
||||
} \
|
||||
if (aIID.Equals(nsISupports::GetIID()) || \
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()) || \
|
||||
aIID.Equals(_class::GetIID())) { \
|
||||
*aInstancePtr = (void*) this; \
|
||||
NS_ADDREF_THIS(); \
|
||||
|
|
|
@ -144,7 +144,7 @@ nsXPConnect::IsISupportsDescendent(nsIInterfaceInfo* info)
|
|||
nsID* iid;
|
||||
if(NS_SUCCEEDED(oldest->GetIID(&iid)))
|
||||
{
|
||||
retval = iid->Equals(nsISupports::GetIID());
|
||||
retval = iid->Equals(nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
nsAllocator::Free(iid);
|
||||
}
|
||||
NS_RELEASE(oldest);
|
||||
|
|
|
@ -42,7 +42,7 @@ nsJSIID::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID()) ||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()) ||
|
||||
aIID.Equals(nsIJSID::GetIID()) ||
|
||||
aIID.Equals(nsIJSIID::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
|
@ -353,7 +353,7 @@ CIDCreateInstanceScriptable::Call(JSContext *cx, JSObject *obj,
|
|||
}
|
||||
}
|
||||
if(!piid)
|
||||
piid = &nsISupports::GetIID();
|
||||
piid = &(nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
|
||||
nsISupports* inst;
|
||||
nsresult rv;
|
||||
|
@ -573,7 +573,7 @@ CIDGetServiceScriptable::Call(JSContext *cx, JSObject *obj,
|
|||
}
|
||||
}
|
||||
if(!piid)
|
||||
piid = &nsISupports::GetIID();
|
||||
piid = &(nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
|
||||
nsISupports* srvc;
|
||||
nsresult rv;
|
||||
|
@ -664,7 +664,7 @@ nsJSCID::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID()) ||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()) ||
|
||||
aIID.Equals(nsIJSID::GetIID()) ||
|
||||
aIID.Equals(nsIJSCID::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
|
|
|
@ -62,7 +62,7 @@ nsXPCFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
if(aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if(aIID.Equals(nsISupports::GetIID()) ||
|
||||
if(aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()) ||
|
||||
aIID.Equals(nsIFactory::GetIID()) ||
|
||||
aIID.Equals(nsXPCFactory::GetIID()))
|
||||
{
|
||||
|
|
|
@ -140,7 +140,7 @@ nsXPCWrappedJS::GetNewOrUsedWrapper(XPCContext* xpcc,
|
|||
// just a root wrapper
|
||||
nsXPCWrappedJSClass* rootClazz;
|
||||
rootClazz = nsXPCWrappedJSClass::GetNewOrUsedClass(
|
||||
xpcc, nsISupports::GetIID());
|
||||
xpcc, nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
if(!rootClazz)
|
||||
goto return_wrapper;
|
||||
|
||||
|
@ -234,7 +234,7 @@ nsXPCWrappedJS::~nsXPCWrappedJS()
|
|||
nsXPCWrappedJS*
|
||||
nsXPCWrappedJS::Find(REFNSIID aIID)
|
||||
{
|
||||
if(aIID.Equals(nsISupports::GetIID()))
|
||||
if(aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
return mRoot;
|
||||
|
||||
nsXPCWrappedJS* cur = mRoot;
|
||||
|
|
|
@ -223,7 +223,7 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self,
|
|||
REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if(aIID.Equals(nsISupports::GetIID()))
|
||||
if(aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
// asking for nsISupports... no problem
|
||||
nsXPCWrappedJS* root = self->GetRootWrapper();
|
||||
|
@ -299,7 +299,7 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self,
|
|||
JSObject*
|
||||
nsXPCWrappedJSClass::GetRootJSObject(JSObject* aJSObj)
|
||||
{
|
||||
JSObject* result = CallQueryInterfaceOnJSObject(aJSObj, nsISupports::GetIID());
|
||||
JSObject* result = CallQueryInterfaceOnJSObject(aJSObj, nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
return result ? result : aJSObj;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ nsXPCWrappedNative::GetNewOrUsedWrapper(XPCContext* xpcc,
|
|||
}
|
||||
|
||||
// always find the native root
|
||||
if(NS_FAILED(aObj->QueryInterface(nsISupports::GetIID(), (void**)&rootObj)))
|
||||
if(NS_FAILED(aObj->QueryInterface(nsCOMTypeInfo<nsISupports>::GetIID(), (void**)&rootObj)))
|
||||
return NULL;
|
||||
|
||||
// look for the root wrapper
|
||||
|
@ -154,7 +154,7 @@ nsXPCWrappedNative::GetNewOrUsedWrapper(XPCContext* xpcc,
|
|||
// just a root wrapper
|
||||
nsXPCWrappedNativeClass* rootClazz;
|
||||
rootClazz = nsXPCWrappedNativeClass::GetNewOrUsedClass(
|
||||
xpcc, nsISupports::GetIID());
|
||||
xpcc, nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
if(!rootClazz)
|
||||
goto return_wrapper;
|
||||
|
||||
|
@ -307,7 +307,7 @@ nsXPCWrappedNative::~nsXPCWrappedNative()
|
|||
nsXPCWrappedNative*
|
||||
nsXPCWrappedNative::Find(REFNSIID aIID)
|
||||
{
|
||||
if(aIID.Equals(nsISupports::GetIID()))
|
||||
if(aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
return mRoot;
|
||||
|
||||
nsXPCWrappedNative* cur = mRoot;
|
||||
|
|
|
@ -124,7 +124,7 @@ NS_IMETHODIMP nsTestXPCFoo::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
|
||||
if (aIID.Equals(nsITestXPCFoo::GetIID()) ||
|
||||
aIID.Equals(nsITestXPCFoo2::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -148,7 +148,7 @@ xpctestChild::QueryInterface(REFNSIID iid, void** result)
|
|||
|
||||
if (iid.Equals(nsIXPCTestChild::GetIID()) ||
|
||||
iid.Equals(nsIXPCTestParent::GetIID()) ||
|
||||
iid.Equals(nsISupports::GetIID())) {
|
||||
iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIXPCTestChild*, this);
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
|
|
|
@ -398,7 +398,7 @@ nsRangeListIterator::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
// XXX shouldn't this just do mRangeList->QueryInterface instead of
|
||||
// having a complete copy of that method here? What about AddRef and
|
||||
// Release? shouldn't they be delegated too?
|
||||
if (aIID.Equals(nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
nsIDOMSelection* tmp = mRangeList;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
NS_ADDREF(mRangeList);
|
||||
|
@ -527,7 +527,7 @@ nsRangeList::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
*aInstancePtr = (void *)iterator;
|
||||
return iterator->AddRef();
|
||||
}
|
||||
if (aIID.Equals(((nsISupports *)((nsIFrameSelection *)this))->GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
// use *first* base class for ISupports
|
||||
nsIFrameSelection* tmp1 = this;
|
||||
nsISupports* tmp2 = tmp1;
|
||||
|
|
|
@ -98,7 +98,7 @@ nsresult nsAbFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -141,7 +141,7 @@ NS_IMETHODIMP nsAddrDatabase::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
|
||||
if (aIID.Equals(nsIAddrDatabase::GetIID()) ||
|
||||
aIID.Equals(nsIAddrDBAnnouncer::GetIID()) ||
|
||||
aIID.Equals(::nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIAddrDatabase*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -160,7 +160,7 @@ nsMsgFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)NS_STATIC_CAST(nsISupports*,this);
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)NS_STATIC_CAST(nsIFactory*,this);
|
||||
|
|
|
@ -55,7 +55,7 @@ NS_IMETHODIMP nsMsgFilter::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsIMsgFilter::GetIID()) ||
|
||||
aIID.Equals(::nsISupports::GetIID()))
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aResult = NS_STATIC_CAST(nsMsgFilter*, this);
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -48,7 +48,7 @@ NS_IMETHODIMP nsMsgFilterList::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsIMsgFilterList::GetIID()) ||
|
||||
aIID.Equals(::nsISupports::GetIID()))
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aResult = NS_STATIC_CAST(nsMsgFilterList*, this);
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -53,7 +53,7 @@ NS_IMETHODIMP nsMsgFilterService::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsIMsgFilterService::GetIID()) ||
|
||||
aIID.Equals(::nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIMsgFilterService*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -114,7 +114,7 @@ nsresult nsMsgComposeFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -1,232 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "msgCore.h" // for pre-compiled headers...
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsMorkCID.h"
|
||||
#include "nsIMdbFactoryFactory.h"
|
||||
#include "pratom.h"
|
||||
#include "mdb.h"
|
||||
|
||||
// include files for components this factory creates...
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
static PRInt32 g_InstanceCount = 0;
|
||||
static PRInt32 g_LockCount = 0;
|
||||
|
||||
class nsMorkFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsMorkFactory(const nsCID &aClass, const char* aClassName, const char* aProgID);
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~nsMorkFactory();
|
||||
|
||||
nsCID mClassID;
|
||||
char* mClassName;
|
||||
char* mProgID;
|
||||
};
|
||||
|
||||
class nsMorkFactoryFactory : public nsIMdbFactoryFactory
|
||||
{
|
||||
public:
|
||||
nsMorkFactoryFactory();
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetMdbFactory(nsIMdbFactory **aFactory);
|
||||
|
||||
};
|
||||
|
||||
nsMorkFactory::nsMorkFactory(const nsCID &aClass, const char* aClassName, const char* aProgID)
|
||||
: mClassID(aClass), mClassName(nsCRT::strdup(aClassName)), mProgID(nsCRT::strdup(aProgID))
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsMorkFactory::~nsMorkFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
PL_strfree(mClassName);
|
||||
PL_strfree(mProgID);
|
||||
}
|
||||
|
||||
nsresult nsMorkFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
||||
if (*aResult == NULL)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsMorkFactory)
|
||||
NS_IMPL_RELEASE(nsMorkFactory)
|
||||
|
||||
// OK, we're cheating here, since Mork doesn't support XPCOM, i.e., nsIMDBFactory
|
||||
// doesn't inherit from nsISupports. I could create a wrapper interface for an nsIMDBFactory
|
||||
// object that returns a real nsISupports object, and msgdb could use this object
|
||||
// to get hold of the actual nsIMDBFactory interface object.
|
||||
nsresult nsMorkFactory::CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
// ClassID check happens here
|
||||
// Whenever you add a new class that supports an interface, plug it in here!!!
|
||||
|
||||
// do they want a mork factory ?
|
||||
if (mClassID.Equals(kCMorkFactory))
|
||||
{
|
||||
*aResult = MakeMdbFactory();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMorkFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock) {
|
||||
PR_AtomicIncrement(&g_LockCount);
|
||||
} else {
|
||||
PR_AtomicDecrement(&g_LockCount);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// return the proper factory to the caller.
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// If we decide to implement multiple factories in the msg.dll, then we need to check the class
|
||||
// type here and create the appropriate factory instead of always creating a nsMsgFactory...
|
||||
*aFactory = new nsMorkFactory(aClass, aClassName, aProgID);
|
||||
|
||||
if (aFactory)
|
||||
return (*aFactory)->QueryInterface(nsIFactory::GetIID(), (void**)aFactory); // they want a Factory Interface so give it to them
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsresult finalResult = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kCMorkFactory, nsnull, nsnull,
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv))finalResult = rv;
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsresult finalResult = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kCMorkFactory, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
static nsIMdbFactory *gMDBFactory = nsnull;
|
||||
|
||||
NS_IMPL_ADDREF(nsMorkFactoryFactory)
|
||||
NS_IMPL_RELEASE(nsMorkFactoryFactory)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMorkFactoryFactory::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if(iid.Equals(nsIMdbFactoryFactory::GetIID()) ||
|
||||
iid.Equals(nsISupports::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIMdbFactoryFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsMorkFactoryFactory::nsMorkFactoryFactory()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMorkFactoryFactory::GetMdbFactory(nsIMdbFactory **aFactory)
|
||||
{
|
||||
if (!gMDBFactory)
|
||||
gMDBFactory = MakeMdbFactory();
|
||||
*aFactory = gMDBFactory;
|
||||
return (gMDBFactory) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ nsresult nsMsgDBFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -384,7 +384,7 @@ NS_IMETHODIMP nsMsgDatabase::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
|
||||
if (aIID.Equals(nsIMsgDatabase::GetIID()) ||
|
||||
aIID.Equals(nsIDBChangeAnnouncer::GetIID()) ||
|
||||
aIID.Equals(::nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIMsgDatabase*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -90,7 +90,7 @@ nsresult nsImapFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -93,7 +93,7 @@ nsresult nsMsgLocalFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = nsnull;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
@ -194,7 +194,7 @@ nsresult nsMsgLocalFactory::CreateInstance(nsISupports * /* aOuter */, const nsI
|
|||
else if (mClassID.Equals(kParseMailMsgStateCID))
|
||||
rv = NS_NewParseMailMessageState(aIID, aResult);
|
||||
else if (mClassID.Equals(kPop3IncomingServerCID))
|
||||
rv = NS_NewPop3IncomingServer(nsISupports::GetIID(), aResult);
|
||||
rv = NS_NewPop3IncomingServer(nsCOMTypeInfo<nsISupports>::GetIID(), aResult);
|
||||
|
||||
else
|
||||
rv = NS_NOINTERFACE;
|
||||
|
|
|
@ -93,7 +93,7 @@ nsCalendarFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -93,7 +93,7 @@ nsVCardFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -90,7 +90,7 @@ nsresult nsMimeEmitterFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -1,218 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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 "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "msgCore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "pratom.h"
|
||||
|
||||
/* Include all of the interfaces our factory can generate components for */
|
||||
#include "nsIMimeEmitter.h"
|
||||
#include "nsMimeEmitter.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kMimeEmitterCID, NS_HTML_MIME_EMITTER_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
static PRInt32 g_InstanceCount = 0;
|
||||
static PRInt32 g_LockCount = 0;
|
||||
|
||||
class nsHtmlEmitterFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsHtmlEmitterFactory(const nsCID &aClass,
|
||||
const char* aClassName,
|
||||
const char* aProgID,
|
||||
nsISupports*);
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~nsHtmlEmitterFactory();
|
||||
|
||||
nsCID mClassID;
|
||||
char* mClassName;
|
||||
char* mProgID;
|
||||
nsIServiceManager* mServiceManager;
|
||||
};
|
||||
|
||||
nsHtmlEmitterFactory::nsHtmlEmitterFactory(const nsCID &aClass,
|
||||
const char* aClassName,
|
||||
const char* aProgID,
|
||||
nsISupports *compMgrSupports)
|
||||
: mClassID(aClass),
|
||||
mClassName(nsCRT::strdup(aClassName)),
|
||||
mProgID(nsCRT::strdup(aProgID))
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
// store a copy of the
|
||||
compMgrSupports->QueryInterface(nsIServiceManager::GetIID(),
|
||||
(void **)&mServiceManager);
|
||||
}
|
||||
|
||||
nsHtmlEmitterFactory::~nsHtmlEmitterFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
|
||||
NS_IF_RELEASE(mServiceManager);
|
||||
PL_strfree(mClassName);
|
||||
PL_strfree(mProgID);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHtmlEmitterFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
||||
if (*aResult == NULL)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHtmlEmitterFactory)
|
||||
NS_IMPL_RELEASE(nsHtmlEmitterFactory)
|
||||
|
||||
nsresult
|
||||
nsHtmlEmitterFactory::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
// ClassID check happens here
|
||||
// Whenever you add a new class that supports an interface, plug it in here!!!
|
||||
|
||||
// do they want a mime emitter interface ?
|
||||
if (mClassID.Equals(kMimeEmitterCID))
|
||||
{
|
||||
res = NS_NewMimeEmitter((nsIMimeEmitter **) &inst);
|
||||
if (NS_FAILED(res)) // was there a problem creating the object ?
|
||||
return res;
|
||||
}
|
||||
|
||||
// End of checking the interface ID code....
|
||||
if (inst)
|
||||
{
|
||||
// so we now have the class that supports the desired interface...we need to turn around and
|
||||
// query for our desired interface.....
|
||||
res = inst->QueryInterface(aIID, aResult);
|
||||
if (res != NS_OK) // if the query interface failed for some reason, then the object did not get ref counted...delete it.
|
||||
delete inst;
|
||||
}
|
||||
else
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHtmlEmitterFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock)
|
||||
PR_AtomicIncrement(&g_LockCount);
|
||||
else
|
||||
PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// return the proper factory to the caller.
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = new nsHtmlEmitterFactory(aClass, aClassName, aProgID, aServMgr);
|
||||
if (aFactory)
|
||||
return (*aFactory)->QueryInterface(nsIFactory::GetIID(),
|
||||
(void**)aFactory);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kMimeEmitterCID,
|
||||
"RFC822 Parser",
|
||||
nsnull,
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kMimeEmitterCID, path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1,218 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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 "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "msgCore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "pratom.h"
|
||||
|
||||
/* Include all of the interfaces our factory can generate components for */
|
||||
#include "nsIMimeEmitter.h"
|
||||
#include "nsMimeEmitter.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kMimeEmitterCID, NS_RAW_MIME_EMITTER_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
static PRInt32 g_InstanceCount = 0;
|
||||
static PRInt32 g_LockCount = 0;
|
||||
|
||||
class nsRawEmitterFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsRawEmitterFactory(const nsCID &aClass,
|
||||
const char* aClassName,
|
||||
const char* aProgID,
|
||||
nsISupports*);
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~nsRawEmitterFactory();
|
||||
|
||||
nsCID mClassID;
|
||||
char* mClassName;
|
||||
char* mProgID;
|
||||
nsIServiceManager* mServiceManager;
|
||||
};
|
||||
|
||||
nsRawEmitterFactory::nsRawEmitterFactory(const nsCID &aClass,
|
||||
const char* aClassName,
|
||||
const char* aProgID,
|
||||
nsISupports *compMgrSupports)
|
||||
: mClassID(aClass),
|
||||
mClassName(nsCRT::strdup(aClassName)),
|
||||
mProgID(nsCRT::strdup(aProgID))
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
// store a copy of the
|
||||
compMgrSupports->QueryInterface(nsIServiceManager::GetIID(),
|
||||
(void **)&mServiceManager);
|
||||
}
|
||||
|
||||
nsRawEmitterFactory::~nsRawEmitterFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
|
||||
NS_IF_RELEASE(mServiceManager);
|
||||
PL_strfree(mClassName);
|
||||
PL_strfree(mProgID);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRawEmitterFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
||||
if (*aResult == NULL)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsRawEmitterFactory)
|
||||
NS_IMPL_RELEASE(nsRawEmitterFactory)
|
||||
|
||||
nsresult
|
||||
nsRawEmitterFactory::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
// ClassID check happens here
|
||||
// Whenever you add a new class that supports an interface, plug it in here!!!
|
||||
|
||||
// do they want a mime emitter interface ?
|
||||
if (mClassID.Equals(kMimeEmitterCID))
|
||||
{
|
||||
res = NS_NewMimeEmitter((nsIMimeEmitter **) &inst);
|
||||
if (NS_FAILED(res)) // was there a problem creating the object ?
|
||||
return res;
|
||||
}
|
||||
|
||||
// End of checking the interface ID code....
|
||||
if (inst)
|
||||
{
|
||||
// so we now have the class that supports the desired interface...we need to turn around and
|
||||
// query for our desired interface.....
|
||||
res = inst->QueryInterface(aIID, aResult);
|
||||
if (res != NS_OK) // if the query interface failed for some reason, then the object did not get ref counted...delete it.
|
||||
delete inst;
|
||||
}
|
||||
else
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRawEmitterFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock)
|
||||
PR_AtomicIncrement(&g_LockCount);
|
||||
else
|
||||
PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// return the proper factory to the caller.
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = new nsRawEmitterFactory(aClass, aClassName, aProgID, aServMgr);
|
||||
if (aFactory)
|
||||
return (*aFactory)->QueryInterface(nsIFactory::GetIID(),
|
||||
(void**)aFactory);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kMimeEmitterCID,
|
||||
"RFC822 Parser",
|
||||
nsnull,
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kMimeEmitterCID, path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1,216 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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 "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "msgCore.h"
|
||||
#include "pratom.h"
|
||||
|
||||
/* Include all of the interfaces our factory can generate components for */
|
||||
#include "nsIMimeEmitter.h"
|
||||
#include "nsMimeEmitter.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kMimeEmitterCID, NS_XML_MIME_EMITTER_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
static PRInt32 g_InstanceCount = 0;
|
||||
static PRInt32 g_LockCount = 0;
|
||||
|
||||
class nsXmlEmitterFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsXmlEmitterFactory(const nsCID &aClass,
|
||||
const char* aClassName,
|
||||
const char* aProgID,
|
||||
nsISupports*);
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~nsXmlEmitterFactory();
|
||||
|
||||
nsCID mClassID;
|
||||
char* mClassName;
|
||||
char* mProgID;
|
||||
nsIServiceManager* mServiceManager;
|
||||
};
|
||||
|
||||
nsXmlEmitterFactory::nsXmlEmitterFactory(const nsCID &aClass,
|
||||
const char* aClassName,
|
||||
const char* aProgID,
|
||||
nsISupports *compMgrSupports)
|
||||
: mClassID(aClass),
|
||||
mClassName(nsCRT::strdup(aClassName)),
|
||||
mProgID(nsCRT::strdup(aProgID))
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
// store a copy of the
|
||||
compMgrSupports->QueryInterface(nsIServiceManager::GetIID(),
|
||||
(void **)&mServiceManager);
|
||||
}
|
||||
|
||||
nsXmlEmitterFactory::~nsXmlEmitterFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
|
||||
NS_IF_RELEASE(mServiceManager);
|
||||
PL_strfree(mClassName);
|
||||
PL_strfree(mProgID);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXmlEmitterFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
||||
if (*aResult == NULL)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXmlEmitterFactory)
|
||||
NS_IMPL_RELEASE(nsXmlEmitterFactory)
|
||||
|
||||
nsresult
|
||||
nsXmlEmitterFactory::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
// ClassID check happens here
|
||||
// Whenever you add a new class that supports an interface, plug it in here!!!
|
||||
|
||||
// do they want a mime emitter interface ?
|
||||
if (mClassID.Equals(kMimeEmitterCID))
|
||||
{
|
||||
res = NS_NewMimeEmitter((nsIMimeEmitter **) &inst);
|
||||
if (NS_FAILED(res)) // was there a problem creating the object ?
|
||||
return res;
|
||||
}
|
||||
|
||||
// End of checking the interface ID code....
|
||||
if (inst)
|
||||
{
|
||||
// so we now have the class that supports the desired interface...we need to turn around and
|
||||
// query for our desired interface.....
|
||||
res = inst->QueryInterface(aIID, aResult);
|
||||
if (res != NS_OK) // if the query interface failed for some reason, then the object did not get ref counted...delete it.
|
||||
delete inst;
|
||||
}
|
||||
else
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXmlEmitterFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock)
|
||||
PR_AtomicIncrement(&g_LockCount);
|
||||
else
|
||||
PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// return the proper factory to the caller.
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = new nsXmlEmitterFactory(aClass, aClassName, aProgID, aServMgr);
|
||||
if (aFactory)
|
||||
return (*aFactory)->QueryInterface(nsIFactory::GetIID(),
|
||||
(void**)aFactory);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kMimeEmitterCID,
|
||||
"RFC822 Parser",
|
||||
nsnull,
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kMimeEmitterCID, path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -104,7 +104,7 @@ nsresult nsMimeFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support three interfaces....nsISupports, nsFactory and nsINetPlugin.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -104,7 +104,7 @@ nsresult nsMsgNewsFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
*aResult = NULL;
|
||||
|
||||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(::nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
|
|
@ -2361,7 +2361,7 @@ nsNNTPHost::ReorderGroup(nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *groupT
|
|||
(void)infoList->CurrentItem(&hostInfoSupports);
|
||||
|
||||
nsIMsgFolder *groupInHostInfo=nsnull;
|
||||
rv = hostInfoSupports->QueryInterface(::nsISupports::GetIID(),
|
||||
rv = hostInfoSupports->QueryInterface(nsCOMTypeInfo<nsISupports>::GetIID(),
|
||||
(void **)&groupInHostInfo);
|
||||
#endif
|
||||
#ifdef HAVE_PANE
|
||||
|
@ -2387,7 +2387,7 @@ nsNNTPHost::ReorderGroup(nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *groupT
|
|||
{
|
||||
m_groups->InsertElementAt(groupToMove, idxInData); // the index has to be the same, right?
|
||||
nsISupports* groupSupports;
|
||||
groupToMove->QueryInterface(::nsISupports::GetIID(),
|
||||
groupToMove->QueryInterface(nsCOMTypeInfo<nsISupports>::GetIID(),
|
||||
(void **)&groupSupports);
|
||||
//XXX infoList->InsertElementAt(groupSupports, idxInHostInfo);
|
||||
NS_RELEASE(groupSupports);
|
||||
|
|
|
@ -1327,7 +1327,7 @@ CPluginManager::QueryInterface(const nsIID& iid, void** ptr)
|
|||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(nsIPluginManager::GetIID()) || iid.Equals(nsISupports::GetIID())) {
|
||||
if (iid.Equals(nsIPluginManager::GetIID()) || iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*ptr = (void*) ((nsIPluginManager*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
|
@ -1581,7 +1581,7 @@ CPluginInstancePeer::QueryInterface(const nsIID& iid, void** ptr)
|
|||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(nsIPluginTagInfo::GetIID()) || iid.Equals(nsISupports::GetIID())) {
|
||||
if (iid.Equals(nsIPluginTagInfo::GetIID()) || iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*ptr = (void*) ((nsIPluginTagInfo*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
|
|
|
@ -1327,7 +1327,7 @@ CPluginManager::QueryInterface(const nsIID& iid, void** ptr)
|
|||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(nsIPluginManager::GetIID()) || iid.Equals(nsISupports::GetIID())) {
|
||||
if (iid.Equals(nsIPluginManager::GetIID()) || iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*ptr = (void*) ((nsIPluginManager*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
|
@ -1581,7 +1581,7 @@ CPluginInstancePeer::QueryInterface(const nsIID& iid, void** ptr)
|
|||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(nsIPluginTagInfo::GetIID()) || iid.Equals(nsISupports::GetIID())) {
|
||||
if (iid.Equals(nsIPluginTagInfo::GetIID()) || iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*ptr = (void*) ((nsIPluginTagInfo*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
|
|
|
@ -67,7 +67,7 @@ nsBaseWidget::Enumerator::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
|
||||
if (aIID.Equals(nsIBidirectionalEnumerator::GetIID()) ||
|
||||
aIID.Equals(nsIEnumerator::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -65,7 +65,7 @@ nsresult nsKeyBindMgr::QueryInterface(const nsIID& aIID,
|
|||
{
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aInstancePtrResult = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -42,7 +42,7 @@ nsAllocatorImpl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsIAllocator::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
|
@ -53,13 +53,13 @@ nsAllocatorImpl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr
|
|||
NS_METHOD
|
||||
nsAllocatorImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
if (outer && !aIID.Equals(nsISupports::GetIID()))
|
||||
if (outer && !aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
nsAllocatorImpl* mm = new nsAllocatorImpl(outer);
|
||||
if (mm == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mm->AddRef();
|
||||
if (aIID.Equals(nsISupports::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aInstancePtr = mm->GetInner();
|
||||
else
|
||||
*aInstancePtr = mm;
|
||||
|
|
|
@ -37,7 +37,7 @@ NS_METHOD nsGenericFactory::QueryInterface(const nsIID& aIID, void** aInstancePt
|
|||
}
|
||||
if (aIID.Equals(nsIGenericFactory::GetIID()) ||
|
||||
aIID.Equals(nsIFactory::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (nsIGenericFactory*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -71,7 +71,7 @@ nsConjoiningEnumerator::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
|
||||
if (aIID.Equals(nsIBidirectionalEnumerator::GetIID()) ||
|
||||
aIID.Equals(nsIEnumerator::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -74,7 +74,7 @@ nsObserver::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
if (aInstancePtr == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(nsIObserver::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (nsIObserver*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -30,7 +30,7 @@ nsProperties::nsProperties(nsISupports* outer)
|
|||
NS_METHOD
|
||||
nsProperties::Create(nsISupports *outer, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (outer && !aIID.Equals(nsISupports::GetIID()))
|
||||
if (outer && !aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
nsProperties* props = new nsProperties(outer);
|
||||
if (props == NULL)
|
||||
|
@ -63,7 +63,7 @@ nsProperties::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsIProperties::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -203,7 +203,7 @@ nsPersistentProperties::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
NS_ASSERTION(aInstancePtr != nsnull, "null ptr");
|
||||
if (aIID.Equals(nsIPersistentProperties::GetIID()) ||
|
||||
aIID.Equals(nsIProperties::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIPersistentProperties*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -510,7 +510,7 @@ nsPropertyElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
{
|
||||
NS_ASSERTION(aInstancePtr != nsnull, "null ptr");
|
||||
if (aIID.Equals(nsIPropertyElement::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIPropertyElement*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -43,7 +43,7 @@ nsSupportsArrayEnumerator::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
|
||||
if (aIID.Equals(nsIBidirectionalEnumerator::GetIID()) ||
|
||||
aIID.Equals(nsIEnumerator::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -37,7 +37,7 @@ NS_METHOD nsGenericFactory::QueryInterface(const nsIID& aIID, void** aInstancePt
|
|||
}
|
||||
if (aIID.Equals(nsIGenericFactory::GetIID()) ||
|
||||
aIID.Equals(nsIFactory::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (nsIGenericFactory*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -77,7 +77,7 @@ nsByteBufferInputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (aIID.Equals(nsIByteBufferInputStream::GetIID()) ||
|
||||
aIID.Equals(nsIInputStream::GetIID()) ||
|
||||
aIID.Equals(nsIBaseStream::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -330,7 +330,7 @@ nsByteBufferOutputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(nsIOutputStream::GetIID()) ||
|
||||
aIID.Equals(nsIBaseStream::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -212,7 +212,7 @@ NS_IMETHODIMP FileImpl::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(((nsISupports*)(nsIOutputStream*)this)->GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = (void*)((nsISupports*)(nsIOutputStream*)this);
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -341,7 +341,7 @@ NS_IMETHODIMP BasicStringImpl::QueryInterface(REFNSIID aIID, void** aInstancePtr
|
|||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(((nsISupports*)(nsIOutputStream*)this)->GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = (void*)((nsISupports*)(nsIOutputStream*)this);
|
||||
NS_ADDREF_THIS();
|
||||
|
|
|
@ -110,7 +110,7 @@ nsBufferInputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (aIID.Equals(nsIBufferInputStream::GetIID()) ||
|
||||
aIID.Equals(nsIInputStream::GetIID()) ||
|
||||
aIID.Equals(nsIBaseStream::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -365,7 +365,7 @@ nsBufferOutputStream::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (aIID.Equals(nsIBufferOutputStream::GetIID()) ||
|
||||
aIID.Equals(nsIOutputStream::GetIID()) ||
|
||||
aIID.Equals(nsIBaseStream::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -93,7 +93,7 @@ nsProxyEventClass::GetNewOrUsedClass(REFNSIID aIID)
|
|||
nsID* iid;
|
||||
if(NS_SUCCEEDED(oldest->GetIID(&iid)))
|
||||
{
|
||||
isISupportsDescendent = iid->Equals(nsISupports::GetIID());
|
||||
isISupportsDescendent = iid->Equals(nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
nsAllocator::Free(iid);
|
||||
}
|
||||
NS_RELEASE(oldest);
|
||||
|
@ -245,7 +245,7 @@ nsProxyEventClass::DelegatedQueryInterface(nsProxyEventObject* self,
|
|||
REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if(aIID.Equals(nsISupports::GetIID()))
|
||||
if(aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
nsProxyEventObject* root = self->GetRootProxyObject();
|
||||
*aInstancePtr = (void*) root;
|
||||
|
@ -280,7 +280,7 @@ nsProxyEventClass::DelegatedQueryInterface(nsProxyEventObject* self,
|
|||
nsProxyEventObject*
|
||||
nsProxyEventClass::GetRootProxyObject(nsProxyEventObject* anObject)
|
||||
{
|
||||
nsProxyEventObject* result = CallQueryInterfaceOnProxy(anObject, nsISupports::GetIID());
|
||||
nsProxyEventObject* result = CallQueryInterfaceOnProxy(anObject, nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
return result ? result : anObject;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventQueue *destQueue,
|
|||
|
||||
nsISupports* rootObject;
|
||||
// always find the native root
|
||||
if(NS_FAILED(aObj->QueryInterface(nsISupports::GetIID(), (void**)&rootObject)))
|
||||
if(NS_FAILED(aObj->QueryInterface(nsCOMTypeInfo<nsISupports>::GetIID(), (void**)&rootObject)))
|
||||
return NULL;
|
||||
|
||||
|
||||
|
@ -96,7 +96,7 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventQueue *destQueue,
|
|||
else
|
||||
{
|
||||
// just a root proxy
|
||||
nsProxyEventClass* rootClazz = nsProxyEventClass::GetNewOrUsedClass(nsISupports::GetIID());
|
||||
nsProxyEventClass* rootClazz = nsProxyEventClass::GetNewOrUsedClass(nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
if(!rootClazz)
|
||||
{
|
||||
goto return_wrapper;
|
||||
|
@ -242,7 +242,7 @@ nsProxyEventObject::Release(void)
|
|||
nsProxyEventObject*
|
||||
nsProxyEventObject::Find(REFNSIID aIID)
|
||||
{
|
||||
if(aIID.Equals(nsISupports::GetIID()))
|
||||
if(aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
return mRoot;
|
||||
|
||||
nsProxyEventObject* cur = mRoot;
|
||||
|
|
|
@ -74,7 +74,7 @@ void EventQueueStack::SetNext(EventQueueStack* aStack)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* nsISupports interface implementation... */
|
||||
NS_IMPL_ISUPPORTS(EventQueueEntry,nsISupports::GetIID());
|
||||
NS_IMPL_ISUPPORTS(EventQueueEntry,nsCOMTypeInfo<nsISupports>::GetIID());
|
||||
|
||||
EventQueueEntry::EventQueueEntry()
|
||||
{
|
||||
|
|
|
@ -738,6 +738,6 @@ nsFindComponent::ResetContext( nsISupports *aContext,
|
|||
}
|
||||
|
||||
// nsFindComponent::Context implementation...
|
||||
NS_IMPL_ISUPPORTS( nsFindComponent::Context, nsISupports::GetIID() )
|
||||
NS_IMPL_ISUPPORTS( nsFindComponent::Context, nsCOMTypeInfo<nsISupports>::GetIID() )
|
||||
|
||||
NS_IMPL_IAPPSHELLCOMPONENT( nsFindComponent, nsIFindComponent, NS_IFINDCOMPONENT_PROGID )
|
||||
|
|
|
@ -181,7 +181,7 @@ className::QueryInterface( REFNSIID anIID, void **anInstancePtr ) { \
|
|||
} else if ( anIID.Equals( nsIAppShellComponent::GetIID() ) ) { \
|
||||
*anInstancePtr = (void*) ( (nsIAppShellComponent*)this ); \
|
||||
NS_ADDREF_THIS(); \
|
||||
} else if ( anIID.Equals( nsISupports::GetIID() ) ) { \
|
||||
} else if ( anIID.Equals( nsCOMTypeInfo<nsISupports>::GetIID() ) ) { \
|
||||
*anInstancePtr = (void*) ( (nsISupports*)this ); \
|
||||
NS_ADDREF_THIS(); \
|
||||
} else { \
|
||||
|
@ -221,7 +221,7 @@ className##Factory::QueryInterface( const nsIID &anIID, void **aResult ) { \
|
|||
} else if ( anIID.Equals( nsIFactory::GetIID() ) ) { \
|
||||
*aResult = (void*) (nsIFactory*)this; \
|
||||
NS_ADDREF_THIS(); \
|
||||
} else if ( anIID.Equals( nsISupports::GetIID() ) ) { \
|
||||
} else if ( anIID.Equals( nsCOMTypeInfo<nsISupports>::GetIID() ) ) { \
|
||||
*aResult = (void*) (nsISupports*)this; \
|
||||
NS_ADDREF_THIS(); \
|
||||
} else { \
|
||||
|
|
Загрузка…
Ссылка в новой задаче