diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-09 09:55:54 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-09 09:55:54 -0800 |
commit | 11d93559cea7a0894e05249e7dac2035ad79994e (patch) | |
tree | 801b9cd68ffef73b861708759c0304097a384fa4 /fpdfsdk/src/fpdfppo.cpp | |
parent | 56cf589f6ecc85a84c183956bdcb071ec16567d9 (diff) | |
download | pdfium-11d93559cea7a0894e05249e7dac2035ad79994e.tar.xz |
Banish CFX_WordArray to XFA-land.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1676913004 .
Diffstat (limited to 'fpdfsdk/src/fpdfppo.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfppo.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index c05c7f35f0..84ac41d60e 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -9,6 +9,7 @@ #include <memory> #include "fpdfsdk/include/fsdk_define.h" +#include "third_party/base/stl_util.h" class CPDF_PageOrganizer { public: @@ -18,7 +19,7 @@ class CPDF_PageOrganizer { FX_BOOL PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc); FX_BOOL ExportPage(CPDF_Document* pSrcPDFDoc, - CFX_WordArray* nPageNum, + std::vector<FX_WORD>* pPageNums, CPDF_Document* pDestPDFDoc, int nIndex); CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict, @@ -87,16 +88,15 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, } FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, - CFX_WordArray* nPageNum, + std::vector<FX_WORD>* pPageNums, CPDF_Document* pDestPDFDoc, int nIndex) { int curpage = nIndex; - std::unique_ptr<ObjectNumberMap> pObjNumberMap(new ObjectNumberMap); - - for (int i = 0; i < nPageNum->GetSize(); ++i) { + int nSize = pdfium::CollectionSize<int>(*pPageNums); + for (int i = 0; i < nSize; ++i) { CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage); - CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(nPageNum->GetAt(i) - 1); + CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(pPageNums->at(i) - 1); if (!pSrcPageDict || !pCurPageDict) return FALSE; @@ -306,7 +306,7 @@ FX_DWORD CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc, } FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, - CFX_WordArray* pageArray, + std::vector<FX_WORD>* pageArray, int nCount) { if (rangstring.GetLength() != 0) { rangstring.Remove(' '); @@ -329,7 +329,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, long lPageNum = atol(cbMidRange); if (lPageNum <= 0 || lPageNum > nCount) return FALSE; - pageArray->Add((FX_WORD)lPageNum); + pageArray->push_back((FX_WORD)lPageNum); } else { int nStartPageNum = atol(cbMidRange.Mid(0, nMid)); if (nStartPageNum == 0) @@ -346,7 +346,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, return FALSE; } for (int i = nStartPageNum; i <= nEndPageNum; ++i) { - pageArray->Add(i); + pageArray->push_back(i); } } nStringFrom = nStringTo + 1; @@ -367,14 +367,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc, if (!pSrcDoc) return FALSE; - CFX_WordArray pageArray; + std::vector<FX_WORD> pageArray; int nCount = pSrcDoc->GetPageCount(); if (pagerange) { if (!ParserPageRangeString(pagerange, &pageArray, nCount)) return FALSE; } else { for (int i = 1; i <= nCount; ++i) { - pageArray.Add(i); + pageArray.push_back(i); } } |