diff options
author | tsepez <tsepez@chromium.org> | 2016-10-12 09:38:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-12 09:38:41 -0700 |
commit | 74b8c6ed314cfcc83aea13f028b4231db26e6ff8 (patch) | |
tree | e417f5d3ec4286aa9709354d9418f06eb1b8887b /fpdfsdk | |
parent | 47cbc06ef6f528e4d30a869ec533d010ee79b064 (diff) | |
download | pdfium-74b8c6ed314cfcc83aea13f028b4231db26e6ff8.tar.xz |
Get rid of CFX_ArrayTemplate<CPDF_Object*>
They won't work with std::unique_ptr down the road, so replace
with std::vector.
Review-Url: https://codereview.chromium.org/2411703003
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdf_flatten.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 251da34d39..4be0135da9 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -17,8 +17,8 @@ #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fpdfdoc/cpdf_annot.h" #include "fpdfsdk/fsdk_define.h" +#include "third_party/base/stl_util.h" -typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray; typedef CFX_ArrayTemplate<CFX_FloatRect> CPDF_RectArray; enum FPDF_TYPE { MAX, MIN }; @@ -65,7 +65,7 @@ void GetContentsRect(CPDF_Document* pDoc, void ParserStream(CPDF_Dictionary* pPageDic, CPDF_Dictionary* pStream, CPDF_RectArray* pRectArray, - CPDF_ObjectArray* pObjectArray) { + std::vector<CPDF_Dictionary*>* pObjectArray) { if (!pStream) return; CFX_FloatRect rect; @@ -77,13 +77,13 @@ void ParserStream(CPDF_Dictionary* pPageDic, if (IsValiableRect(rect, pPageDic->GetRectFor("MediaBox"))) pRectArray->Add(rect); - pObjectArray->Add(pStream); + pObjectArray->push_back(pStream); } int ParserAnnots(CPDF_Document* pSourceDoc, CPDF_Dictionary* pPageDic, CPDF_RectArray* pRectArray, - CPDF_ObjectArray* pObjectArray, + std::vector<CPDF_Dictionary*>* pObjectArray, int nUsage) { if (!pSourceDoc || !pPageDic) return FLATTEN_FAIL; @@ -261,7 +261,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { return FLATTEN_FAIL; } - CPDF_ObjectArray ObjectArray; + std::vector<CPDF_Dictionary*> ObjectArray; CPDF_RectArray RectArray; int iRet = FLATTEN_FAIL; @@ -329,7 +329,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { } CFX_ByteString key = ""; - int nStreams = ObjectArray.GetSize(); + int nStreams = pdfium::CollectionSize<int>(ObjectArray); if (nStreams > 0) { for (int iKey = 0; /*iKey < 100*/; iKey++) { @@ -359,7 +359,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { } for (int i = 0; i < nStreams; i++) { - CPDF_Dictionary* pAnnotDic = ObjectArray.GetAt(i); + CPDF_Dictionary* pAnnotDic = ObjectArray[i]; if (!pAnnotDic) continue; @@ -453,8 +453,6 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { } pPageDict->RemoveFor("Annots"); - ObjectArray.RemoveAll(); RectArray.RemoveAll(); - return FLATTEN_SUCCESS; } |