if (NS_FAILED(cN->ChildAt(--numChildren,*getter_AddRefs(cLastChild))))
if (NS_FAILED(cN->ChildAt(--numChildren, getter_AddRefs(cLastChild))))
nsresult nsContentIterator::PrevNode(nsCOMPtr<nsIContent> *ioNextNode, nsVoidArray *aIndexes){  if (!ioNextNode)    return NS_ERROR_NULL_POINTER;  nsCOMPtr<nsIContent> cN = *ioNextNode;     if (mPre)  // if we are a Pre-order iterator, use pre-order  {    nsCOMPtr<nsIContent> cSibling;    nsCOMPtr<nsIContent> parent;    PRInt32              indx;      // get prev sibling if there is one    if (NS_FAILED(cN->GetParent(*getter_AddRefs(parent))))      return NS_ERROR_FAILURE;    // get the cached index    if (aIndexes)    {      NS_ASSERTION(aIndexes->Count() > 0, "ContentIterator stack underflow");      // use the last entry on the Indexes array for the current index      indx = NS_PTR_TO_INT32((*aIndexes)[aIndexes->Count()-1]);    }    else indx = mCachedIndex;    // reverify that the index of the current node hasn't changed.    // not super cheap, but a lot cheaper than IndexOf(), and still O(1).    // ignore result this time - the index may now be out of range.    if (indx >= 0)      (void) parent->ChildAt(indx, *getter_AddRefs(cSibling));    if (cSibling != cN)    {      // someone changed our index - find the new index the painful way      if (NS_FAILED(parent->IndexOf(cN,indx)))        return NS_ERROR_FAILURE;    }    // indx is now canonically correct    if (indx && NS_SUCCEEDED(parent->ChildAt(--indx,*getter_AddRefs(cSibling))) && cSibling)    {      // update cache      if (aIndexes)      {        // replace an entry on the index stack        aIndexes->ReplaceElementAt(NS_INT32_TO_PTR(indx),aIndexes->Count()-1);      }      else mCachedIndex = indx;            // prev node is siblings "deep right" child      *ioNextNode = GetDeepLastChild(cSibling, aIndexes);       return NS_OK;    }      // else it's the parent    // update cache    if (aIndexes)    {      // pop an entry off the index stack      aIndexes->RemoveElementAt(aIndexes->Count()-1);    }    else mCachedIndex = 0;   // this might be wrong, but we are better off guessing    *ioNextNode = parent;  }  else  // post-order  {    nsCOMPtr<nsIContent> cLastChild;    PRInt32 numChildren;      cN->ChildCount(numChildren);      // if it has children then prev node is last child    if (numChildren)    {      if (NS_FAILED(cN->ChildAt(--numChildren,*getter_AddRefs(cLastChild))))        return NS_ERROR_FAILURE;      if (!cLastChild)        return NS_ERROR_FAILURE;      // update cache      if (aIndexes)      {        // push an entry on the index stack        aIndexes->AppendElement(NS_INT32_TO_PTR(numChildren));      }      else mCachedIndex = numChildren;            *ioNextNode = cLastChild;      return NS_OK;    }      // else prev sibling is previous    return GetPrevSibling(cN, ioNextNode, aIndexes);  }  return NS_OK;}