summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/parser/cxfa_arraynodelist.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_arraynodelist.h2
-rw-r--r--xfa/fxfa/parser/cxfa_attachnodelist.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_attachnodelist.h2
-rw-r--r--xfa/fxfa/parser/cxfa_list.h2
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_node.h2
-rw-r--r--xfa/fxfa/parser/cxfa_treelist.cpp7
8 files changed, 15 insertions, 14 deletions
diff --git a/xfa/fxfa/parser/cxfa_arraynodelist.cpp b/xfa/fxfa/parser/cxfa_arraynodelist.cpp
index 3b32d8f022..9ea36d3c24 100644
--- a/xfa/fxfa/parser/cxfa_arraynodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_arraynodelist.cpp
@@ -21,8 +21,8 @@ void CXFA_ArrayNodeList::SetArrayNodeList(
m_array = srcArray;
}
-int32_t CXFA_ArrayNodeList::GetLength() {
- return pdfium::CollectionSize<int32_t>(m_array);
+size_t CXFA_ArrayNodeList::GetLength() {
+ return m_array.size();
}
bool CXFA_ArrayNodeList::Append(CXFA_Node* pNode) {
diff --git a/xfa/fxfa/parser/cxfa_arraynodelist.h b/xfa/fxfa/parser/cxfa_arraynodelist.h
index 0ebe0c6af6..caee762e29 100644
--- a/xfa/fxfa/parser/cxfa_arraynodelist.h
+++ b/xfa/fxfa/parser/cxfa_arraynodelist.h
@@ -20,7 +20,7 @@ class CXFA_ArrayNodeList : public CXFA_TreeList {
~CXFA_ArrayNodeList() override;
// From CXFA_TreeList.
- int32_t GetLength() override;
+ 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;
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
index 0a9be2ed4a..3666b99bd4 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
@@ -14,7 +14,7 @@ CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument,
m_pAttachNode = pAttachNode;
}
-int32_t CXFA_AttachNodeList::GetLength() {
+size_t CXFA_AttachNodeList::GetLength() {
return m_pAttachNode->CountChildren(
XFA_Element::Unknown,
m_pAttachNode->GetElementType() == XFA_Element::Subform);
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.h b/xfa/fxfa/parser/cxfa_attachnodelist.h
index a657150f43..390ea041b9 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.h
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.h
@@ -17,7 +17,7 @@ class CXFA_AttachNodeList : public CXFA_TreeList {
CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode);
// From CXFA_TreeList.
- int32_t GetLength() override;
+ 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;
diff --git a/xfa/fxfa/parser/cxfa_list.h b/xfa/fxfa/parser/cxfa_list.h
index 5736747dba..953e861835 100644
--- a/xfa/fxfa/parser/cxfa_list.h
+++ b/xfa/fxfa/parser/cxfa_list.h
@@ -17,7 +17,7 @@ class CXFA_List : public CXFA_Object {
public:
~CXFA_List() override;
- virtual int32_t GetLength() = 0;
+ 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;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index d7d187d168..f6f2675c29 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -784,17 +784,17 @@ CXFA_Node* CXFA_Node::GetModelNode() {
}
}
-int32_t CXFA_Node::CountChildren(XFA_Element eType, bool bOnlyChild) {
- int32_t iCount = 0;
+size_t CXFA_Node::CountChildren(XFA_Element eType, bool bOnlyChild) {
+ size_t count = 0;
for (CXFA_Node* pNode = m_pChild; pNode;
pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pNode->GetElementType() != eType && eType != XFA_Element::Unknown)
continue;
if (bOnlyChild && HasProperty(pNode->GetElementType()))
continue;
- ++iCount;
+ ++count;
}
- return iCount;
+ return count;
}
CXFA_Node* CXFA_Node::GetChildInternal(int32_t index,
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 794e5fc032..e6683b24dc 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -154,7 +154,7 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* GetModelNode();
void UpdateNameHash();
- int32_t CountChildren(XFA_Element eType, bool bOnlyChild);
+ size_t CountChildren(XFA_Element eType, bool bOnlyChild);
template <typename T>
T* GetChild(int32_t index, XFA_Element eType, bool bOnlyChild) {
diff --git a/xfa/fxfa/parser/cxfa_treelist.cpp b/xfa/fxfa/parser/cxfa_treelist.cpp
index 754c80d661..941020fe27 100644
--- a/xfa/fxfa/parser/cxfa_treelist.cpp
+++ b/xfa/fxfa/parser/cxfa_treelist.cpp
@@ -11,6 +11,7 @@
#include "core/fxcrt/fx_extension.h"
#include "fxjs/cfxjse_engine.h"
#include "fxjs/xfa/cjx_treelist.h"
+#include "third_party/base/numerics/safe_conversions.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_list.h"
#include "xfa/fxfa/parser/cxfa_node.h"
@@ -26,9 +27,9 @@ CXFA_TreeList::~CXFA_TreeList() {}
CXFA_Node* CXFA_TreeList::NamedItem(const WideStringView& wsName) {
uint32_t dwHashCode = FX_HashCode_GetW(wsName, false);
- int32_t iCount = GetLength();
- for (int32_t i = 0; i < iCount; i++) {
- CXFA_Node* ret = Item(i);
+ size_t count = GetLength();
+ for (size_t i = 0; i < count; i++) {
+ CXFA_Node* ret = Item(pdfium::base::checked_cast<int32_t>(i));
if (dwHashCode == ret->GetNameHash())
return ret;
}