From a2c461d17bda7ed73f405b5dc304d8898d1647f9 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Thu, 6 May 1999 06:34:07 +0000 Subject: [PATCH] Fix compiler warnings. Make -pedantic build again. --- content/xul/content/src/nsXULAttributes.h | 2 +- content/xul/content/src/nsXULElement.cpp | 43 +++++++++---------- .../templates/src/nsXULTemplateBuilder.cpp | 16 +++---- rdf/content/src/nsRDFElement.cpp | 43 +++++++++---------- rdf/content/src/nsRDFGenericBuilder.cpp | 16 +++---- rdf/content/src/nsRDFMenuBuilder.cpp | 10 ----- rdf/content/src/nsRDFToolbarBuilder.cpp | 10 ----- rdf/content/src/nsRDFTreeBuilder.cpp | 10 ++--- rdf/content/src/nsXULAttributes.h | 2 +- rdf/content/src/nsXULElement.cpp | 43 +++++++++---------- rdf/content/src/nsXULTemplateBuilder.cpp | 16 +++---- 11 files changed, 94 insertions(+), 117 deletions(-) diff --git a/content/xul/content/src/nsXULAttributes.h b/content/xul/content/src/nsXULAttributes.h index 12948783455..aa4fd250f4b 100644 --- a/content/xul/content/src/nsXULAttributes.h +++ b/content/xul/content/src/nsXULAttributes.h @@ -145,7 +145,7 @@ public: PRInt32 Count() { return mAttributes.Count(); }; nsXULAttribute* ElementAt(PRInt32 i) { return (nsXULAttribute*)mAttributes.ElementAt(i); }; void AppendElement(nsXULAttribute* aElement) { mAttributes.AppendElement((void*)aElement); }; - void RemoveElementAt(PRInt32 index) { mAttributes.RemoveElementAt(index); }; + void RemoveElementAt(PRInt32 aIndex) { mAttributes.RemoveElementAt(aIndex); }; // Style Helpers nsresult GetClasses(nsVoidArray& aArray) const; diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 3b6cd044be7..4104e8b833a 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -338,9 +338,9 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag) mListenerManager(nsnull), mAttributes(nsnull), mContentsMustBeGenerated(PR_FALSE), - mInnerXULElement(nsnull), mBroadcastListeners(nsnull), - mBroadcaster(nsnull) + mBroadcaster(nsnull), + mInnerXULElement(nsnull) { NS_INIT_REFCNT(); NS_ADDREF(aTag); @@ -573,9 +573,9 @@ RDFElementImpl::GetChildNodes(nsIDOMNodeList** aChildNodes) PRInt32 count; if (NS_SUCCEEDED(rv = ChildCount(count))) { - for (PRInt32 index = 0; index < count; ++index) { + for (PRInt32 i = 0; i < count; ++i) { nsCOMPtr child; - rv = ChildAt(index, *getter_AddRefs(child)); + rv = ChildAt(i, *getter_AddRefs(child)); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get child"); if (NS_FAILED(rv)) break; @@ -1207,7 +1207,7 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject char buf[64]; char* p = buf; - if (tag.Length() >= sizeof(buf)) + if (tag.Length() >= PRInt32(sizeof buf)) p = new char[tag.Length() + 1]; aContext->AddNamedReference((void*) &mScriptObject, mScriptObject, buf); @@ -1378,7 +1378,7 @@ RDFElementImpl::SetDocument(nsIDocument* aDocument, PRBool aDeep) char buf[64]; char* p = buf; - if (tag.Length() >= sizeof(buf)) + if (tag.Length() >= PRInt32(sizeof buf)) p = new char[tag.Length() + 1]; context->AddNamedReference((void*) &mScriptObject, mScriptObject, buf); @@ -1595,9 +1595,9 @@ RDFElementImpl::RemoveChildAt(PRInt32 aIndex, PRBool aNotify) nsIContent* oldKid = (nsIContent *)mChildren->ElementAt(aIndex); if (nsnull != oldKid ) { nsIDocument* doc = mDocument; - PRBool rv = mChildren->RemoveElementAt(aIndex); + PRBool removeOk = mChildren->RemoveElementAt(aIndex); //nsRange::OwnerChildRemoved(this, aIndex, oldKid); - if (aNotify) { + if (aNotify && removeOk) { if (nsnull != doc) { doc->ContentRemoved(NS_STATIC_CAST(nsIStyledContent*, this), oldKid, aIndex); } @@ -1739,17 +1739,16 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID, // to unhook the old one. nsXULAttribute* attr; - PRBool successful = PR_FALSE; - PRInt32 index = 0; + PRInt32 i = 0; PRInt32 count = mAttributes->Count(); - while (index < count) { - attr = mAttributes->ElementAt(index); + while (i < count) { + attr = mAttributes->ElementAt(i); if ((aNameSpaceID == attr->mNameSpaceID) && (aName == attr->mName)) break; - index++; + i++; } - if (index < count) { + if (i < count) { attr->mValue = aValue; } else { // didn't find it @@ -1798,7 +1797,7 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID, if (mBroadcastListeners != nsnull) { count = mBroadcastListeners->Count(); - for (PRInt32 i = 0; i < count; i++) { + for (i = 0; i < count; i++) { XULBroadcastListener* xulListener = (XULBroadcastListener*)mBroadcastListeners->ElementAt(i); nsString aString; aName->ToString(aString); @@ -1927,9 +1926,9 @@ done: if (nsnull != mAttributes) { PRInt32 count = mAttributes->Count(); - PRInt32 index; - for (index = 0; index < count; index++) { - const nsXULAttribute* attr = (const nsXULAttribute*)mAttributes->ElementAt(index); + PRInt32 i; + for (i = 0; i < count; i++) { + const nsXULAttribute* attr = (const nsXULAttribute*)mAttributes->ElementAt(i); if (((attr->mNameSpaceID == aNameSpaceID) || (aNameSpaceID == kNameSpaceID_Unknown) || (aNameSpaceID == kNameSpaceID_None)) && @@ -1995,11 +1994,11 @@ RDFElementImpl::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNot PRBool successful = PR_FALSE; if (nsnull != mAttributes) { PRInt32 count = mAttributes->Count(); - PRInt32 index; - for (index = 0; index < count; index++) { - nsXULAttribute* attr = (nsXULAttribute*)mAttributes->ElementAt(index); + PRInt32 i; + for (i = 0; i < count; i++) { + nsXULAttribute* attr = (nsXULAttribute*)mAttributes->ElementAt(i); if ((attr->mNameSpaceID == aNameSpaceID) && (attr->mName == aName)) { - mAttributes->RemoveElementAt(index); + mAttributes->RemoveElementAt(i); NS_RELEASE(attr); successful = PR_TRUE; break; diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp index 178f46b4a4f..f808e004307 100644 --- a/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -1156,7 +1156,7 @@ RDFGenericBuilderImpl::FindWidgetRootElement(nsIContent* aElement, if (NS_FAILED(rv = element->GetTag(*getter_AddRefs(tag)))) return rv; - if (tag.get() == rootAtom) { + if (tag == rootAtom) { *aWidgetElement = element; NS_ADDREF(*aWidgetElement); return NS_OK; @@ -1199,7 +1199,7 @@ RDFGenericBuilderImpl::IsItemOrFolder(nsIContent* aElement) if (NS_FAILED(rv = aElement->GetTag(*getter_AddRefs(tag)))) return PR_FALSE; - if (tag.get() != itemAtom && tag.get() != folderAtom) + if (tag != itemAtom && tag != folderAtom) return PR_FALSE; return PR_TRUE; @@ -1231,7 +1231,7 @@ RDFGenericBuilderImpl::IsWidgetInsertionRootElement(nsIContent* element) return PR_FALSE; } - if (elementTag.get() != rootAtom) + if (elementTag != rootAtom) return PR_FALSE; // not the place to insert a child return PR_TRUE; @@ -1266,7 +1266,7 @@ RDFGenericBuilderImpl::IsContainmentProperty(nsIContent* aElement, nsIRDFResourc PRInt32 nameSpaceID; if (NS_FAILED(rv = element->GetNameSpaceID(nameSpaceID))) { NS_ERROR("unable to get element namespace"); - PR_FALSE; + return PR_FALSE; } if (nameSpaceID != kNameSpaceID_HTML) { @@ -1327,7 +1327,7 @@ RDFGenericBuilderImpl::IsContainer(nsIContent* aElement, nsIRDFResource* aResour while (1) { PRBool hasMore; - nsresult rv = arcs->HasMoreElements(&hasMore); + rv = arcs->HasMoreElements(&hasMore); NS_ASSERTION(NS_SUCCEEDED(rv), "severe error advancing cursor"); if (NS_FAILED(rv)) return PR_FALSE; @@ -1382,11 +1382,11 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement) } // The insertion root is _always_ open. - if (tag.get() == insertionAtom) + if (tag == insertionAtom) return PR_TRUE; // If it's not a widget folder item, then it's not open. - if (tag.get() != folderAtom) + if (tag != folderAtom) return PR_FALSE; nsAutoString value; @@ -1531,7 +1531,7 @@ RDFGenericBuilderImpl::CloseWidgetItem(nsIContent* aElement) if (NS_FAILED(rv = aElement->GetTag(*getter_AddRefs(tag)))) return rv; // XXX fatal - if (tag.get() == parentAtom) { + if (tag == parentAtom) { parentNode = dont_QueryInterface(aElement); rv = NS_OK; } diff --git a/rdf/content/src/nsRDFElement.cpp b/rdf/content/src/nsRDFElement.cpp index 3b6cd044be7..4104e8b833a 100644 --- a/rdf/content/src/nsRDFElement.cpp +++ b/rdf/content/src/nsRDFElement.cpp @@ -338,9 +338,9 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag) mListenerManager(nsnull), mAttributes(nsnull), mContentsMustBeGenerated(PR_FALSE), - mInnerXULElement(nsnull), mBroadcastListeners(nsnull), - mBroadcaster(nsnull) + mBroadcaster(nsnull), + mInnerXULElement(nsnull) { NS_INIT_REFCNT(); NS_ADDREF(aTag); @@ -573,9 +573,9 @@ RDFElementImpl::GetChildNodes(nsIDOMNodeList** aChildNodes) PRInt32 count; if (NS_SUCCEEDED(rv = ChildCount(count))) { - for (PRInt32 index = 0; index < count; ++index) { + for (PRInt32 i = 0; i < count; ++i) { nsCOMPtr child; - rv = ChildAt(index, *getter_AddRefs(child)); + rv = ChildAt(i, *getter_AddRefs(child)); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get child"); if (NS_FAILED(rv)) break; @@ -1207,7 +1207,7 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject char buf[64]; char* p = buf; - if (tag.Length() >= sizeof(buf)) + if (tag.Length() >= PRInt32(sizeof buf)) p = new char[tag.Length() + 1]; aContext->AddNamedReference((void*) &mScriptObject, mScriptObject, buf); @@ -1378,7 +1378,7 @@ RDFElementImpl::SetDocument(nsIDocument* aDocument, PRBool aDeep) char buf[64]; char* p = buf; - if (tag.Length() >= sizeof(buf)) + if (tag.Length() >= PRInt32(sizeof buf)) p = new char[tag.Length() + 1]; context->AddNamedReference((void*) &mScriptObject, mScriptObject, buf); @@ -1595,9 +1595,9 @@ RDFElementImpl::RemoveChildAt(PRInt32 aIndex, PRBool aNotify) nsIContent* oldKid = (nsIContent *)mChildren->ElementAt(aIndex); if (nsnull != oldKid ) { nsIDocument* doc = mDocument; - PRBool rv = mChildren->RemoveElementAt(aIndex); + PRBool removeOk = mChildren->RemoveElementAt(aIndex); //nsRange::OwnerChildRemoved(this, aIndex, oldKid); - if (aNotify) { + if (aNotify && removeOk) { if (nsnull != doc) { doc->ContentRemoved(NS_STATIC_CAST(nsIStyledContent*, this), oldKid, aIndex); } @@ -1739,17 +1739,16 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID, // to unhook the old one. nsXULAttribute* attr; - PRBool successful = PR_FALSE; - PRInt32 index = 0; + PRInt32 i = 0; PRInt32 count = mAttributes->Count(); - while (index < count) { - attr = mAttributes->ElementAt(index); + while (i < count) { + attr = mAttributes->ElementAt(i); if ((aNameSpaceID == attr->mNameSpaceID) && (aName == attr->mName)) break; - index++; + i++; } - if (index < count) { + if (i < count) { attr->mValue = aValue; } else { // didn't find it @@ -1798,7 +1797,7 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID, if (mBroadcastListeners != nsnull) { count = mBroadcastListeners->Count(); - for (PRInt32 i = 0; i < count; i++) { + for (i = 0; i < count; i++) { XULBroadcastListener* xulListener = (XULBroadcastListener*)mBroadcastListeners->ElementAt(i); nsString aString; aName->ToString(aString); @@ -1927,9 +1926,9 @@ done: if (nsnull != mAttributes) { PRInt32 count = mAttributes->Count(); - PRInt32 index; - for (index = 0; index < count; index++) { - const nsXULAttribute* attr = (const nsXULAttribute*)mAttributes->ElementAt(index); + PRInt32 i; + for (i = 0; i < count; i++) { + const nsXULAttribute* attr = (const nsXULAttribute*)mAttributes->ElementAt(i); if (((attr->mNameSpaceID == aNameSpaceID) || (aNameSpaceID == kNameSpaceID_Unknown) || (aNameSpaceID == kNameSpaceID_None)) && @@ -1995,11 +1994,11 @@ RDFElementImpl::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNot PRBool successful = PR_FALSE; if (nsnull != mAttributes) { PRInt32 count = mAttributes->Count(); - PRInt32 index; - for (index = 0; index < count; index++) { - nsXULAttribute* attr = (nsXULAttribute*)mAttributes->ElementAt(index); + PRInt32 i; + for (i = 0; i < count; i++) { + nsXULAttribute* attr = (nsXULAttribute*)mAttributes->ElementAt(i); if ((attr->mNameSpaceID == aNameSpaceID) && (attr->mName == aName)) { - mAttributes->RemoveElementAt(index); + mAttributes->RemoveElementAt(i); NS_RELEASE(attr); successful = PR_TRUE; break; diff --git a/rdf/content/src/nsRDFGenericBuilder.cpp b/rdf/content/src/nsRDFGenericBuilder.cpp index 178f46b4a4f..f808e004307 100644 --- a/rdf/content/src/nsRDFGenericBuilder.cpp +++ b/rdf/content/src/nsRDFGenericBuilder.cpp @@ -1156,7 +1156,7 @@ RDFGenericBuilderImpl::FindWidgetRootElement(nsIContent* aElement, if (NS_FAILED(rv = element->GetTag(*getter_AddRefs(tag)))) return rv; - if (tag.get() == rootAtom) { + if (tag == rootAtom) { *aWidgetElement = element; NS_ADDREF(*aWidgetElement); return NS_OK; @@ -1199,7 +1199,7 @@ RDFGenericBuilderImpl::IsItemOrFolder(nsIContent* aElement) if (NS_FAILED(rv = aElement->GetTag(*getter_AddRefs(tag)))) return PR_FALSE; - if (tag.get() != itemAtom && tag.get() != folderAtom) + if (tag != itemAtom && tag != folderAtom) return PR_FALSE; return PR_TRUE; @@ -1231,7 +1231,7 @@ RDFGenericBuilderImpl::IsWidgetInsertionRootElement(nsIContent* element) return PR_FALSE; } - if (elementTag.get() != rootAtom) + if (elementTag != rootAtom) return PR_FALSE; // not the place to insert a child return PR_TRUE; @@ -1266,7 +1266,7 @@ RDFGenericBuilderImpl::IsContainmentProperty(nsIContent* aElement, nsIRDFResourc PRInt32 nameSpaceID; if (NS_FAILED(rv = element->GetNameSpaceID(nameSpaceID))) { NS_ERROR("unable to get element namespace"); - PR_FALSE; + return PR_FALSE; } if (nameSpaceID != kNameSpaceID_HTML) { @@ -1327,7 +1327,7 @@ RDFGenericBuilderImpl::IsContainer(nsIContent* aElement, nsIRDFResource* aResour while (1) { PRBool hasMore; - nsresult rv = arcs->HasMoreElements(&hasMore); + rv = arcs->HasMoreElements(&hasMore); NS_ASSERTION(NS_SUCCEEDED(rv), "severe error advancing cursor"); if (NS_FAILED(rv)) return PR_FALSE; @@ -1382,11 +1382,11 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement) } // The insertion root is _always_ open. - if (tag.get() == insertionAtom) + if (tag == insertionAtom) return PR_TRUE; // If it's not a widget folder item, then it's not open. - if (tag.get() != folderAtom) + if (tag != folderAtom) return PR_FALSE; nsAutoString value; @@ -1531,7 +1531,7 @@ RDFGenericBuilderImpl::CloseWidgetItem(nsIContent* aElement) if (NS_FAILED(rv = aElement->GetTag(*getter_AddRefs(tag)))) return rv; // XXX fatal - if (tag.get() == parentAtom) { + if (tag == parentAtom) { parentNode = dont_QueryInterface(aElement); rv = NS_OK; } diff --git a/rdf/content/src/nsRDFMenuBuilder.cpp b/rdf/content/src/nsRDFMenuBuilder.cpp index 1b12b838029..09cc8537776 100644 --- a/rdf/content/src/nsRDFMenuBuilder.cpp +++ b/rdf/content/src/nsRDFMenuBuilder.cpp @@ -53,16 +53,6 @@ //////////////////////////////////////////////////////////////////////// -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, child); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Columns); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Column); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Folder); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Title); - -DEFINE_RDF_VOCAB(RDF_NAMESPACE_URI, RDF, child); - -//////////////////////////////////////////////////////////////////////// - static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID); static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID); static NS_DEFINE_IID(kINameSpaceManagerIID, NS_INAMESPACEMANAGER_IID); diff --git a/rdf/content/src/nsRDFToolbarBuilder.cpp b/rdf/content/src/nsRDFToolbarBuilder.cpp index 6cb070a0763..c291048da92 100644 --- a/rdf/content/src/nsRDFToolbarBuilder.cpp +++ b/rdf/content/src/nsRDFToolbarBuilder.cpp @@ -54,16 +54,6 @@ //////////////////////////////////////////////////////////////////////// -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, child); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Columns); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Column); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Folder); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Title); - -DEFINE_RDF_VOCAB(RDF_NAMESPACE_URI, RDF, child); - -//////////////////////////////////////////////////////////////////////// - static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID); static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID); static NS_DEFINE_IID(kINameSpaceManagerIID, NS_INAMESPACEMANAGER_IID); diff --git a/rdf/content/src/nsRDFTreeBuilder.cpp b/rdf/content/src/nsRDFTreeBuilder.cpp index a5c2b8ef6c9..cb03d851d20 100644 --- a/rdf/content/src/nsRDFTreeBuilder.cpp +++ b/rdf/content/src/nsRDFTreeBuilder.cpp @@ -1013,13 +1013,13 @@ RDFTreeBuilderImpl::OnRemoveChild(nsIDOMNode* aParent, nsIDOMNode* aOldChild) // If we get here, then they're trying to manipulate the DOM in // some way that doesn't translate into a sensible update to the RDF // graph. So, just whack the change into the content model - PRInt32 index; - rv = parent->IndexOf(child, index); + PRInt32 i; + rv = parent->IndexOf(child, i); if (NS_FAILED(rv)) return rv; - NS_ASSERTION(index >= 0, "child was already removed"); - if (index >= 0) { - rv = parent->RemoveChildAt(index, PR_TRUE); + NS_ASSERTION(i >= 0, "child was already removed"); + if (i >= 0) { + rv = parent->RemoveChildAt(i, PR_TRUE); NS_ASSERTION(NS_SUCCEEDED(rv), "error removing child from parent"); if (NS_FAILED(rv)) return rv; } diff --git a/rdf/content/src/nsXULAttributes.h b/rdf/content/src/nsXULAttributes.h index 12948783455..aa4fd250f4b 100644 --- a/rdf/content/src/nsXULAttributes.h +++ b/rdf/content/src/nsXULAttributes.h @@ -145,7 +145,7 @@ public: PRInt32 Count() { return mAttributes.Count(); }; nsXULAttribute* ElementAt(PRInt32 i) { return (nsXULAttribute*)mAttributes.ElementAt(i); }; void AppendElement(nsXULAttribute* aElement) { mAttributes.AppendElement((void*)aElement); }; - void RemoveElementAt(PRInt32 index) { mAttributes.RemoveElementAt(index); }; + void RemoveElementAt(PRInt32 aIndex) { mAttributes.RemoveElementAt(aIndex); }; // Style Helpers nsresult GetClasses(nsVoidArray& aArray) const; diff --git a/rdf/content/src/nsXULElement.cpp b/rdf/content/src/nsXULElement.cpp index 3b6cd044be7..4104e8b833a 100644 --- a/rdf/content/src/nsXULElement.cpp +++ b/rdf/content/src/nsXULElement.cpp @@ -338,9 +338,9 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag) mListenerManager(nsnull), mAttributes(nsnull), mContentsMustBeGenerated(PR_FALSE), - mInnerXULElement(nsnull), mBroadcastListeners(nsnull), - mBroadcaster(nsnull) + mBroadcaster(nsnull), + mInnerXULElement(nsnull) { NS_INIT_REFCNT(); NS_ADDREF(aTag); @@ -573,9 +573,9 @@ RDFElementImpl::GetChildNodes(nsIDOMNodeList** aChildNodes) PRInt32 count; if (NS_SUCCEEDED(rv = ChildCount(count))) { - for (PRInt32 index = 0; index < count; ++index) { + for (PRInt32 i = 0; i < count; ++i) { nsCOMPtr child; - rv = ChildAt(index, *getter_AddRefs(child)); + rv = ChildAt(i, *getter_AddRefs(child)); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get child"); if (NS_FAILED(rv)) break; @@ -1207,7 +1207,7 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject char buf[64]; char* p = buf; - if (tag.Length() >= sizeof(buf)) + if (tag.Length() >= PRInt32(sizeof buf)) p = new char[tag.Length() + 1]; aContext->AddNamedReference((void*) &mScriptObject, mScriptObject, buf); @@ -1378,7 +1378,7 @@ RDFElementImpl::SetDocument(nsIDocument* aDocument, PRBool aDeep) char buf[64]; char* p = buf; - if (tag.Length() >= sizeof(buf)) + if (tag.Length() >= PRInt32(sizeof buf)) p = new char[tag.Length() + 1]; context->AddNamedReference((void*) &mScriptObject, mScriptObject, buf); @@ -1595,9 +1595,9 @@ RDFElementImpl::RemoveChildAt(PRInt32 aIndex, PRBool aNotify) nsIContent* oldKid = (nsIContent *)mChildren->ElementAt(aIndex); if (nsnull != oldKid ) { nsIDocument* doc = mDocument; - PRBool rv = mChildren->RemoveElementAt(aIndex); + PRBool removeOk = mChildren->RemoveElementAt(aIndex); //nsRange::OwnerChildRemoved(this, aIndex, oldKid); - if (aNotify) { + if (aNotify && removeOk) { if (nsnull != doc) { doc->ContentRemoved(NS_STATIC_CAST(nsIStyledContent*, this), oldKid, aIndex); } @@ -1739,17 +1739,16 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID, // to unhook the old one. nsXULAttribute* attr; - PRBool successful = PR_FALSE; - PRInt32 index = 0; + PRInt32 i = 0; PRInt32 count = mAttributes->Count(); - while (index < count) { - attr = mAttributes->ElementAt(index); + while (i < count) { + attr = mAttributes->ElementAt(i); if ((aNameSpaceID == attr->mNameSpaceID) && (aName == attr->mName)) break; - index++; + i++; } - if (index < count) { + if (i < count) { attr->mValue = aValue; } else { // didn't find it @@ -1798,7 +1797,7 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID, if (mBroadcastListeners != nsnull) { count = mBroadcastListeners->Count(); - for (PRInt32 i = 0; i < count; i++) { + for (i = 0; i < count; i++) { XULBroadcastListener* xulListener = (XULBroadcastListener*)mBroadcastListeners->ElementAt(i); nsString aString; aName->ToString(aString); @@ -1927,9 +1926,9 @@ done: if (nsnull != mAttributes) { PRInt32 count = mAttributes->Count(); - PRInt32 index; - for (index = 0; index < count; index++) { - const nsXULAttribute* attr = (const nsXULAttribute*)mAttributes->ElementAt(index); + PRInt32 i; + for (i = 0; i < count; i++) { + const nsXULAttribute* attr = (const nsXULAttribute*)mAttributes->ElementAt(i); if (((attr->mNameSpaceID == aNameSpaceID) || (aNameSpaceID == kNameSpaceID_Unknown) || (aNameSpaceID == kNameSpaceID_None)) && @@ -1995,11 +1994,11 @@ RDFElementImpl::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNot PRBool successful = PR_FALSE; if (nsnull != mAttributes) { PRInt32 count = mAttributes->Count(); - PRInt32 index; - for (index = 0; index < count; index++) { - nsXULAttribute* attr = (nsXULAttribute*)mAttributes->ElementAt(index); + PRInt32 i; + for (i = 0; i < count; i++) { + nsXULAttribute* attr = (nsXULAttribute*)mAttributes->ElementAt(i); if ((attr->mNameSpaceID == aNameSpaceID) && (attr->mName == aName)) { - mAttributes->RemoveElementAt(index); + mAttributes->RemoveElementAt(i); NS_RELEASE(attr); successful = PR_TRUE; break; diff --git a/rdf/content/src/nsXULTemplateBuilder.cpp b/rdf/content/src/nsXULTemplateBuilder.cpp index 178f46b4a4f..f808e004307 100644 --- a/rdf/content/src/nsXULTemplateBuilder.cpp +++ b/rdf/content/src/nsXULTemplateBuilder.cpp @@ -1156,7 +1156,7 @@ RDFGenericBuilderImpl::FindWidgetRootElement(nsIContent* aElement, if (NS_FAILED(rv = element->GetTag(*getter_AddRefs(tag)))) return rv; - if (tag.get() == rootAtom) { + if (tag == rootAtom) { *aWidgetElement = element; NS_ADDREF(*aWidgetElement); return NS_OK; @@ -1199,7 +1199,7 @@ RDFGenericBuilderImpl::IsItemOrFolder(nsIContent* aElement) if (NS_FAILED(rv = aElement->GetTag(*getter_AddRefs(tag)))) return PR_FALSE; - if (tag.get() != itemAtom && tag.get() != folderAtom) + if (tag != itemAtom && tag != folderAtom) return PR_FALSE; return PR_TRUE; @@ -1231,7 +1231,7 @@ RDFGenericBuilderImpl::IsWidgetInsertionRootElement(nsIContent* element) return PR_FALSE; } - if (elementTag.get() != rootAtom) + if (elementTag != rootAtom) return PR_FALSE; // not the place to insert a child return PR_TRUE; @@ -1266,7 +1266,7 @@ RDFGenericBuilderImpl::IsContainmentProperty(nsIContent* aElement, nsIRDFResourc PRInt32 nameSpaceID; if (NS_FAILED(rv = element->GetNameSpaceID(nameSpaceID))) { NS_ERROR("unable to get element namespace"); - PR_FALSE; + return PR_FALSE; } if (nameSpaceID != kNameSpaceID_HTML) { @@ -1327,7 +1327,7 @@ RDFGenericBuilderImpl::IsContainer(nsIContent* aElement, nsIRDFResource* aResour while (1) { PRBool hasMore; - nsresult rv = arcs->HasMoreElements(&hasMore); + rv = arcs->HasMoreElements(&hasMore); NS_ASSERTION(NS_SUCCEEDED(rv), "severe error advancing cursor"); if (NS_FAILED(rv)) return PR_FALSE; @@ -1382,11 +1382,11 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement) } // The insertion root is _always_ open. - if (tag.get() == insertionAtom) + if (tag == insertionAtom) return PR_TRUE; // If it's not a widget folder item, then it's not open. - if (tag.get() != folderAtom) + if (tag != folderAtom) return PR_FALSE; nsAutoString value; @@ -1531,7 +1531,7 @@ RDFGenericBuilderImpl::CloseWidgetItem(nsIContent* aElement) if (NS_FAILED(rv = aElement->GetTag(*getter_AddRefs(tag)))) return rv; // XXX fatal - if (tag.get() == parentAtom) { + if (tag == parentAtom) { parentNode = dont_QueryInterface(aElement); rv = NS_OK; }