summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-08 10:55:57 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-08 10:55:57 -0800
commit51709bea3ce113df7d36a5fe6415036e26fc3236 (patch)
treeff2cc5da9de834bda8cbc5c92d45c9a5c00b21c3 /xfa
parent447b1f3ffc7e0df233d15300bbf8a85ce2bc7278 (diff)
downloadpdfium-51709bea3ce113df7d36a5fe6415036e26fc3236.tar.xz
Replace CFX_WideStringArray with std::vector
Minimalist changes with the tidying of the code to use better loop iterators as a follow-up. Review-Url: https://codereview.chromium.org/2556963004
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/css/fde_cssstyleselector.cpp8
-rw-r--r--xfa/fde/css/fde_cssstyleselector.h2
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp117
-rw-r--r--xfa/fde/xml/fde_xml_imp.h7
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.cpp23
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.h4
-rw-r--r--xfa/fgas/localization/fgas_locale.cpp15
-rw-r--r--xfa/fgas/localization/fgas_localeimp.h4
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp11
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp5
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp62
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h6
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp7
-rw-r--r--xfa/fxfa/parser/xfa_layout_itemlayout.cpp13
-rw-r--r--xfa/fxfa/parser/xfa_localevalue.cpp15
-rw-r--r--xfa/fxfa/xfa_ffdocview.h3
19 files changed, 180 insertions, 144 deletions
diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp
index 1bcd161f0c..117afcc7ab 100644
--- a/xfa/fde/css/fde_cssstyleselector.cpp
+++ b/xfa/fde/css/fde_cssstyleselector.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <memory>
+#include "third_party/base/stl_util.h"
#include "xfa/fde/css/fde_csscache.h"
#include "xfa/fde/css/fde_cssdeclaration.h"
#include "xfa/fde/css/fde_cssstylesheet.h"
@@ -1749,7 +1750,8 @@ IFDE_CSSParagraphStyle* CFDE_CSSComputedStyle::GetParagraphStyles() {
bool CFDE_CSSComputedStyle::GetCustomStyle(const CFX_WideStringC& wsName,
CFX_WideString& wsValue) const {
- for (int32_t i = m_CustomProperties.GetSize() - 2; i > -1; i -= 2) {
+ for (int32_t i = pdfium::CollectionSize<int32_t>(m_CustomProperties) - 2;
+ i > -1; i -= 2) {
if (wsName == m_CustomProperties[i]) {
wsValue = m_CustomProperties[i + 1];
return true;
@@ -1895,8 +1897,8 @@ void CFDE_CSSComputedStyle::SetLetterSpacing(
void CFDE_CSSComputedStyle::AddCustomStyle(const CFX_WideString& wsName,
const CFX_WideString& wsValue) {
- m_CustomProperties.Add(wsName);
- m_CustomProperties.Add(wsValue);
+ m_CustomProperties.push_back(wsName);
+ m_CustomProperties.push_back(wsValue);
}
CFDE_CSSInheritedData::CFDE_CSSInheritedData() {
diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h
index 0096b7a34a..81566a93b1 100644
--- a/xfa/fde/css/fde_cssstyleselector.h
+++ b/xfa/fde/css/fde_cssstyleselector.h
@@ -414,7 +414,7 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle,
IFX_MemoryAllocator* const m_pAllocator;
CFDE_CSSInheritedData m_InheritedData;
CFDE_CSSNonInheritedData m_NonInheritedData;
- CFX_WideStringArray m_CustomProperties;
+ std::vector<CFX_WideString> m_CustomProperties;
};
#endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index 7880804367..2bdaf5155f 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -11,6 +11,7 @@
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fgas/crt/fgas_codepage.h"
namespace {
@@ -416,8 +417,9 @@ void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream) {
} else {
ws.Format(L"<?%s", pInstruction->m_wsTarget.c_str());
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- CFX_WideStringArray& attributes = pInstruction->m_Attributes;
- int32_t i, iCount = attributes.GetSize();
+ std::vector<CFX_WideString>& attributes = pInstruction->m_Attributes;
+ int32_t i;
+ int32_t iCount = pdfium::CollectionSize<int32_t>(attributes);
CFX_WideString wsValue;
for (i = 0; i < iCount; i += 2) {
ws = L" ";
@@ -433,8 +435,8 @@ void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream) {
ws += L"\"";
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
- CFX_WideStringArray& targetdata = pInstruction->m_TargetData;
- iCount = targetdata.GetSize();
+ std::vector<CFX_WideString>& targetdata = pInstruction->m_TargetData;
+ iCount = pdfium::CollectionSize<int32_t>(targetdata);
for (i = 0; i < iCount; i++) {
ws = L" \"";
ws += targetdata[i];
@@ -450,8 +452,9 @@ void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream) {
ws = L"<";
ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- CFX_WideStringArray& attributes = ((CFDE_XMLElement*)pNode)->m_Attributes;
- int32_t iCount = attributes.GetSize();
+ std::vector<CFX_WideString>& attributes =
+ static_cast<CFDE_XMLElement*>(pNode)->m_Attributes;
+ int32_t iCount = pdfium::CollectionSize<int32_t>(attributes);
CFX_WideString wsValue;
for (int32_t i = 0; i < iCount; i += 2) {
ws = L" ";
@@ -536,25 +539,25 @@ FDE_XMLNODETYPE CFDE_XMLInstruction::GetType() const {
CFDE_XMLNode* CFDE_XMLInstruction::Clone(bool bRecursive) {
CFDE_XMLInstruction* pClone = new CFDE_XMLInstruction(m_wsTarget);
- if (!pClone) {
- return pClone;
- }
- pClone->m_Attributes.Copy(m_Attributes);
- pClone->m_TargetData.Copy(m_TargetData);
- if (bRecursive) {
+ if (!pClone)
+ return nullptr;
+
+ pClone->m_Attributes = m_Attributes;
+ pClone->m_TargetData = m_TargetData;
+ if (bRecursive)
CloneChildren(pClone);
- }
+
return pClone;
}
int32_t CFDE_XMLInstruction::CountAttributes() const {
- return m_Attributes.GetSize() / 2;
+ return pdfium::CollectionSize<int32_t>(m_Attributes) / 2;
}
bool CFDE_XMLInstruction::GetAttribute(int32_t index,
CFX_WideString& wsAttriName,
CFX_WideString& wsAttriValue) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
ASSERT(index > -1 && index < iCount / 2);
for (int32_t i = 0; i < iCount; i += 2) {
if (index == 0) {
@@ -568,7 +571,7 @@ bool CFDE_XMLInstruction::GetAttribute(int32_t index,
}
bool CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
return true;
@@ -580,7 +583,7 @@ bool CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const {
void CFDE_XMLInstruction::GetString(const FX_WCHAR* pwsAttriName,
CFX_WideString& wsAttriValue,
const FX_WCHAR* pwsDefValue) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
wsAttriValue = m_Attributes[i + 1];
@@ -593,7 +596,7 @@ void CFDE_XMLInstruction::GetString(const FX_WCHAR* pwsAttriName,
void CFDE_XMLInstruction::SetString(const CFX_WideString& wsAttriName,
const CFX_WideString& wsAttriValue) {
ASSERT(wsAttriName.GetLength() > 0);
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(wsAttriName) == 0) {
m_Attributes[i] = wsAttriName;
@@ -601,13 +604,13 @@ void CFDE_XMLInstruction::SetString(const CFX_WideString& wsAttriName,
return;
}
}
- m_Attributes.Add(wsAttriName);
- m_Attributes.Add(wsAttriValue);
+ m_Attributes.push_back(wsAttriName);
+ m_Attributes.push_back(wsAttriValue);
}
int32_t CFDE_XMLInstruction::GetInteger(const FX_WCHAR* pwsAttriName,
int32_t iDefValue) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
return FXSYS_wtoi(m_Attributes[i + 1].c_str());
@@ -625,7 +628,7 @@ void CFDE_XMLInstruction::SetInteger(const FX_WCHAR* pwsAttriName,
FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName,
FX_FLOAT fDefValue) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
return FXSYS_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr);
@@ -642,34 +645,37 @@ void CFDE_XMLInstruction::SetFloat(const FX_WCHAR* pwsAttriName,
}
void CFDE_XMLInstruction::RemoveAttribute(const FX_WCHAR* pwsAttriName) {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- m_Attributes.RemoveAt(i + 1);
- m_Attributes.RemoveAt(i);
+ m_Attributes.erase(m_Attributes.begin() + i,
+ m_Attributes.begin() + i + 2);
return;
}
}
}
int32_t CFDE_XMLInstruction::CountData() const {
- return m_TargetData.GetSize();
+ return pdfium::CollectionSize<int32_t>(m_TargetData);
}
bool CFDE_XMLInstruction::GetData(int32_t index, CFX_WideString& wsData) const {
- if (index < 0 || index >= m_TargetData.GetSize()) {
+ if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_TargetData))
return false;
- }
+
wsData = m_TargetData[index];
return true;
}
void CFDE_XMLInstruction::AppendData(const CFX_WideString& wsData) {
- m_TargetData.Add(wsData);
+ m_TargetData.push_back(wsData);
}
void CFDE_XMLInstruction::RemoveData(int32_t index) {
- m_TargetData.RemoveAt(index);
+ if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_TargetData))
+ return;
+
+ m_TargetData.erase(m_TargetData.begin() + index);
}
CFDE_XMLInstruction::~CFDE_XMLInstruction() {}
@@ -679,9 +685,7 @@ CFDE_XMLElement::CFDE_XMLElement(const CFX_WideString& wsTag)
ASSERT(m_wsTag.GetLength() > 0);
}
-CFDE_XMLElement::~CFDE_XMLElement() {
- m_Attributes.RemoveAll();
-}
+CFDE_XMLElement::~CFDE_XMLElement() {}
void CFDE_XMLElement::Release() {
delete this;
@@ -693,10 +697,10 @@ FDE_XMLNODETYPE CFDE_XMLElement::GetType() const {
CFDE_XMLNode* CFDE_XMLElement::Clone(bool bRecursive) {
CFDE_XMLElement* pClone = new CFDE_XMLElement(m_wsTag);
- if (!pClone) {
+ if (!pClone)
return nullptr;
- }
- pClone->m_Attributes.Copy(m_Attributes);
+
+ pClone->m_Attributes = m_Attributes;
if (bRecursive) {
CloneChildren(pClone);
} else {
@@ -763,13 +767,13 @@ void CFDE_XMLElement::GetNamespaceURI(CFX_WideString& wsNamespace) const {
}
int32_t CFDE_XMLElement::CountAttributes() const {
- return m_Attributes.GetSize() / 2;
+ return pdfium::CollectionSize<int32_t>(m_Attributes) / 2;
}
bool CFDE_XMLElement::GetAttribute(int32_t index,
CFX_WideString& wsAttriName,
CFX_WideString& wsAttriValue) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
ASSERT(index > -1 && index < iCount / 2);
for (int32_t i = 0; i < iCount; i += 2) {
if (index == 0) {
@@ -783,11 +787,10 @@ bool CFDE_XMLElement::GetAttribute(int32_t index,
}
bool CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
+ if (m_Attributes[i].Compare(pwsAttriName) == 0)
return true;
- }
}
return false;
}
@@ -795,7 +798,7 @@ bool CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const {
void CFDE_XMLElement::GetString(const FX_WCHAR* pwsAttriName,
CFX_WideString& wsAttriValue,
const FX_WCHAR* pwsDefValue) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
wsAttriValue = m_Attributes[i + 1];
@@ -808,7 +811,7 @@ void CFDE_XMLElement::GetString(const FX_WCHAR* pwsAttriName,
void CFDE_XMLElement::SetString(const CFX_WideString& wsAttriName,
const CFX_WideString& wsAttriValue) {
ASSERT(wsAttriName.GetLength() > 0);
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(wsAttriName) == 0) {
m_Attributes[i] = wsAttriName;
@@ -816,13 +819,13 @@ void CFDE_XMLElement::SetString(const CFX_WideString& wsAttriName,
return;
}
}
- m_Attributes.Add(wsAttriName);
- m_Attributes.Add(wsAttriValue);
+ m_Attributes.push_back(wsAttriName);
+ m_Attributes.push_back(wsAttriValue);
}
int32_t CFDE_XMLElement::GetInteger(const FX_WCHAR* pwsAttriName,
int32_t iDefValue) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
return FXSYS_wtoi(m_Attributes[i + 1].c_str());
@@ -840,7 +843,7 @@ void CFDE_XMLElement::SetInteger(const FX_WCHAR* pwsAttriName,
FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName,
FX_FLOAT fDefValue) const {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
return FXSYS_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr);
@@ -857,11 +860,11 @@ void CFDE_XMLElement::SetFloat(const FX_WCHAR* pwsAttriName,
}
void CFDE_XMLElement::RemoveAttribute(const FX_WCHAR* pwsAttriName) {
- int32_t iCount = m_Attributes.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- m_Attributes.RemoveAt(i + 1);
- m_Attributes.RemoveAt(i);
+ m_Attributes.erase(m_Attributes.begin() + i,
+ m_Attributes.begin() + i + 2);
return;
}
}
@@ -1007,8 +1010,9 @@ void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
} else {
ws.Format(L"<?%s", pInstruction->m_wsTarget.c_str());
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- CFX_WideStringArray& attributes = pInstruction->m_Attributes;
- int32_t i, iCount = attributes.GetSize();
+ std::vector<CFX_WideString>& attributes = pInstruction->m_Attributes;
+ int32_t i;
+ int32_t iCount = pdfium::CollectionSize<int32_t>(attributes);
CFX_WideString wsValue;
for (i = 0; i < iCount; i += 2) {
ws = L" ";
@@ -1024,8 +1028,8 @@ void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
ws += L"\"";
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
- CFX_WideStringArray& targetdata = pInstruction->m_TargetData;
- iCount = targetdata.GetSize();
+ std::vector<CFX_WideString>& targetdata = pInstruction->m_TargetData;
+ iCount = pdfium::CollectionSize<int32_t>(targetdata);
for (i = 0; i < iCount; i++) {
ws = L" \"";
ws += targetdata[i];
@@ -1041,8 +1045,9 @@ void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
ws = L"<";
ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- CFX_WideStringArray& attributes = ((CFDE_XMLElement*)pNode)->m_Attributes;
- int32_t iCount = attributes.GetSize();
+ std::vector<CFX_WideString>& attributes =
+ static_cast<CFDE_XMLElement*>(pNode)->m_Attributes;
+ int32_t iCount = pdfium::CollectionSize<int32_t>(attributes);
CFX_WideString wsValue;
for (int32_t i = 0; i < iCount; i += 2) {
ws = L" ";
diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h
index 8571f1b9f1..126b0355a3 100644
--- a/xfa/fde/xml/fde_xml_imp.h
+++ b/xfa/fde/xml/fde_xml_imp.h
@@ -8,6 +8,7 @@
#define XFA_FDE_XML_FDE_XML_IMP_H_
#include <memory>
+#include <vector>
#include "core/fxcrt/fx_system.h"
#include "xfa/fde/xml/fde_xml.h"
@@ -105,8 +106,8 @@ class CFDE_XMLInstruction : public CFDE_XMLNode {
void RemoveData(int32_t index);
CFX_WideString m_wsTarget;
- CFX_WideStringArray m_Attributes;
- CFX_WideStringArray m_TargetData;
+ std::vector<CFX_WideString> m_Attributes;
+ std::vector<CFX_WideString> m_TargetData;
};
class CFDE_XMLElement : public CFDE_XMLNode {
@@ -148,7 +149,7 @@ class CFDE_XMLElement : public CFDE_XMLNode {
void SetTextData(const CFX_WideString& wsText);
CFX_WideString m_wsTag;
- CFX_WideStringArray m_Attributes;
+ std::vector<CFX_WideString> m_Attributes;
};
class CFDE_XMLText : public CFDE_XMLNode {
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 6f998a9975..5cf5a46d0e 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -947,12 +947,12 @@ int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled,
int32_t nPenalty = 30000;
if (FontName.GetLength() != 0) {
if (FontName != pInstalled->m_wsFaceName) {
- int32_t i;
- for (i = 0; i < pInstalled->m_wsFamilyNames.GetSize(); i++) {
+ size_t i;
+ for (i = 0; i < pInstalled->m_wsFamilyNames.size(); ++i) {
if (pInstalled->m_wsFamilyNames[i] == FontName)
break;
}
- if (i == pInstalled->m_wsFamilyNames.GetSize())
+ if (i == pInstalled->m_wsFamilyNames.size())
nPenalty += 0xFFFF;
else
nPenalty -= 28000;
@@ -961,12 +961,12 @@ int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled,
}
if (30000 == nPenalty &&
0 == IsPartName(pInstalled->m_wsFaceName, FontName)) {
- int32_t i;
- for (i = 0; i < pInstalled->m_wsFamilyNames.GetSize(); i++) {
+ size_t i;
+ for (i = 0; i < pInstalled->m_wsFamilyNames.size(); i++) {
if (IsPartName(pInstalled->m_wsFamilyNames[i], FontName) != 0)
break;
}
- if (i == pInstalled->m_wsFamilyNames.GetSize())
+ if (i == pInstalled->m_wsFamilyNames.size())
nPenalty += 0xFFFF;
else
nPenalty -= 26000;
@@ -1058,13 +1058,12 @@ void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace,
table.clear();
}
GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames);
-
- pFont->m_wsFamilyNames.Add(CFX_ByteString(pFace->family_name).UTF8Decode());
+ pFont->m_wsFamilyNames.push_back(
+ CFX_ByteString(pFace->family_name).UTF8Decode());
pFont->m_wsFaceName =
pFaceName ? *pFaceName
: CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace));
pFont->m_nFaceIndex = pFace->face_index;
-
m_InstalledFonts.Add(pFont.release());
}
@@ -1106,7 +1105,7 @@ uint32_t CFGAS_FontMgr::GetFlags(FXFT_Face pFace) {
}
void CFGAS_FontMgr::GetNames(const uint8_t* name_table,
- CFX_WideStringArray& Names) {
+ std::vector<CFX_WideString>& Names) {
if (!name_table)
return;
@@ -1130,14 +1129,14 @@ void CFGAS_FontMgr::GetNames(const uint8_t* name_table,
FX_WCHAR wcTemp = GetUInt16(lpStr + nNameOffset + k * 2);
wsFamily += wcTemp;
}
- Names.Add(wsFamily);
+ Names.push_back(wsFamily);
continue;
}
for (uint16_t k = 0; k < nNameLength; k++) {
FX_WCHAR wcTemp = GetUInt8(lpStr + nNameOffset + k);
wsFamily += wcTemp;
}
- Names.Add(wsFamily);
+ Names.push_back(wsFamily);
}
}
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h
index ce87b4e2b8..0da84fd6e9 100644
--- a/xfa/fgas/font/cfgas_fontmgr.h
+++ b/xfa/fgas/font/cfgas_fontmgr.h
@@ -137,7 +137,7 @@ class CFX_FontDescriptor {
int32_t m_nFaceIndex;
CFX_WideString m_wsFaceName;
- CFX_WideStringArray m_wsFamilyNames;
+ std::vector<CFX_WideString> m_wsFamilyNames;
uint32_t m_dwFontStyles;
uint32_t m_dwUsb[4];
uint32_t m_dwCsb[2];
@@ -217,7 +217,7 @@ class CFGAS_FontMgr {
void RegisterFace(FXFT_Face pFace, const CFX_WideString* pFaceName);
void RegisterFaces(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream,
const CFX_WideString* pFaceName);
- void GetNames(const uint8_t* name_table, CFX_WideStringArray& Names);
+ void GetNames(const uint8_t* name_table, std::vector<CFX_WideString>& Names);
std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const;
void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB);
uint32_t GetFlags(FXFT_Face pFace);
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp
index aea7bacc11..d6ef62885d 100644
--- a/xfa/fgas/localization/fgas_locale.cpp
+++ b/xfa/fgas/localization/fgas_locale.cpp
@@ -7,6 +7,7 @@
#include "xfa/fgas/localization/fgas_locale.h"
#include <algorithm>
+#include <vector>
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_xml.h"
@@ -262,9 +263,12 @@ CFX_WideString CFX_LCNumeric::ToString(int32_t nTreading,
CFX_FormatString::CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, bool bUseLCID)
: m_pLocaleMgr(pLocaleMgr), m_bUseLCID(bUseLCID) {}
+
CFX_FormatString::~CFX_FormatString() {}
-void CFX_FormatString::SplitFormatString(const CFX_WideString& wsFormatString,
- CFX_WideStringArray& wsPatterns) {
+
+void CFX_FormatString::SplitFormatString(
+ const CFX_WideString& wsFormatString,
+ std::vector<CFX_WideString>& wsPatterns) {
int32_t iStrLen = wsFormatString.GetLength();
const FX_WCHAR* pStr = wsFormatString.c_str();
const FX_WCHAR* pToken = pStr;
@@ -272,20 +276,19 @@ void CFX_FormatString::SplitFormatString(const CFX_WideString& wsFormatString,
bool iQuote = false;
while (true) {
if (pStr >= pEnd) {
- CFX_WideString sub(pToken, pStr - pToken);
- wsPatterns.Add(sub);
+ wsPatterns.push_back(CFX_WideString(pToken, pStr - pToken));
return;
}
if (*pStr == '\'') {
iQuote = !iQuote;
} else if (*pStr == L'|' && !iQuote) {
- CFX_WideString sub(pToken, pStr - pToken);
- wsPatterns.Add(sub);
+ wsPatterns.push_back(CFX_WideString(pToken, pStr - pToken));
pToken = pStr + 1;
}
pStr++;
}
}
+
static CFX_WideString FX_GetLiteralText(const FX_WCHAR* pStrPattern,
int32_t& iPattern,
int32_t iLenPattern) {
diff --git a/xfa/fgas/localization/fgas_localeimp.h b/xfa/fgas/localization/fgas_localeimp.h
index 7389158798..a66921b61c 100644
--- a/xfa/fgas/localization/fgas_localeimp.h
+++ b/xfa/fgas/localization/fgas_localeimp.h
@@ -7,6 +7,8 @@
#ifndef XFA_FGAS_LOCALIZATION_FGAS_LOCALEIMP_H_
#define XFA_FGAS_LOCALIZATION_FGAS_LOCALEIMP_H_
+#include <vector>
+
#include "xfa/fgas/localization/fgas_locale.h"
class CFX_LCNumeric;
@@ -17,7 +19,7 @@ class CFX_FormatString {
~CFX_FormatString();
void SplitFormatString(const CFX_WideString& wsFormatString,
- CFX_WideStringArray& wsPatterns);
+ std::vector<CFX_WideString>& wsPatterns);
FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern);
uint16_t GetLCID(const CFX_WideString& wsPattern);
CFX_WideString GetLocaleName(const CFX_WideString& wsPattern);
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 72284d6ef7..d19fd6876b 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -6,7 +6,10 @@
#include "xfa/fxfa/app/xfa_ffchoicelist.h"
+#include <vector>
+
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_combobox.h"
#include "xfa/fwl/cfwl_edit.h"
@@ -50,9 +53,9 @@ bool CXFA_FFListBox::LoadWidget() {
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- CFX_WideStringArray wsLabelArray;
+ std::vector<CFX_WideString> wsLabelArray;
m_pDataAcc->GetChoiceListItems(wsLabelArray, false);
- int32_t iItems = wsLabelArray.GetSize();
+ int32_t iItems = pdfium::CollectionSize<int32_t>(wsLabelArray);
for (int32_t i = 0; i < iItems; i++) {
pListBox->AddString(wsLabelArray[i].AsStringC());
}
@@ -247,9 +250,9 @@ bool CXFA_FFComboBox::LoadWidget() {
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- CFX_WideStringArray wsLabelArray;
+ std::vector<CFX_WideString> wsLabelArray;
m_pDataAcc->GetChoiceListItems(wsLabelArray, false);
- int32_t iItems = wsLabelArray.GetSize();
+ int32_t iItems = pdfium::CollectionSize<int32_t>(wsLabelArray);
for (int32_t i = 0; i < iItems; i++) {
pComboBox->AddString(wsLabelArray[i].AsStringC());
}
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index 477bd54457..78b690afc1 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/xfa_ffdocview.h"
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fxfa/app/xfa_ffbarcode.h"
#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
#include "xfa/fxfa/app/xfa_ffchoicelist.h"
@@ -146,7 +147,7 @@ int32_t CXFA_FFDocView::GetLayoutStatus() {
return m_iStatus;
}
void CXFA_FFDocView::ShowNullTestMsg() {
- int32_t iCount = m_arrNullTestMsg.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_arrNullTestMsg);
CXFA_FFApp* pApp = m_pDoc->GetApp();
IXFA_AppProvider* pAppProvider = pApp->GetAppProvider();
if (pAppProvider && iCount) {
@@ -169,7 +170,7 @@ void CXFA_FFDocView::ShowNullTestMsg() {
pAppProvider->LoadString(XFA_IDS_AppName, wsTitle);
pAppProvider->MsgBox(wsMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK);
}
- m_arrNullTestMsg.RemoveAll();
+ m_arrNullTestMsg.clear();
}
void CXFA_FFDocView::UpdateDocView() {
if (IsUpdateLocked()) {
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 64d76a6d2a..d63a4f5151 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -476,7 +476,7 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate,
}
if (!wsNullMsg.IsEmpty()) {
if (eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
- m_pDocView->m_arrNullTestMsg.Add(wsNullMsg);
+ m_pDocView->m_arrNullTestMsg.push_back(wsNullMsg);
return XFA_EVENTERROR_Error;
}
return XFA_EVENTERROR_Success;
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index a9965f52a5..72d1fa76ba 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -6,7 +6,10 @@
#include "xfa/fxfa/parser/cxfa_dataexporter.h"
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -217,12 +220,12 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
if (wsRawValue.IsEmpty())
break;
- CFX_WideStringArray wsSelTextArray;
+ std::vector<CFX_WideString> wsSelTextArray;
int32_t iStart = 0;
int32_t iEnd = wsRawValue.Find(L'\n', iStart);
iEnd = (iEnd == -1) ? wsRawValue.GetLength() : iEnd;
while (iEnd >= iStart) {
- wsSelTextArray.Add(wsRawValue.Mid(iStart, iEnd - iStart));
+ wsSelTextArray.push_back(wsRawValue.Mid(iStart, iEnd - iStart));
iStart = iEnd + 1;
if (iStart >= wsRawValue.GetLength())
break;
@@ -242,7 +245,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
buf << FX_WSTRC(L"<");
buf << bodyTagName;
buf << FX_WSTRC(L" xmlns=\"\"\n>");
- for (int32_t i = 0; i < wsSelTextArray.GetSize(); i++) {
+ for (int32_t i = 0; i < pdfium::CollectionSize<int32_t>(wsSelTextArray);
+ i++) {
buf << FX_WSTRC(L"<value\n>");
buf << ExportEncodeContent(wsSelTextArray[i].AsStringC());
buf << FX_WSTRC(L"</value\n>");
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index f3f79cbbec..1721cb7982 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -9,6 +9,7 @@
#include <map>
#include <memory>
#include <utility>
+#include <vector>
#include "core/fxcrt/fx_ext.h"
#include "fxjs/cfxjse_value.h"
@@ -4150,7 +4151,7 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
bScriptModify, false);
CXFA_Node* pBind = GetBindData();
if (bSyncData && pBind) {
- CFX_WideStringArray wsSaveTextArray;
+ std::vector<CFX_WideString> wsSaveTextArray;
int32_t iSize = 0;
if (!wsContent.IsEmpty()) {
int32_t iStart = 0;
@@ -4158,17 +4159,18 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
int32_t iEnd = wsContent.Find(L'\n', iStart);
iEnd = (iEnd == -1) ? iLength : iEnd;
while (iEnd >= iStart) {
- wsSaveTextArray.Add(wsContent.Mid(iStart, iEnd - iStart));
+ wsSaveTextArray.push_back(wsContent.Mid(iStart, iEnd - iStart));
iStart = iEnd + 1;
if (iStart >= iLength) {
break;
}
iEnd = wsContent.Find(L'\n', iStart);
if (iEnd < 0) {
- wsSaveTextArray.Add(wsContent.Mid(iStart, iLength - iStart));
+ wsSaveTextArray.push_back(
+ wsContent.Mid(iStart, iLength - iStart));
}
}
- iSize = wsSaveTextArray.GetSize();
+ iSize = pdfium::CollectionSize<int32_t>(wsSaveTextArray);
}
if (iSize == 0) {
while (CXFA_Node* pChildNode =
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index c9523383dd..48a26aafad 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/parser/cxfa_widgetdata.h"
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fxbarcode/BC_Library.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -805,8 +806,9 @@ bool CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText,
return false;
}
-void CXFA_WidgetData::GetChoiceListItems(CFX_WideStringArray& wsTextArray,
- bool bSaveValue) {
+void CXFA_WidgetData::GetChoiceListItems(
+ std::vector<CFX_WideString>& wsTextArray,
+ bool bSaveValue) {
CXFA_NodeArray pItems;
CXFA_Node* pItem = nullptr;
int32_t iCount = 0;
@@ -832,22 +834,24 @@ void CXFA_WidgetData::GetChoiceListItems(CFX_WideStringArray& wsTextArray,
}
pItems.RemoveAll();
pNode = pItem->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling))
- pNode->TryContent(wsTextArray.Add());
+ for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ wsTextArray.emplace_back();
+ pNode->TryContent(wsTextArray.back());
+ }
}
int32_t CXFA_WidgetData::CountSelectedItems() {
- CFX_WideStringArray wsValueArray;
+ std::vector<CFX_WideString> wsValueArray;
GetSelectedItemsValue(wsValueArray);
if (IsListBox() || !IsChoiceListAllowTextEntry())
- return wsValueArray.GetSize();
+ return pdfium::CollectionSize<int32_t>(wsValueArray);
int32_t iSelected = 0;
- CFX_WideStringArray wsSaveTextArray;
+ std::vector<CFX_WideString> wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, true);
- int32_t iValues = wsValueArray.GetSize();
+ int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray);
for (int32_t i = 0; i < iValues; i++) {
- int32_t iSaves = wsSaveTextArray.GetSize();
+ int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray);
for (int32_t j = 0; j < iSaves; j++) {
if (wsValueArray[i] == wsSaveTextArray[j]) {
iSelected++;
@@ -859,11 +863,11 @@ int32_t CXFA_WidgetData::CountSelectedItems() {
}
int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) {
- CFX_WideStringArray wsValueArray;
+ std::vector<CFX_WideString> wsValueArray;
GetSelectedItemsValue(wsValueArray);
- CFX_WideStringArray wsSaveTextArray;
+ std::vector<CFX_WideString> wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, true);
- int32_t iSaves = wsSaveTextArray.GetSize();
+ int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray);
for (int32_t j = 0; j < iSaves; j++) {
if (wsValueArray[nIndex] == wsSaveTextArray[j])
return j;
@@ -872,15 +876,15 @@ int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) {
}
void CXFA_WidgetData::GetSelectedItems(CFX_Int32Array& iSelArray) {
- CFX_WideStringArray wsValueArray;
+ std::vector<CFX_WideString> wsValueArray;
GetSelectedItemsValue(wsValueArray);
- int32_t iValues = wsValueArray.GetSize();
+ int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray);
if (iValues < 1)
return;
- CFX_WideStringArray wsSaveTextArray;
+ std::vector<CFX_WideString> wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, true);
- int32_t iSaves = wsSaveTextArray.GetSize();
+ int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray);
for (int32_t i = 0; i < iValues; i++) {
for (int32_t j = 0; j < iSaves; j++) {
if (wsValueArray[i] == wsSaveTextArray[j]) {
@@ -892,7 +896,7 @@ void CXFA_WidgetData::GetSelectedItems(CFX_Int32Array& iSelArray) {
}
void CXFA_WidgetData::GetSelectedItemsValue(
- CFX_WideStringArray& wsSelTextArray) {
+ std::vector<CFX_WideString>& wsSelTextArray) {
CFX_WideString wsValue = GetRawValue();
if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
if (!wsValue.IsEmpty()) {
@@ -901,18 +905,18 @@ void CXFA_WidgetData::GetSelectedItemsValue(
int32_t iEnd = wsValue.Find(L'\n', iStart);
iEnd = (iEnd == -1) ? iLength : iEnd;
while (iEnd >= iStart) {
- wsSelTextArray.Add(wsValue.Mid(iStart, iEnd - iStart));
+ wsSelTextArray.push_back(wsValue.Mid(iStart, iEnd - iStart));
iStart = iEnd + 1;
if (iStart >= iLength)
break;
iEnd = wsValue.Find(L'\n', iStart);
if (iEnd < 0)
- wsSelTextArray.Add(wsValue.Mid(iStart, iLength - iStart));
+ wsSelTextArray.push_back(wsValue.Mid(iStart, iLength - iStart));
}
}
} else {
- wsSelTextArray.Add(wsValue);
+ wsSelTextArray.push_back(wsValue);
}
}
@@ -920,14 +924,14 @@ bool CXFA_WidgetData::GetItemState(int32_t nIndex) {
if (nIndex < 0)
return false;
- CFX_WideStringArray wsSaveTextArray;
+ std::vector<CFX_WideString> wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, true);
- if (wsSaveTextArray.GetSize() <= nIndex)
+ if (pdfium::CollectionSize<int32_t>(wsSaveTextArray) <= nIndex)
return false;
- CFX_WideStringArray wsValueArray;
+ std::vector<CFX_WideString> wsValueArray;
GetSelectedItemsValue(wsValueArray);
- int32_t iValues = wsValueArray.GetSize();
+ int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray);
for (int32_t j = 0; j < iValues; j++) {
if (wsValueArray[j] == wsSaveTextArray[nIndex])
return true;
@@ -943,15 +947,15 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex,
if (nIndex < 0)
return;
- CFX_WideStringArray wsSaveTextArray;
+ std::vector<CFX_WideString> wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, true);
- if (wsSaveTextArray.GetSize() <= nIndex)
+ if (pdfium::CollectionSize<int32_t>(wsSaveTextArray) <= nIndex)
return;
int32_t iSel = -1;
- CFX_WideStringArray wsValueArray;
+ std::vector<CFX_WideString> wsValueArray;
GetSelectedItemsValue(wsValueArray);
- int32_t iValues = wsValueArray.GetSize();
+ int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray);
for (int32_t j = 0; j < iValues; j++) {
if (wsValueArray[j] == wsSaveTextArray[nIndex]) {
iSel = j;
@@ -1003,7 +1007,7 @@ void CXFA_WidgetData::SetSelectedItems(CFX_Int32Array& iSelArray,
CFX_WideString wsValue;
int32_t iSize = iSelArray.GetSize();
if (iSize >= 1) {
- CFX_WideStringArray wsSaveTextArray;
+ std::vector<CFX_WideString> wsSaveTextArray;
GetChoiceListItems(wsSaveTextArray, true);
CFX_WideString wsItemValue;
for (int32_t i = 0; i < iSize; i++) {
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index 5c030d6b52..0079996735 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXFA_PARSER_CXFA_WIDGETDATA_H_
#define XFA_FXFA_PARSER_CXFA_WIDGETDATA_H_
+#include <vector>
+
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fxfa/parser/cxfa_assist.h"
@@ -97,12 +99,12 @@ class CXFA_WidgetData : public CXFA_Data {
bool GetChoiceListItem(CFX_WideString& wsText,
int32_t nIndex,
bool bSaveValue = false);
- void GetChoiceListItems(CFX_WideStringArray& wsTextArray,
+ void GetChoiceListItems(std::vector<CFX_WideString>& wsTextArray,
bool bSaveValue = false);
int32_t CountSelectedItems();
int32_t GetSelectedItem(int32_t nIndex = 0);
void GetSelectedItems(CFX_Int32Array& iSelArray);
- void GetSelectedItemsValue(CFX_WideStringArray& wsSelTextArray);
+ void GetSelectedItemsValue(std::vector<CFX_WideString>& wsSelTextArray);
bool GetItemState(int32_t nIndex);
void SetItemState(int32_t nIndex,
bool bSelected,
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 1fc9530e09..dab61e65d8 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -6,7 +6,10 @@
#include "xfa/fxfa/parser/xfa_document_datamerger_imp.h"
+#include <vector>
+
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
@@ -149,9 +152,9 @@ void CreateDataBinding(CXFA_Node* pFormNode,
case XFA_Element::ChoiceList:
defValue.GetChildValueContent(wsValue);
if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
- CFX_WideStringArray wsSelTextArray;
+ std::vector<CFX_WideString> wsSelTextArray;
pWidgetData->GetSelectedItemsValue(wsSelTextArray);
- int32_t iSize = wsSelTextArray.GetSize();
+ int32_t iSize = pdfium::CollectionSize<int32_t>(wsSelTextArray);
if (iSize >= 1) {
CXFA_Node* pValue = nullptr;
for (int32_t i = 0; i < iSize; i++) {
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
index 6926a99309..45dc327710 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -8,7 +8,9 @@
#include <algorithm>
#include <memory>
+#include <vector>
+#include "third_party/base/stl_util.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
@@ -25,7 +27,7 @@ namespace {
int32_t SeparateStringW(const FX_WCHAR* pStr,
int32_t iStrLen,
FX_WCHAR delimiter,
- CFX_WideStringArray& pieces) {
+ std::vector<CFX_WideString>& pieces) {
if (!pStr)
return 0;
if (iStrLen < 0)
@@ -35,15 +37,14 @@ int32_t SeparateStringW(const FX_WCHAR* pStr,
const FX_WCHAR* pEnd = pStr + iStrLen;
while (true) {
if (pStr >= pEnd || delimiter == *pStr) {
- CFX_WideString sub(pToken, pStr - pToken);
- pieces.Add(sub);
+ pieces.push_back(CFX_WideString(pToken, pStr - pToken));
pToken = pStr + 1;
if (pStr >= pEnd)
break;
}
pStr++;
}
- return pieces.GetSize();
+ return pdfium::CollectionSize<int32_t>(pieces);
}
} // namespace
@@ -1401,10 +1402,10 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
: fContainerWidth - fLeftInset - fRightInset;
CFX_WideStringC wsColumnWidths;
if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) {
- CFX_WideStringArray widths;
+ std::vector<CFX_WideString> widths;
if (SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(),
L' ', widths) > 0) {
- int32_t iCols = widths.GetSize();
+ int32_t iCols = pdfium::CollectionSize<int32_t>(widths);
CFX_WideString wsWidth;
for (int32_t i = 0; i < iCols; i++) {
wsWidth = widths[i];
diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp
index c060fe8166..87961358e8 100644
--- a/xfa/fxfa/parser/xfa_localevalue.cpp
+++ b/xfa/fxfa/parser/xfa_localevalue.cpp
@@ -6,8 +6,11 @@
#include "xfa/fxfa/parser/xfa_localevalue.h"
+#include <vector>
+
#include "core/fxcrt/fx_ext.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fgas/localization/fgas_localeimp.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/xfa_localemgr.h"
@@ -105,11 +108,11 @@ bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue,
m_pLocaleMgr->SetDefLocale(pLocale);
auto pFormat = pdfium::MakeUnique<CFX_FormatString>(m_pLocaleMgr, false);
- CFX_WideStringArray wsPatterns;
+ std::vector<CFX_WideString> wsPatterns;
pFormat->SplitFormatString(wsPattern, wsPatterns);
bool bRet = false;
- int32_t iCount = wsPatterns.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
int32_t i = 0;
for (; i < iCount && !bRet; i++) {
CFX_WideString wsFormat = wsPatterns[i];
@@ -464,10 +467,10 @@ bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult,
IFX_Locale* pLocale,
XFA_VALUEPICTURE eValueType) const {
auto pFormat = pdfium::MakeUnique<CFX_FormatString>(m_pLocaleMgr, false);
- CFX_WideStringArray wsPatterns;
+ std::vector<CFX_WideString> wsPatterns;
pFormat->SplitFormatString(wsFormat, wsPatterns);
wsResult.clear();
- int32_t iCount = wsPatterns.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
for (int32_t i = 0; i < iCount; i++) {
if (FormatSinglePattern(wsResult, wsPatterns[i], pLocale, eValueType))
return true;
@@ -793,10 +796,10 @@ bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue,
m_pLocaleMgr->SetDefLocale(pLocale);
auto pFormat = pdfium::MakeUnique<CFX_FormatString>(m_pLocaleMgr, false);
- CFX_WideStringArray wsPatterns;
+ std::vector<CFX_WideString> wsPatterns;
pFormat->SplitFormatString(wsPattern, wsPatterns);
bool bRet = false;
- int32_t iCount = wsPatterns.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
for (int32_t i = 0; i < iCount && !bRet; i++) {
CFX_WideString wsFormat = wsPatterns[i];
FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat);
diff --git a/xfa/fxfa/xfa_ffdocview.h b/xfa/fxfa/xfa_ffdocview.h
index 2350978d52..2c84de7700 100644
--- a/xfa/fxfa/xfa_ffdocview.h
+++ b/xfa/fxfa/xfa_ffdocview.h
@@ -9,6 +9,7 @@
#include <map>
#include <memory>
+#include <vector>
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/xfa_ffdoc.h"
@@ -98,7 +99,7 @@ class CXFA_FFDocView {
bool bRecursive,
CXFA_Node* pExclude);
bool m_bLayoutEvent;
- CFX_WideStringArray m_arrNullTestMsg;
+ std::vector<CFX_WideString> m_arrNullTestMsg;
CXFA_FFWidget* m_pListFocusWidget;
bool m_bInLayoutStatus;