From 51709bea3ce113df7d36a5fe6415036e26fc3236 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 8 Dec 2016 10:55:57 -0800 Subject: 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 --- core/fxcrt/fx_basic.h | 1 - xfa/fde/css/fde_cssstyleselector.cpp | 8 +- xfa/fde/css/fde_cssstyleselector.h | 2 +- xfa/fde/xml/fde_xml_imp.cpp | 117 ++++++++++++------------ xfa/fde/xml/fde_xml_imp.h | 7 +- xfa/fgas/font/cfgas_fontmgr.cpp | 23 +++-- xfa/fgas/font/cfgas_fontmgr.h | 4 +- xfa/fgas/localization/fgas_locale.cpp | 15 +-- xfa/fgas/localization/fgas_localeimp.h | 4 +- xfa/fxfa/app/xfa_ffchoicelist.cpp | 11 ++- xfa/fxfa/app/xfa_ffdocview.cpp | 5 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 2 +- xfa/fxfa/parser/cxfa_dataexporter.cpp | 10 +- xfa/fxfa/parser/cxfa_node.cpp | 10 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 62 +++++++------ xfa/fxfa/parser/cxfa_widgetdata.h | 6 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 7 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 13 +-- xfa/fxfa/parser/xfa_localevalue.cpp | 15 +-- xfa/fxfa/xfa_ffdocview.h | 3 +- 20 files changed, 180 insertions(+), 145 deletions(-) diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 184b73bd42..2b8f6b6afe 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -423,7 +423,6 @@ class CFX_ObjectArray : public CFX_BasicArray { CFX_BasicArray::SetSize(0); } }; -typedef CFX_ObjectArray CFX_WideStringArray; #endif // PDF_ENABLE_XFA template 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 #include +#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(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 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& pXMLStream) { } else { ws.Format(L"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& attributes = pInstruction->m_Attributes; + int32_t i; + int32_t iCount = pdfium::CollectionSize(attributes); CFX_WideString wsValue; for (i = 0; i < iCount; i += 2) { ws = L" "; @@ -433,8 +435,8 @@ void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr& pXMLStream) { ws += L"\""; pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } - CFX_WideStringArray& targetdata = pInstruction->m_TargetData; - iCount = targetdata.GetSize(); + std::vector& targetdata = pInstruction->m_TargetData; + iCount = pdfium::CollectionSize(targetdata); for (i = 0; i < iCount; i++) { ws = L" \""; ws += targetdata[i]; @@ -450,8 +452,9 @@ void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr& 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& attributes = + static_cast(pNode)->m_Attributes; + int32_t iCount = pdfium::CollectionSize(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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& pXMLStream, } else { ws.Format(L"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& attributes = pInstruction->m_Attributes; + int32_t i; + int32_t iCount = pdfium::CollectionSize(attributes); CFX_WideString wsValue; for (i = 0; i < iCount; i += 2) { ws = L" "; @@ -1024,8 +1028,8 @@ void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr& pXMLStream, ws += L"\""; pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } - CFX_WideStringArray& targetdata = pInstruction->m_TargetData; - iCount = targetdata.GetSize(); + std::vector& targetdata = pInstruction->m_TargetData; + iCount = pdfium::CollectionSize(targetdata); for (i = 0; i < iCount; i++) { ws = L" \""; ws += targetdata[i]; @@ -1041,8 +1045,9 @@ void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr& 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& attributes = + static_cast(pNode)->m_Attributes; + int32_t iCount = pdfium::CollectionSize(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 +#include #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 m_Attributes; + std::vector 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 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& 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 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& pFontStream, const CFX_WideString* pFaceName); - void GetNames(const uint8_t* name_table, CFX_WideStringArray& Names); + void GetNames(const uint8_t* name_table, std::vector& Names); std::vector 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 +#include #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& 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 + #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& 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 + #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 wsLabelArray; m_pDataAcc->GetChoiceListItems(wsLabelArray, false); - int32_t iItems = wsLabelArray.GetSize(); + int32_t iItems = pdfium::CollectionSize(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 wsLabelArray; m_pDataAcc->GetChoiceListItems(wsLabelArray, false); - int32_t iItems = wsLabelArray.GetSize(); + int32_t iItems = pdfium::CollectionSize(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(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 + #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 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(wsSelTextArray); + i++) { buf << FX_WSTRC(L""); buf << ExportEncodeContent(wsSelTextArray[i].AsStringC()); buf << FX_WSTRC(L""); 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 #include #include +#include #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 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(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& 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 wsValueArray; GetSelectedItemsValue(wsValueArray); if (IsListBox() || !IsChoiceListAllowTextEntry()) - return wsValueArray.GetSize(); + return pdfium::CollectionSize(wsValueArray); int32_t iSelected = 0; - CFX_WideStringArray wsSaveTextArray; + std::vector wsSaveTextArray; GetChoiceListItems(wsSaveTextArray, true); - int32_t iValues = wsValueArray.GetSize(); + int32_t iValues = pdfium::CollectionSize(wsValueArray); for (int32_t i = 0; i < iValues; i++) { - int32_t iSaves = wsSaveTextArray.GetSize(); + int32_t iSaves = pdfium::CollectionSize(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 wsValueArray; GetSelectedItemsValue(wsValueArray); - CFX_WideStringArray wsSaveTextArray; + std::vector wsSaveTextArray; GetChoiceListItems(wsSaveTextArray, true); - int32_t iSaves = wsSaveTextArray.GetSize(); + int32_t iSaves = pdfium::CollectionSize(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 wsValueArray; GetSelectedItemsValue(wsValueArray); - int32_t iValues = wsValueArray.GetSize(); + int32_t iValues = pdfium::CollectionSize(wsValueArray); if (iValues < 1) return; - CFX_WideStringArray wsSaveTextArray; + std::vector wsSaveTextArray; GetChoiceListItems(wsSaveTextArray, true); - int32_t iSaves = wsSaveTextArray.GetSize(); + int32_t iSaves = pdfium::CollectionSize(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& 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 wsSaveTextArray; GetChoiceListItems(wsSaveTextArray, true); - if (wsSaveTextArray.GetSize() <= nIndex) + if (pdfium::CollectionSize(wsSaveTextArray) <= nIndex) return false; - CFX_WideStringArray wsValueArray; + std::vector wsValueArray; GetSelectedItemsValue(wsValueArray); - int32_t iValues = wsValueArray.GetSize(); + int32_t iValues = pdfium::CollectionSize(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 wsSaveTextArray; GetChoiceListItems(wsSaveTextArray, true); - if (wsSaveTextArray.GetSize() <= nIndex) + if (pdfium::CollectionSize(wsSaveTextArray) <= nIndex) return; int32_t iSel = -1; - CFX_WideStringArray wsValueArray; + std::vector wsValueArray; GetSelectedItemsValue(wsValueArray); - int32_t iValues = wsValueArray.GetSize(); + int32_t iValues = pdfium::CollectionSize(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 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 + #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& 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& 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 + #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 wsSelTextArray; pWidgetData->GetSelectedItemsValue(wsSelTextArray); - int32_t iSize = wsSelTextArray.GetSize(); + int32_t iSize = pdfium::CollectionSize(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 #include +#include +#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& 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(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 widths; if (SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), L' ', widths) > 0) { - int32_t iCols = widths.GetSize(); + int32_t iCols = pdfium::CollectionSize(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 + #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(m_pLocaleMgr, false); - CFX_WideStringArray wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsPattern, wsPatterns); bool bRet = false; - int32_t iCount = wsPatterns.GetSize(); + int32_t iCount = pdfium::CollectionSize(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(m_pLocaleMgr, false); - CFX_WideStringArray wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsFormat, wsPatterns); wsResult.clear(); - int32_t iCount = wsPatterns.GetSize(); + int32_t iCount = pdfium::CollectionSize(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(m_pLocaleMgr, false); - CFX_WideStringArray wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsPattern, wsPatterns); bool bRet = false; - int32_t iCount = wsPatterns.GetSize(); + int32_t iCount = pdfium::CollectionSize(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 #include +#include #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 m_arrNullTestMsg; CXFA_FFWidget* m_pListFocusWidget; bool m_bInLayoutStatus; -- cgit v1.2.3