From 74b8c6ed314cfcc83aea13f028b4231db26e6ff8 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 12 Oct 2016 09:38:41 -0700 Subject: Get rid of CFX_ArrayTemplate They won't work with std::unique_ptr down the road, so replace with std::vector. Review-Url: https://codereview.chromium.org/2411703003 --- xfa/fxfa/app/xfa_ffapp.cpp | 7 +++---- xfa/fxfa/app/xfa_ffdoc.cpp | 10 +++++----- xfa/fxfa/xfa_ffapp.h | 3 ++- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index bc16ddf101..6bedcd41a0 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -18,11 +18,10 @@ #include "xfa/fxfa/xfa_ffwidgethandler.h" #include "xfa/fxfa/xfa_fontmgr.h" -CXFA_FileRead::CXFA_FileRead(const CFX_ArrayTemplate& streams) { - int32_t iCount = streams.GetSize(); - for (int32_t i = 0; i < iCount; i++) { +CXFA_FileRead::CXFA_FileRead(const std::vector& streams) { + for (CPDF_Stream* pStream : streams) { CPDF_StreamAcc& acc = m_Data.Add(); - acc.LoadAllData(streams[i]); + acc.LoadAllData(pStream); } } diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 5e39adc0b3..25c78bd14b 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -311,19 +311,19 @@ FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { if (!pElementXFA) return FALSE; - CFX_ArrayTemplate xfaStreams; + std::vector xfaStreams; if (pElementXFA->IsArray()) { CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA; for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) { if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) - xfaStreams.Add(pStream); + xfaStreams.push_back(pStream); } } else if (pElementXFA->IsStream()) { - xfaStreams.Add((CPDF_Stream*)pElementXFA); + xfaStreams.push_back((CPDF_Stream*)pElementXFA); } - if (xfaStreams.GetSize() < 1) { + if (xfaStreams.empty()) return FALSE; - } + IFX_FileRead* pFileRead = new CXFA_FileRead(xfaStreams); m_pPDFDoc = pPDFDoc; if (m_pStream) { diff --git a/xfa/fxfa/xfa_ffapp.h b/xfa/fxfa/xfa_ffapp.h index b3353616de..dd670b83d7 100644 --- a/xfa/fxfa/xfa_ffapp.h +++ b/xfa/fxfa/xfa_ffapp.h @@ -8,6 +8,7 @@ #define XFA_FXFA_XFA_FFAPP_H_ #include +#include #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" @@ -25,7 +26,7 @@ class IFWL_AdapterTimerMgr; class CXFA_FileRead : public IFX_FileRead { public: - explicit CXFA_FileRead(const CFX_ArrayTemplate& streams); + explicit CXFA_FileRead(const std::vector& streams); ~CXFA_FileRead() override; // IFX_FileRead -- cgit v1.2.3