Remove unused return values from CXFA_Node

This CL removes the unused return values from InsertChild and
RemoveChild methods in CXFA_Node.

Bug: chromium:807863
Change-Id: Iac468afc5c48f51e7df3ea12d11b128a0ac124ea
Reviewed-on: https://pdfium-review.googlesource.com/25670
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
diff --git a/xfa/fxfa/parser/cxfa_arraynodelist.cpp b/xfa/fxfa/parser/cxfa_arraynodelist.cpp
index 9eaf9a6..8bb200e 100644
--- a/xfa/fxfa/parser/cxfa_arraynodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_arraynodelist.cpp
@@ -25,12 +25,11 @@
   return m_array.size();
 }
 
-bool CXFA_ArrayNodeList::Append(CXFA_Node* pNode) {
+void CXFA_ArrayNodeList::Append(CXFA_Node* pNode) {
   m_array.push_back(pNode);
-  return true;
 }
 
-bool CXFA_ArrayNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
+void CXFA_ArrayNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
   if (!pBeforeNode) {
     m_array.push_back(pNewNode);
   } else {
@@ -38,14 +37,12 @@
     if (it != m_array.end())
       m_array.insert(it, pNewNode);
   }
-  return true;
 }
 
-bool CXFA_ArrayNodeList::Remove(CXFA_Node* pNode) {
+void CXFA_ArrayNodeList::Remove(CXFA_Node* pNode) {
   auto it = std::find(m_array.begin(), m_array.end(), pNode);
   if (it != m_array.end())
     m_array.erase(it);
-  return true;
 }
 
 CXFA_Node* CXFA_ArrayNodeList::Item(size_t index) {
diff --git a/xfa/fxfa/parser/cxfa_arraynodelist.h b/xfa/fxfa/parser/cxfa_arraynodelist.h
index 346b206..dc798bc 100644
--- a/xfa/fxfa/parser/cxfa_arraynodelist.h
+++ b/xfa/fxfa/parser/cxfa_arraynodelist.h
@@ -21,9 +21,9 @@
 
   // From CXFA_TreeList.
   size_t GetLength() override;
-  bool Append(CXFA_Node* pNode) override;
-  bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
-  bool Remove(CXFA_Node* pNode) override;
+  void Append(CXFA_Node* pNode) override;
+  void Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
+  void Remove(CXFA_Node* pNode) override;
   CXFA_Node* Item(size_t iIndex) override;
 
   void SetArrayNodeList(const std::vector<CXFA_Node*>& srcArray);
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
index f1fbfa7..4e6a678 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
@@ -21,24 +21,24 @@
       m_pAttachNode->GetElementType() == XFA_Element::Subform);
 }
 
-bool CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
+void CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
   CXFA_Node* pParent = pNode->GetParent();
   if (pParent)
     pParent->RemoveChild(pNode, true);
 
-  return m_pAttachNode->InsertChild(pNode, nullptr);
+  m_pAttachNode->InsertChild(pNode, nullptr);
 }
 
-bool CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
+void CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
   CXFA_Node* pParent = pNewNode->GetParent();
   if (pParent)
     pParent->RemoveChild(pNewNode, true);
 
-  return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
+  m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
 }
 
-bool CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
-  return m_pAttachNode->RemoveChild(pNode, true);
+void CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
+  m_pAttachNode->RemoveChild(pNode, true);
 }
 
 CXFA_Node* CXFA_AttachNodeList::Item(size_t index) {
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.h b/xfa/fxfa/parser/cxfa_attachnodelist.h
index f0df2bb..cb41b73 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.h
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.h
@@ -18,9 +18,9 @@
 
   // From CXFA_TreeList.
   size_t GetLength() override;
-  bool Append(CXFA_Node* pNode) override;
-  bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
-  bool Remove(CXFA_Node* pNode) override;
+  void Append(CXFA_Node* pNode) override;
+  void Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
+  void Remove(CXFA_Node* pNode) override;
   CXFA_Node* Item(size_t iIndex) override;
 
  private:
diff --git a/xfa/fxfa/parser/cxfa_list.h b/xfa/fxfa/parser/cxfa_list.h
index de9406d..66182863 100644
--- a/xfa/fxfa/parser/cxfa_list.h
+++ b/xfa/fxfa/parser/cxfa_list.h
@@ -18,9 +18,9 @@
   ~CXFA_List() override;
 
   virtual size_t GetLength() = 0;
-  virtual bool Append(CXFA_Node* pNode) = 0;
-  virtual bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0;
-  virtual bool Remove(CXFA_Node* pNode) = 0;
+  virtual void Append(CXFA_Node* pNode) = 0;
+  virtual void Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0;
+  virtual void Remove(CXFA_Node* pNode) = 0;
   virtual CXFA_Node* Item(size_t iIndex) = 0;
 
  protected:
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index be56b41..9af2b2e 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1118,8 +1118,8 @@
   return nullptr;
 }
 
-int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) {
-  ASSERT(!pNode->m_pNext);
+void CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) {
+  ASSERT(!pNode->parent_);
   pNode->parent_ = this;
 
   bool ret = m_pDocument->RemovePurgeNode(pNode);
@@ -1127,9 +1127,9 @@
   (void)ret;  // Avoid unused variable warning.
 
   if (!m_pChild || index == 0) {
-    if (index > 0) {
-      return -1;
-    }
+    if (index > 0)
+      return;
+
     pNode->m_pNext = m_pChild;
     m_pChild = pNode;
     index = 0;
@@ -1138,21 +1138,22 @@
   } else {
     CXFA_Node* pPrev = m_pChild;
     int32_t iCount = 0;
-    while (++iCount != index && pPrev->m_pNext) {
+    while (++iCount != index && pPrev->m_pNext)
       pPrev = pPrev->m_pNext;
-    }
-    if (index > 0 && index != iCount) {
-      return -1;
-    }
+
+    if (index > 0 && index != iCount)
+      return;
+
     pNode->m_pNext = pPrev->m_pNext;
     pPrev->m_pNext = pNode;
     index = iCount;
   }
-  if (!pNode->m_pNext) {
+  if (!pNode->m_pNext)
     m_pLastChild = pNode;
-  }
+
   ASSERT(m_pLastChild);
   ASSERT(!m_pLastChild->m_pNext);
+
   pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren);
   CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (pNotify)
@@ -1160,18 +1161,19 @@
 
   if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
     ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFX_XMLNode::Parent));
+
     m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index);
     pNode->ClearFlag(XFA_NodeFlag_OwnXMLNode);
   }
-  return index;
 }
 
-bool CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
+void CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
   if (!pNode || pNode->parent_ ||
       (pBeforeNode && pBeforeNode->parent_ != this)) {
     NOTREACHED();
-    return false;
+    return;
   }
+
   bool ret = m_pDocument->RemovePurgeNode(pNode);
   ASSERT(ret);
   (void)ret;  // Avoid unused variable warning.
@@ -1198,8 +1200,10 @@
   if (!pNode->m_pNext) {
     m_pLastChild = pNode;
   }
+
   ASSERT(m_pLastChild);
   ASSERT(!m_pLastChild->m_pNext);
+
   pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren);
   CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (pNotify)
@@ -1210,7 +1214,6 @@
     m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex);
     pNode->ClearFlag(XFA_NodeFlag_OwnXMLNode);
   }
-  return true;
 }
 
 CXFA_Node* CXFA_Node::Deprecated_GetPrevSibling() {
@@ -1226,10 +1229,10 @@
   return nullptr;
 }
 
-bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
+void CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
   if (!pNode || pNode->parent_ != this) {
     NOTREACHED();
-    return false;
+    return;
   }
 
   if (m_pChild == pNode) {
@@ -1246,6 +1249,7 @@
   pNode->parent_ = nullptr;
 
   ASSERT(!m_pLastChild || !m_pLastChild->m_pNext);
+
   OnRemoved(bNotify);
   pNode->SetFlag(XFA_NodeFlag_HasRemovedChildren, true);
   m_pDocument->AddPurgeNode(pNode);
@@ -1277,7 +1281,6 @@
     }
     pNode->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
   }
-  return true;
 }
 
 CXFA_Node* CXFA_Node::GetFirstChildByName(const WideStringView& wsName) const {
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 27bdab0..c3b2fd1 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -172,9 +172,9 @@
     return static_cast<T*>(GetChildInternal(index, eType, bOnlyChild));
   }
 
-  int32_t InsertChild(int32_t index, CXFA_Node* pNode);
-  bool InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode);
-  bool RemoveChild(CXFA_Node* pNode, bool bNotify);
+  void InsertChild(int32_t index, CXFA_Node* pNode);
+  void InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode);
+  void RemoveChild(CXFA_Node* pNode, bool bNotify);
 
   CXFA_Node* Clone(bool bRecursive);