diff --git a/mozilla/rdf/src/nsMemoryDataSource.cpp b/mozilla/rdf/src/nsMemoryDataSource.cpp index 10aea420f2e..9c2fb5a4a28 100644 --- a/mozilla/rdf/src/nsMemoryDataSource.cpp +++ b/mozilla/rdf/src/nsMemoryDataSource.cpp @@ -186,8 +186,7 @@ public: virtual PRBool Equals(const nsHashKey* aKey) const { NodeHashKey* that; - //if (! (that = dynamic_cast(aKey))) - if (! (that = (NodeHashKey*)(aKey))) + if (! (that = NS_DYNAMIC_CAST(NodeHashKey*, aKey))) return PR_FALSE; return (that->mNode == this->mNode); diff --git a/mozilla/rdf/src/nsRDFElement.cpp b/mozilla/rdf/src/nsRDFElement.cpp index 50e80668a95..d5b015a1c83 100644 --- a/mozilla/rdf/src/nsRDFElement.cpp +++ b/mozilla/rdf/src/nsRDFElement.cpp @@ -756,7 +756,7 @@ nsRDFElement::ChildCount(PRInt32& aResult) const { nsresult rv; if (!mChildren) { - nsRDFElement* unconstThis = const_cast(this); + nsRDFElement* unconstThis = NS_CONST_CAST(nsRDFElement*, this); if (NS_FAILED(rv = unconstThis->GenerateChildren())) return rv; } @@ -770,7 +770,7 @@ nsRDFElement::ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { nsresult rv; if (!mChildren) { - nsRDFElement* unconstThis = const_cast(this); + nsRDFElement* unconstThis = NS_CONST_CAST(nsRDFElement*, this); if (NS_FAILED(rv = unconstThis->GenerateChildren())) return rv; } @@ -787,8 +787,15 @@ nsRDFElement::ChildAt(PRInt32 aIndex, nsIContent*& aResult) const NS_IMETHODIMP nsRDFElement::IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const { - PR_ASSERT(0); - return NS_ERROR_NOT_IMPLEMENTED; + nsresult rv; + if (! mChildren) { + nsRDFElement* unconstThis = NS_CONST_CAST(nsRDFElement*, this); + if (NS_FAILED(rv = unconstThis->GenerateChildren())) + return rv; + } + + aResult = mChildren->IndexOf(aPossibleChild); + return NS_OK; } NS_IMETHODIMP @@ -1368,7 +1375,7 @@ nsRDFElement::CreateChild(nsIRDFNode* value, child->mResource = value; NS_ADDREF(child->mResource); - child->mParent = NS_STATIC_CAST(nsIContent*, const_cast(this)); + child->mParent = NS_STATIC_CAST(nsIContent*, NS_CONST_CAST(nsRDFElement*, this)); NS_ADDREF(child->mParent); result = child; @@ -1400,7 +1407,7 @@ nsRDFElement::CreateChild(nsIRDFNode* property, NS_ADDREF(child); child->mDocument = mDocument; child->mResource = property; - child->mParent = NS_STATIC_CAST(nsIContent*, const_cast(this)); + child->mParent = NS_STATIC_CAST(nsIContent*, NS_CONST_CAST(nsRDFElement*, this)); NS_ADDREF(child->mDocument); NS_ADDREF(child->mResource); @@ -1453,7 +1460,7 @@ nsRDFElement::CreateChild(nsIRDFNode* property, grandchild->mDocument = mDocument; grandchild->mResource = value; - grandchild->mParent = NS_STATIC_CAST(nsIContent*, const_cast(child)); + grandchild->mParent = NS_STATIC_CAST(nsIContent*, NS_CONST_CAST(nsRDFElement*, child)); NS_ADDREF(grandchild->mDocument); NS_ADDREF(grandchild->mResource); diff --git a/mozilla/rdf/src/nsRDFResourceManager.cpp b/mozilla/rdf/src/nsRDFResourceManager.cpp index 204ed66bde1..c1df30b662e 100644 --- a/mozilla/rdf/src/nsRDFResourceManager.cpp +++ b/mozilla/rdf/src/nsRDFResourceManager.cpp @@ -106,8 +106,7 @@ public: virtual PRBool Equals(const nsHashKey* aKey) const { ResourceHashKey* that; - //if (! (that = dynamic_cast(aKey))) - if (! (that = (ResourceHashKey*)(aKey))) + if (! (that = NS_DYNAMIC_CAST(ResourceHashKey*, aKey))) return PR_FALSE; return (that->mResource == this->mResource);