Cleanup implementations of QueryInterface. b=385750 r+sr=dbaron r+sr=jst

This commit is contained in:
mats.palmgren@bredband.net 2007-07-03 19:15:31 -07:00
Родитель e3dc6b00a0
Коммит 0711c3f514
38 изменённых файлов: 170 добавлений и 226 удалений

Просмотреть файл

@ -3384,7 +3384,8 @@ nsGenericElement::PostQueryInterface(REFNSIID aIID, void** aInstancePtr)
aInstancePtr);
}
return NS_NOINTERFACE;
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}
//----------------------------------------------------------------------

Просмотреть файл

@ -225,6 +225,8 @@ nsresult
nsGenericHTMLElement::DOMQueryInterface(nsIDOMHTMLElement *aElement,
REFNSIID aIID, void **aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
nsISupports *inst = nsnull;
if (aIID.Equals(NS_GET_IID(nsIDOMNode))) {
@ -236,13 +238,20 @@ nsGenericHTMLElement::DOMQueryInterface(nsIDOMHTMLElement *aElement,
} else if (aIID.Equals(NS_GET_IID(nsIDOMNSHTMLElement))) {
inst = NS_STATIC_CAST(nsIDOMNSHTMLElement *,
new nsGenericHTMLElementTearoff(this));
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
if (NS_UNLIKELY(!inst)) {
*aInstancePtr = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
} else if (aIID.Equals(NS_GET_IID(nsIDOMElementCSSInlineStyle))) {
inst = NS_STATIC_CAST(nsIDOMElementCSSInlineStyle *,
new nsGenericHTMLElementTearoff(this));
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
if (NS_UNLIKELY(!inst)) {
*aInstancePtr = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
} else {
return NS_NOINTERFACE;
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}
NS_ADDREF(inst);

Просмотреть файл

@ -1094,9 +1094,7 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
#define NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(_class, _base, _base_if) \
NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
NS_PRECONDITION(aInstancePtr, "null out param"); \
\
nsresult rv; \
\
@ -1122,15 +1120,13 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
_base_if) \
NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
NS_PRECONDITION(aInstancePtr, "null out param"); \
\
if ( aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant)) ) { \
*aInstancePtr = &NS_CYCLE_COLLECTION_NAME(_class); \
return NS_OK; \
} \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \

Просмотреть файл

@ -67,8 +67,7 @@ nsXMLElement::nsXMLElement(nsINodeInfo *aNodeInfo)
NS_IMETHODIMP
nsXMLElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = nsnull;
NS_PRECONDITION(aInstancePtr, "null out param");
nsresult rv = nsGenericElement::QueryInterface(aIID, aInstancePtr);

Просмотреть файл

@ -110,33 +110,34 @@ NS_IMPL_RELEASE_INHERITED(nsXTFElementWrapper,nsXTFElementWrapperBase)
NS_IMETHODIMP
nsXTFElementWrapper::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
nsresult rv;
if(aIID.Equals(NS_GET_IID(nsIClassInfo))) {
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
*aInstancePtr = NS_STATIC_CAST(nsIClassInfo*, this);
NS_ADDREF_THIS();
return NS_OK;
}
else if(aIID.Equals(NS_GET_IID(nsIXTFElementWrapper))) {
if (aIID.Equals(NS_GET_IID(nsIXTFElementWrapper))) {
*aInstancePtr = NS_STATIC_CAST(nsIXTFElementWrapper*, this);
NS_ADDREF_THIS();
return NS_OK;
}
else if (NS_SUCCEEDED(rv = nsXTFElementWrapperBase::QueryInterface(aIID, aInstancePtr))) {
nsresult rv = nsXTFElementWrapperBase::QueryInterface(aIID, aInstancePtr);
if (NS_SUCCEEDED(rv)) {
return rv;
}
else {
// try to get get the interface from our wrapped element:
nsCOMPtr<nsISupports> inner;
QueryInterfaceInner(aIID, getter_AddRefs(inner));
if (inner) {
rv = NS_NewXTFInterfaceAggregator(aIID, inner,
NS_STATIC_CAST(nsIContent*, this),
aInstancePtr);
// try to get get the interface from our wrapped element:
nsCOMPtr<nsISupports> inner;
QueryInterfaceInner(aIID, getter_AddRefs(inner));
return rv;
}
if (inner) {
rv = NS_NewXTFInterfaceAggregator(aIID, inner,
NS_STATIC_CAST(nsIContent*, this),
aInstancePtr);
return rv;
}
return NS_ERROR_NO_INTERFACE;

Просмотреть файл

@ -136,12 +136,15 @@ NS_IMPL_RELEASE(nsXTFInterfaceAggregator)
NS_IMETHODIMP
nsXTFInterfaceAggregator::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if(aIID.Equals(mIID)) {
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(mIID)) {
*aInstancePtr = mXPTCStub;
NS_ADDREF_THIS();
return NS_OK;
}
else return mOuter->QueryInterface(aIID, aInstancePtr);
return mOuter->QueryInterface(aIID, aInstancePtr);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -119,7 +119,9 @@ NS_IMPL_RELEASE(nsXTFWeakTearoff)
NS_IMETHODIMP
nsXTFWeakTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if(aIID.Equals(mIID) || aIID.Equals(NS_GET_IID(nsISupports))) {
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(mIID) || aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = mXPTCStub;
NS_ADDREF_THIS();
return NS_OK;
@ -127,6 +129,7 @@ nsXTFWeakTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
// we can't map QI onto the obj, because the xpcom wrapper otherwise
// QI-accumulates all interfaces defined on mObj
// else return mObj->QueryInterface(aIID, aInstancePtr);
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}

Просмотреть файл

@ -366,10 +366,9 @@ NS_IMPL_RELEASE_INHERITED(nsXULElement, nsGenericElement)
NS_IMETHODIMP
nsXULElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = nsnull;
NS_PRECONDITION(aInstancePtr, "null out param");
if ( aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant)) ) {
if (aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant))) {
*aInstancePtr = &NS_CYCLE_COLLECTION_NAME(nsXULElement);
return NS_OK;
}

Просмотреть файл

@ -290,31 +290,28 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
NS_IMETHODIMP
nsComboboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIComboboxControlFrame))) {
*aInstancePtr = (void*)(nsIComboboxControlFrame*)this;
*aInstancePtr = NS_STATIC_CAST(nsIComboboxControlFrame*, this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = (void*)(nsIFormControlFrame*)this;
*aInstancePtr = NS_STATIC_CAST(nsIFormControlFrame*, this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = (void*)(nsIAnonymousContentCreator*)this;
*aInstancePtr = NS_STATIC_CAST(nsIAnonymousContentCreator*, this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsISelectControlFrame))) {
*aInstancePtr = (void *)(nsISelectControlFrame*)this;
*aInstancePtr = NS_STATIC_CAST(nsISelectControlFrame*, this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
*aInstancePtr = (void*)(nsIStatefulFrame*)this;
*aInstancePtr = NS_STATIC_CAST(nsIStatefulFrame*, this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIRollupListener))) {
*aInstancePtr = (void*)(nsIRollupListener*)this;
*aInstancePtr = NS_STATIC_CAST(nsIRollupListener*, this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider))) {
*aInstancePtr = (void*)(nsIScrollableViewProvider*)this;
*aInstancePtr = NS_STATIC_CAST(nsIScrollableViewProvider*, this);
return NS_OK;
}

Просмотреть файл

@ -208,10 +208,8 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
NS_IMETHODIMP
nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null ptr");
if (NS_UNLIKELY(!aInstancePtr)) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = NS_STATIC_CAST(nsIAnonymousContentCreator*, this);
return NS_OK;
@ -220,6 +218,7 @@ nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
*aInstancePtr = NS_STATIC_CAST(nsIFormControlFrame*, this);
return NS_OK;
}
return nsAreaFrame::QueryInterface(aIID, aInstancePtr);
}

Просмотреть файл

@ -66,14 +66,13 @@ nsFormControlFrame::Destroy()
NS_IMETHODIMP
nsFormControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = (void*) ((nsIFormControlFrame*) this);
*aInstancePtr = NS_STATIC_CAST(nsIFormControlFrame*, this);
return NS_OK;
}
return nsLeafFrame::QueryInterface(aIID, aInstancePtr);
}

Просмотреть файл

@ -190,16 +190,14 @@ NS_IMETHODIMP nsGfxButtonControlFrame::GetAccessible(nsIAccessible** aAccessible
NS_IMETHODIMP
nsGfxButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = NS_STATIC_CAST(nsIAnonymousContentCreator*, this);
}
else {
return nsHTMLButtonControlFrame::QueryInterface(aIID, aInstancePtr);
return NS_OK;
}
return NS_OK;
return nsHTMLButtonControlFrame::QueryInterface(aIID, aInstancePtr);
}
// Initially we hardcoded the default strings here.

Просмотреть файл

@ -100,12 +100,10 @@ nsGfxCheckboxControlFrame::~nsGfxCheckboxControlFrame()
NS_IMETHODIMP
nsGfxCheckboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!");
if ( !aInstancePtr )
return NS_ERROR_NULL_POINTER;
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsICheckboxControlFrame))) {
*aInstancePtr = (void*) ((nsICheckboxControlFrame*) this);
*aInstancePtr = NS_STATIC_CAST(nsICheckboxControlFrame*, this);
return NS_OK;
}

Просмотреть файл

@ -65,12 +65,10 @@ nsGfxRadioControlFrame::~nsGfxRadioControlFrame()
NS_IMETHODIMP
nsGfxRadioControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIRadioControlFrame))) {
*aInstancePtr = (void*) ((nsIRadioControlFrame*) this);
*aInstancePtr = NS_STATIC_CAST(nsIRadioControlFrame*, this);
return NS_OK;
}

Просмотреть файл

@ -121,12 +121,10 @@ nsrefcnt nsHTMLButtonControlFrame::Release(void)
NS_IMETHODIMP
nsHTMLButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = (void*) ((nsIFormControlFrame*) this);
*aInstancePtr = NS_STATIC_CAST(nsIFormControlFrame*, this);
return NS_OK;
}

Просмотреть файл

@ -158,12 +158,10 @@ nsImageControlFrame::Init(nsIContent* aContent,
NS_IMETHODIMP
nsImageControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = (void*) ((nsIFormControlFrame*) this);
*aInstancePtr = NS_STATIC_CAST(nsIFormControlFrame*, this);
return NS_OK;
}

Просмотреть файл

@ -238,10 +238,8 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
NS_IMETHODIMP
nsIsIndexFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null ptr");
if (NS_UNLIKELY(!aInstancePtr)) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = NS_STATIC_CAST(nsIAnonymousContentCreator*, this);
return NS_OK;
@ -254,6 +252,7 @@ nsIsIndexFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
*aInstancePtr = NS_STATIC_CAST(nsIDOMKeyListener*, this);
return NS_OK;
}
return nsAreaFrame::QueryInterface(aIID, aInstancePtr);
}

Просмотреть файл

@ -79,17 +79,16 @@ nsLegendFrame::Destroy()
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtrResult, "null pointer");
if (NS_UNLIKELY(!aInstancePtrResult)) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kLegendFrameCID)) {
*aInstancePtrResult = this;
*aInstancePtr = this;
return NS_OK;
}
return nsAreaFrame::QueryInterface(aIID, aInstancePtrResult);
return nsAreaFrame::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP

Просмотреть файл

@ -380,21 +380,21 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsPoint aPt)
NS_IMETHODIMP
nsListControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = (void*) ((nsIFormControlFrame*) this);
*aInstancePtr = NS_STATIC_CAST(nsIFormControlFrame*, this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIListControlFrame))) {
*aInstancePtr = (void *)((nsIListControlFrame*)this);
*aInstancePtr = NS_STATIC_CAST(nsIListControlFrame*, this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsISelectControlFrame))) {
*aInstancePtr = (void *)((nsISelectControlFrame*)this);
*aInstancePtr = NS_STATIC_CAST(nsISelectControlFrame*, this);
return NS_OK;
}
return nsHTMLScrollFrame::QueryInterface(aIID, aInstancePtr);
}

Просмотреть файл

@ -983,27 +983,26 @@ NS_IMPL_RELEASE_INHERITED(nsTextControlFrame, nsBoxFrame)
NS_IMETHODIMP
nsTextControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = (void*) ((nsIFormControlFrame*) this);
*aInstancePtr = NS_STATIC_CAST(nsIFormControlFrame*, this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = (void*)(nsIAnonymousContentCreator*) this;
*aInstancePtr = NS_STATIC_CAST(nsIAnonymousContentCreator*, this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsITextControlFrame))) {
*aInstancePtr = (void*)(nsITextControlFrame*) this;
*aInstancePtr = NS_STATIC_CAST(nsITextControlFrame*, this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider)) && IsScrollable()) {
*aInstancePtr = (void*)(nsIScrollableViewProvider*) this;
*aInstancePtr = NS_STATIC_CAST(nsIScrollableViewProvider*, this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIPhonetic))) {
*aInstancePtr = (void*)(nsIPhonetic*) this;
*aInstancePtr = NS_STATIC_CAST(nsIPhonetic*, this);
return NS_OK;
}

Просмотреть файл

@ -331,13 +331,13 @@ NS_IMETHODIMP
nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kBlockFrameCID)) {
*aInstancePtr = NS_STATIC_CAST(void*, NS_STATIC_CAST(nsBlockFrame*, this));
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsILineIterator)) ||
aIID.Equals(NS_GET_IID(nsILineIteratorNavigator)))
{
aIID.Equals(NS_GET_IID(nsILineIteratorNavigator))) {
nsLineIterator* it = new nsLineIterator;
if (!it) {
*aInstancePtr = nsnull;
@ -348,13 +348,14 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
nsresult rv = it->Init(mLines,
visibility->mDirection == NS_STYLE_DIRECTION_RTL);
if (NS_FAILED(rv)) {
*aInstancePtr = nsnull;
NS_RELEASE(it);
return rv;
}
*aInstancePtr = NS_STATIC_CAST(void*,
NS_STATIC_CAST(nsILineIteratorNavigator*, it));
*aInstancePtr = NS_STATIC_CAST(nsILineIteratorNavigator*, it);
return NS_OK;
}
return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr);
}

Просмотреть файл

@ -510,25 +510,26 @@ nsFrame::~nsFrame()
/////////////////////////////////////////////////////////////////////////////
// nsISupports
nsresult nsFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
NS_IMETHODIMP
nsFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
#ifdef DEBUG
if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) {
*aInstancePtr = NS_STATIC_CAST(void*,NS_STATIC_CAST(nsIFrameDebug*,this));
*aInstancePtr = NS_STATIC_CAST(nsIFrameDebug*, this);
return NS_OK;
}
#endif
if (aIID.Equals(NS_GET_IID(nsIFrame)) ||
aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(void*,NS_STATIC_CAST(nsIFrame*,this));
*aInstancePtr = NS_STATIC_CAST(nsIFrame*, this);
return NS_OK;
}
*aInstancePtr = nsnull;
return NS_NOINTERFACE;
return NS_ERROR_NO_INTERFACE;
}
nsrefcnt nsFrame::AddRef(void)

Просмотреть файл

@ -202,14 +202,10 @@ NS_IMETHODIMP nsSubDocumentFrame::GetAccessible(nsIAccessible** aAccessible)
NS_IMETHODIMP
nsSubDocumentFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFrameFrame))) {
nsISupports *tmp = NS_STATIC_CAST(nsIFrameFrame *, this);
*aInstancePtr = tmp;
*aInstancePtr = NS_STATIC_CAST(nsIFrameFrame*, this);
return NS_OK;
}

Просмотреть файл

@ -250,12 +250,10 @@ nsHTMLFramesetFrame::~nsHTMLFramesetFrame()
FrameResizePrefCallback, this);
}
nsresult nsHTMLFramesetFrame::QueryInterface(const nsIID& aIID,
void** aInstancePtr)
NS_IMETHODIMP
nsHTMLFramesetFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsHTMLFramesetFrame))) {
*aInstancePtr = (void*)this;

Просмотреть файл

@ -162,21 +162,16 @@ NS_NewCanvasFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
NS_IMETHODIMP
CanvasFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIScrollPositionListener))) {
*aInstancePtr = (void*) ((nsIScrollPositionListener*) this);
*aInstancePtr = NS_STATIC_CAST(nsIScrollPositionListener*, this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsICanvasFrame))) {
*aInstancePtr = (void*) ((nsICanvasFrame*) this);
*aInstancePtr = NS_STATIC_CAST(nsICanvasFrame*, this);
return NS_OK;
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}

Просмотреть файл

@ -188,28 +188,14 @@ nsImageFrame::~nsImageFrame()
NS_IMETHODIMP
nsImageFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = nsnull;
#ifdef DEBUG
if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrameDebug*,this);
return NS_OK;
}
#endif
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIImageFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*,this);
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*, this);
return NS_OK;
}
return NS_NOINTERFACE;
return ImageFrameSuper::QueryInterface(aIID, aInstancePtr);
}
#ifdef ACCESSIBILITY

Просмотреть файл

@ -78,14 +78,13 @@ NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
NS_IMETHODIMP
nsInlineFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kInlineFrameCID)) {
nsInlineFrame* tmp = this;
*aInstancePtr = (void*) tmp;
*aInstancePtr = this;
return NS_OK;
}
return nsInlineFrameSuper::QueryInterface(aIID, aInstancePtr);
}

Просмотреть файл

@ -448,27 +448,14 @@ nsObjectFrame::~nsObjectFrame()
NS_IMETHODIMP
nsObjectFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = nsnull;
#ifdef DEBUG
if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrameDebug*,this);
return NS_OK;
}
#endif
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIObjectFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIObjectFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIFrame*,this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(nsIObjectFrame*,this);
*aInstancePtr = NS_STATIC_CAST(nsIObjectFrame*, this);
return NS_OK;
}
return NS_NOINTERFACE;
return nsObjectFrameSuper::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP_(nsrefcnt) nsObjectFrame::AddRef(void)

Просмотреть файл

@ -136,15 +136,13 @@ nsSimplePageSequenceFrame::~nsSimplePageSequenceFrame()
if (mPageData) delete mPageData;
}
nsresult
NS_IMETHODIMP
nsSimplePageSequenceFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIPageSequenceFrame))) {
*aInstancePtr = (void*)(nsIPageSequenceFrame*)this;
*aInstancePtr = NS_STATIC_CAST(nsIPageSequenceFrame*, this);
return NS_OK;
}
return nsContainerFrame::QueryInterface(aIID, aInstancePtr);

Просмотреть файл

@ -911,18 +911,17 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
NS_IMPL_ADDREF_INHERITED(nsTableCellFrame, nsHTMLContainerFrame)
NS_IMPL_RELEASE_INHERITED(nsTableCellFrame, nsHTMLContainerFrame)
nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
NS_IMETHODIMP
nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsITableCellLayout))) {
*aInstancePtr = (void*) (nsITableCellLayout *)this;
*aInstancePtr = NS_STATIC_CAST(nsITableCellLayout*, this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIPercentHeightObserver))) {
*aInstancePtr = (void*) (nsIPercentHeightObserver *)this;
*aInstancePtr = NS_STATIC_CAST(nsIPercentHeightObserver*, this);
return NS_OK;
}

Просмотреть файл

@ -199,19 +199,17 @@ nsTableFrame::nsTableFrame(nsStyleContext* aContext)
NS_IMPL_ADDREF_INHERITED(nsTableFrame, nsHTMLContainerFrame)
NS_IMPL_RELEASE_INHERITED(nsTableFrame, nsHTMLContainerFrame)
nsresult nsTableFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
NS_IMETHODIMP
nsTableFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(NS_GET_IID(nsITableLayout)))
{ // note there is no addref here, frames are not addref'd
*aInstancePtr = (void*)(nsITableLayout*)this;
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsITableLayout))) {
*aInstancePtr = NS_STATIC_CAST(nsITableLayout*, this);
return NS_OK;
}
else {
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP

Просмотреть файл

@ -165,15 +165,13 @@ nsTableOuterFrame::~nsTableOuterFrame()
{
}
nsresult nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
NS_IMETHODIMP
nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsITableLayout)))
{ // note there is no addref here, frames are not addref'd
*aInstancePtr = (void*)(nsITableLayout*)this;
if (aIID.Equals(NS_GET_IID(nsITableLayout))) {
*aInstancePtr = NS_STATIC_CAST(nsITableLayout*, this);
return NS_OK;
}

Просмотреть файл

@ -75,26 +75,22 @@ nsrefcnt nsTableRowGroupFrame::Release(void)
return 1;//implementation of nsLineIterator
}
nsresult
NS_IMETHODIMP
nsTableRowGroupFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
static NS_DEFINE_IID(kITableRowGroupIID, NS_ITABLEROWGROUPFRAME_IID);
if (aIID.Equals(kITableRowGroupIID)) {
*aInstancePtr = (void*)this;
return NS_OK;
}
else if (aIID.Equals(NS_GET_IID(nsILineIteratorNavigator)))
{ // note there is no addref here, frames are not addref'd
*aInstancePtr = (void*)(nsILineIteratorNavigator*)this;
if (aIID.Equals(NS_GET_IID(nsILineIteratorNavigator))) {
*aInstancePtr = NS_STATIC_CAST(nsILineIteratorNavigator*, this);
return NS_OK;
}
else {
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
/* virtual */ PRBool

Просмотреть файл

@ -65,11 +65,10 @@ NS_IMPL_RELEASE(nsMenuBoxObject)
NS_IMETHODIMP
nsMenuBoxObject::QueryInterface(REFNSIID iid, void** aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
NS_PRECONDITION(aResult, "null out param");
if (iid.Equals(NS_GET_IID(nsIMenuBoxObject))) {
*aResult = (nsIMenuBoxObject*)this;
*aResult = NS_STATIC_CAST(nsIMenuBoxObject*, this);
NS_ADDREF(this);
return NS_OK;
}

Просмотреть файл

@ -70,9 +70,10 @@ NS_NewScrollbarButtonFrame (nsIPresShell* aPresShell, nsStyleContext* aContext)
NS_IMETHODIMP
nsScrollbarButtonFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsITimerCallback))) {
*aInstancePtr = (void*)(nsITimerCallback*) this;
NS_ADDREF_THIS();
*aInstancePtr = NS_STATIC_CAST(nsITimerCallback*, this);
return NS_OK;
}

Просмотреть файл

@ -106,8 +106,7 @@ NS_IMPL_ISUPPORTS1(nsDeviceContextSpecBeOS, nsIDeviceContextSpec)
NS_IMETHODIMP nsDeviceContextSpecBeOS :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr)
return NS_ERROR_NULL_POINTER;
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kIDeviceContextSpecIID))
{
@ -138,7 +137,8 @@ NS_IMETHODIMP nsDeviceContextSpecBeOS :: QueryInterface(REFNSIID aIID, void** aI
return NS_OK;
}
return NS_NOINTERFACE;
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}
NS_IMPL_ADDREF(nsDeviceContextSpecBeOS)

Просмотреть файл

@ -221,8 +221,7 @@ nsresult nsDeviceContextSpecOS2::SetPrintSettingsFromDevMode(nsIPrintSettings* a
NS_IMETHODIMP nsDeviceContextSpecOS2 :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr)
return NS_ERROR_NULL_POINTER;
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kIDeviceContextSpecIID))
{
@ -243,7 +242,8 @@ NS_IMETHODIMP nsDeviceContextSpecOS2 :: QueryInterface(REFNSIID aIID, void** aIn
return NS_OK;
}
return NS_NOINTERFACE;
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}
NS_IMPL_ADDREF(nsDeviceContextSpecOS2)

Просмотреть файл

@ -756,15 +756,14 @@ void nsWindow::GlobalMsgWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
//-------------------------------------------------------------------------
NS_IMPL_ADDREF(nsWindow)
NS_IMPL_RELEASE(nsWindow)
NS_IMETHODIMP nsWindow::QueryInterface(const nsIID& aIID, void** aInstancePtr)
NS_IMETHODIMP
nsWindow::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIKBStateControl))) {
*aInstancePtr = (void*) ((nsIKBStateControl*)this);
NS_ADDREF((nsBaseWidget*)this);
*aInstancePtr = NS_STATIC_CAST(nsIKBStateControl*, this);
NS_ADDREF(NS_STATIC_CAST(nsBaseWidget*, this));
return NS_OK;
}