diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-12-09 16:39:40 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-12-09 16:39:40 -0800 |
commit | bd573f126f93acc2034be2df1c6f571670f76c35 (patch) | |
tree | beeea3b9370bb7490ed5933dadbef857cb8df23d /core/src/fpdfapi | |
parent | e021e084717b8cc43f8a0667ad9d1a807dfe381c (diff) | |
download | pdfium-bd573f126f93acc2034be2df1c6f571670f76c35.tar.xz |
Merge to XFA: Get rid of most uses of CFX_PtrArray.
Original Review URL: https://codereview.chromium.org/1518593002 .
(cherry picked from commit 035359cd8ddb555fa33b6133db4fd405e4660712)
R=thestig@chromium.org
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1513103002 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 6 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 10 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/pageint.h | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 5 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp | 36 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 59 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 6 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/render_int.h | 5 |
9 files changed, 64 insertions, 69 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index 59fa1afb50..36dbb97a6c 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -37,7 +37,7 @@ void CPDF_PageContentGenerate::GenerateContent() { CFX_ByteTextBuf buf; CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; for (int i = 0; i < m_pageObjects.GetSize(); ++i) { - CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_pageObjects[i]; + CPDF_PageObject* pPageObj = m_pageObjects[i]; if (!pPageObj || pPageObj->m_Type != PDFPAGE_IMAGE) { continue; } diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 349b007c43..b3891d78dd 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -1017,7 +1017,7 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc, int nPagesToGo, CPDF_Dictionary* pPage, FX_BOOL bInsert, - CFX_PtrArray& stackList) { + CFX_ArrayTemplate<CPDF_Dictionary*>& stackList) { CPDF_Array* pKidList = pPages->GetArray("Kids"); if (!pKidList) { return -1; @@ -1088,7 +1088,7 @@ static int InsertNewPage(CPDF_Document* pDoc, pPages->SetAtInteger(FX_BSTRC("Count"), nPages + 1); pPageDict->SetAtReference(FX_BSTRC("Parent"), pDoc, pPages->GetObjNum()); } else { - CFX_PtrArray stack; + CFX_ArrayTemplate<CPDF_Dictionary*> stack; stack.Add(pPages); if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, stack) < 0) { return -1; @@ -1129,7 +1129,7 @@ void CPDF_Document::DeletePage(int iPage) { if (iPage < 0 || iPage >= nPages) { return; } - CFX_PtrArray stack; + CFX_ArrayTemplate<CPDF_Dictionary*> stack; stack.Add(pPages); if (InsertDeletePDFPage(this, pPages, iPage, NULL, FALSE, stack) < 0) { return; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 163b6e9d53..a2d4988f92 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -80,7 +80,7 @@ CPDF_StreamContentParser::CPDF_StreamContentParser( CPDF_StreamContentParser::~CPDF_StreamContentParser() { ClearAllParams(); for (int i = 0; i < m_StateStack.GetSize(); ++i) { - delete (CPDF_AllStates*)m_StateStack[i]; + delete m_StateStack[i]; } FX_Free(m_pPathPoints); if (m_pLastImageDict) { @@ -819,12 +819,10 @@ void CPDF_StreamContentParser::Handle_EndText() { } if (m_pCurStates->m_TextState.GetObject()->m_TextMode < 4) { for (int i = 0; i < count; i++) { - CPDF_TextObject* pText = (CPDF_TextObject*)m_ClipTextList.GetAt(i); - delete pText; + delete m_ClipTextList.GetAt(i); } } else { - m_pCurStates->m_ClipPath.AppendTexts( - (CPDF_TextObject**)m_ClipTextList.GetData(), count); + m_pCurStates->m_ClipPath.AppendTexts(m_ClipTextList.GetData(), count); } m_ClipTextList.RemoveAll(); } @@ -950,7 +948,7 @@ void CPDF_StreamContentParser::Handle_RestoreGraphState() { if (size == 0) { return; } - CPDF_AllStates* pStates = (CPDF_AllStates*)m_StateStack.GetAt(size - 1); + CPDF_AllStates* pStates = m_StateStack.GetAt(size - 1); m_pCurStates->Copy(*pStates); delete pStates; m_StateStack.RemoveAt(size - 1); diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index 96c70c2245..208a09b8d8 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -321,7 +321,7 @@ class CPDF_StreamContentParser { CPDF_StreamParser* m_pSyntax; nonstd::unique_ptr<CPDF_AllStates> m_pCurStates; CPDF_ContentMark m_CurContentMark; - CFX_PtrArray m_ClipTextList; + CFX_ArrayTemplate<CPDF_TextObject*> m_ClipTextList; CPDF_TextObject* m_pLastTextObject; FX_FLOAT m_DefFontSize; int m_CompatCount; @@ -344,7 +344,7 @@ class CPDF_StreamContentParser { FX_BOOL m_bColored; FX_FLOAT m_Type3Data[6]; FX_BOOL m_bResourceMissing; - CFX_PtrArray m_StateStack; + CFX_ArrayTemplate<CPDF_AllStates*> m_StateStack; }; class CPDF_ContentParser { public: diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index 57d1971889..dbd5f311a6 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -335,7 +335,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, CPDF_Object* pParams = pDict ? pDict->GetElementValue(FX_BSTRC("DecodeParms")) : nullptr; CFX_ByteStringArray DecoderList; - CFX_PtrArray ParamList; + CFX_ArrayTemplate<CPDF_Object*> ParamList; if (CPDF_Array* pDecoders = pDecoder->AsArray()) { CPDF_Array* pParamsArray = ToArray(pParams); if (!pParamsArray) @@ -357,8 +357,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, i == DecoderList.GetSize() - 1 ? last_estimated_size : 0; CFX_ByteString decoder = DecoderList[i]; // Use ToDictionary here because we can push NULL into the ParamList. - CPDF_Dictionary* pParam = - ToDictionary(static_cast<CPDF_Object*>(ParamList[i])); + CPDF_Dictionary* pParam = ToDictionary(ParamList[i]); uint8_t* new_buf = nullptr; FX_DWORD new_size = (FX_DWORD)-1; int offset = -1; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index edf80d0618..752a09d83d 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -251,8 +251,7 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, const CPDF_Array* pThis = AsArray(); int n = pThis->GetCount(); for (int i = 0; i < n; i++) { - CPDF_Object* value = - static_cast<CPDF_Object*>(pThis->m_Objects.GetAt(i)); + CPDF_Object* value = pThis->m_Objects.GetAt(i); pCopy->m_Objects.Add(value->CloneInternal(bDirect, visited)); } return pCopy; @@ -424,7 +423,7 @@ CPDF_String::CPDF_String(const CFX_WideString& str) } CPDF_Array::~CPDF_Array() { int size = m_Objects.GetSize(); - CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); + CPDF_Object** pList = m_Objects.GetData(); for (int i = 0; i < size; i++) { if (pList[i]) pList[i]->Release(); @@ -453,32 +452,32 @@ CFX_AffineMatrix CPDF_Array::GetMatrix() { CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const { if (i >= (FX_DWORD)m_Objects.GetSize()) return nullptr; - return static_cast<CPDF_Object*>(m_Objects.GetAt(i)); + return m_Objects.GetAt(i); } CPDF_Object* CPDF_Array::GetElementValue(FX_DWORD i) const { if (i >= (FX_DWORD)m_Objects.GetSize()) return nullptr; - return static_cast<CPDF_Object*>(m_Objects.GetAt(i))->GetDirect(); + return m_Objects.GetAt(i)->GetDirect(); } CFX_ByteString CPDF_Array::GetString(FX_DWORD i) const { - if (i < (FX_DWORD)m_Objects.GetSize()) - return static_cast<CPDF_Object*>(m_Objects.GetAt(i))->GetString(); - return CFX_ByteString(); + if (i >= (FX_DWORD)m_Objects.GetSize()) + return CFX_ByteString(); + return m_Objects.GetAt(i)->GetString(); } CFX_ByteStringC CPDF_Array::GetConstString(FX_DWORD i) const { - if (i < (FX_DWORD)m_Objects.GetSize()) - return static_cast<CPDF_Object*>(m_Objects.GetAt(i))->GetConstString(); - return CFX_ByteStringC(); + if (i >= (FX_DWORD)m_Objects.GetSize()) + return CFX_ByteStringC(); + return m_Objects.GetAt(i)->GetConstString(); } int CPDF_Array::GetInteger(FX_DWORD i) const { if (i >= (FX_DWORD)m_Objects.GetSize()) return 0; - return static_cast<CPDF_Object*>(m_Objects.GetAt(i))->GetInteger(); + return m_Objects.GetAt(i)->GetInteger(); } FX_FLOAT CPDF_Array::GetNumber(FX_DWORD i) const { if (i >= (FX_DWORD)m_Objects.GetSize()) return 0; - return static_cast<CPDF_Object*>(m_Objects.GetAt(i))->GetNumber(); + return m_Objects.GetAt(i)->GetNumber(); } CPDF_Dictionary* CPDF_Array::GetDict(FX_DWORD i) const { CPDF_Object* p = GetElementValue(i); @@ -504,7 +503,7 @@ void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) { return; for (int j = 0; j < nCount; ++j) { - if (CPDF_Object* p = static_cast<CPDF_Object*>(m_Objects.GetAt(i + j))) + if (CPDF_Object* p = m_Objects.GetAt(i + j)) p->Release(); } m_Objects.RemoveAt(i, nCount); @@ -516,7 +515,7 @@ void CPDF_Array::SetAt(FX_DWORD i, ASSERT(i < (FX_DWORD)m_Objects.GetSize()); if (i >= (FX_DWORD)m_Objects.GetSize()) return; - if (CPDF_Object* pOld = static_cast<CPDF_Object*>(m_Objects.GetAt(i))) + if (CPDF_Object* pOld = m_Objects.GetAt(i)) pOld->Release(); if (pObj->GetObjNum()) { ASSERT(pObjs); @@ -568,11 +567,10 @@ FX_BOOL CPDF_Array::Identical(CPDF_Array* pOther) const { if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { return FALSE; } - for (int i = 0; i < m_Objects.GetSize(); i++) - if (!static_cast<CPDF_Object*>(m_Objects[i]) - ->IsIdentical(static_cast<CPDF_Object*>(pOther->m_Objects[i]))) { + for (int i = 0; i < m_Objects.GetSize(); i++) { + if (!m_Objects[i]->IsIdentical(pOther->m_Objects[i])) return FALSE; - } + } return TRUE; } CPDF_Dictionary::~CPDF_Dictionary() { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 04aca91082..f64ba0deb0 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -2693,10 +2693,10 @@ class CPDF_DataAvail final : public IPDF_DataAvail { static const int kMaxPageRecursionDepth = 1024; FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset); - FX_BOOL IsObjectsAvail(CFX_PtrArray& obj_array, + FX_BOOL IsObjectsAvail(CFX_ArrayTemplate<CPDF_Object*>& obj_array, FX_BOOL bParsePage, IFX_DownloadHints* pHints, - CFX_PtrArray& ret_array); + CFX_ArrayTemplate<CPDF_Object*>& ret_array); FX_BOOL CheckDocStatus(IFX_DownloadHints* pHints); FX_BOOL CheckHeader(IFX_DownloadHints* pHints); FX_BOOL CheckFirstPage(IFX_DownloadHints* pHints); @@ -2795,7 +2795,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { CPDF_SortObjNumArray m_objnum_array; - CFX_PtrArray m_objs_array; + CFX_ArrayTemplate<CPDF_Object*> m_objs_array; FX_FILESIZE m_Pos; @@ -2847,7 +2847,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { CPDF_Object* m_pAcroForm; - CFX_PtrArray m_arrayAcroforms; + CFX_ArrayTemplate<CPDF_Object*> m_arrayAcroforms; CPDF_Dictionary* m_pPageDict; @@ -2859,7 +2859,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { FX_BOOL m_bLinearizedFormParamLoad; - CFX_PtrArray m_PagesArray; + CFX_ArrayTemplate<CPDF_Object*> m_PagesArray; FX_DWORD m_dwEncryptObjNum; @@ -2954,7 +2954,7 @@ CPDF_DataAvail::~CPDF_DataAvail() { int iSize = m_arrayAcroforms.GetSize(); for (int i = 0; i < iSize; ++i) { - static_cast<CPDF_Object*>(m_arrayAcroforms.GetAt(i))->Release(); + m_arrayAcroforms.GetAt(i)->Release(); } } void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) { @@ -2991,18 +2991,19 @@ FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) { } return 0; } -FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, - FX_BOOL bParsePage, - IFX_DownloadHints* pHints, - CFX_PtrArray& ret_array) { +FX_BOOL CPDF_DataAvail::IsObjectsAvail( + CFX_ArrayTemplate<CPDF_Object*>& obj_array, + FX_BOOL bParsePage, + IFX_DownloadHints* pHints, + CFX_ArrayTemplate<CPDF_Object*>& ret_array) { if (!obj_array.GetSize()) { return TRUE; } FX_DWORD count = 0; - CFX_PtrArray new_obj_array; + CFX_ArrayTemplate<CPDF_Object*> new_obj_array; int32_t i = 0; for (i = 0; i < obj_array.GetSize(); i++) { - CPDF_Object* pObj = static_cast<CPDF_Object*>(obj_array[i]); + CPDF_Object* pObj = obj_array[i]; if (!pObj) continue; @@ -3056,7 +3057,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, if (count > 0) { int32_t iSize = new_obj_array.GetSize(); for (i = 0; i < iSize; ++i) { - CPDF_Object* pObj = static_cast<CPDF_Object*>(new_obj_array[i]); + CPDF_Object* pObj = new_obj_array[i]; if (CPDF_Reference* pRef = pObj->AsReference()) { FX_DWORD dwNum = pRef->GetRefObjNum(); if (!m_objnum_array.Find(dwNum)) @@ -3092,7 +3093,7 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints) { if (!m_objs_array.GetSize()) { m_objs_array.RemoveAll(); m_objnum_array.RemoveAll(); - CFX_PtrArray obj_array; + CFX_ArrayTemplate<CPDF_Object*> obj_array; obj_array.Append(m_arrayAcroforms); FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array); if (bRet) { @@ -3100,12 +3101,12 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints) { } return bRet; } - CFX_PtrArray new_objs_array; + CFX_ArrayTemplate<CPDF_Object*> new_objs_array; FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); if (bRet) { int32_t iSize = m_arrayAcroforms.GetSize(); for (int32_t i = 0; i < iSize; ++i) { - static_cast<CPDF_Object*>(m_arrayAcroforms.GetAt(i))->Release(); + m_arrayAcroforms.GetAt(i)->Release(); } m_arrayAcroforms.RemoveAll(); } else { @@ -3391,14 +3392,14 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints) { } FX_DWORD iPages = m_PagesArray.GetSize(); for (FX_DWORD i = 0; i < iPages; i++) { - CPDF_Object* pPages = static_cast<CPDF_Object*>(m_PagesArray.GetAt(i)); + CPDF_Object* pPages = m_PagesArray.GetAt(i); if (!pPages) continue; if (!GetPageKids(m_pCurrentParser, pPages)) { pPages->Release(); while (++i < iPages) { - pPages = static_cast<CPDF_Object*>(m_PagesArray.GetAt(i)); + pPages = m_PagesArray.GetAt(i); pPages->Release(); } m_PagesArray.RemoveAll(); @@ -4163,7 +4164,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode& pageNodes, return FALSE; } for (int32_t i = 0; i < iSize; ++i) { - CPDF_PageNode* pNode = (CPDF_PageNode*)pageNodes.m_childNode.GetAt(i); + CPDF_PageNode* pNode = pageNodes.m_childNode.GetAt(i); if (!pNode) { continue; } @@ -4310,7 +4311,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, if (!pAnnots) { return TRUE; } - CFX_PtrArray obj_array; + CFX_ArrayTemplate<CPDF_Object*> obj_array; obj_array.Add(pAnnots); FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array); if (bRet) { @@ -4318,7 +4319,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, } return bRet; } - CFX_PtrArray new_objs_array; + CFX_ArrayTemplate<CPDF_Object*> new_objs_array; FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); m_objs_array.RemoveAll(); if (!bRet) { @@ -4432,7 +4433,7 @@ int CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints) { ResetFirstCheck(iPage); return DataAvailable; } - CFX_PtrArray obj_array; + CFX_ArrayTemplate<CPDF_Object*> obj_array; obj_array.Add(m_pPageDict); FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array); if (bRet) { @@ -4442,7 +4443,7 @@ int CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints) { return bRet; } } else { - CFX_PtrArray new_objs_array; + CFX_ArrayTemplate<CPDF_Object*> new_objs_array; FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); m_objs_array.RemoveAll(); @@ -4487,7 +4488,7 @@ int CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints) { FX_BOOL CPDF_DataAvail::CheckResources(IFX_DownloadHints* pHints) { if (!m_objs_array.GetSize()) { m_objs_array.RemoveAll(); - CFX_PtrArray obj_array; + CFX_ArrayTemplate<CPDF_Object*> obj_array; obj_array.Add(m_pPageResource); FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array); if (bRet) { @@ -4495,7 +4496,7 @@ FX_BOOL CPDF_DataAvail::CheckResources(IFX_DownloadHints* pHints) { } return bRet; } - CFX_PtrArray new_objs_array; + CFX_ArrayTemplate<CPDF_Object*> new_objs_array; FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); m_objs_array.RemoveAll(); if (!bRet) { @@ -4570,7 +4571,7 @@ IPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( } m_bLinearizedFormParamLoad = TRUE; } - CFX_PtrArray new_objs_array; + CFX_ArrayTemplate<CPDF_Object*> new_objs_array; FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); m_objs_array.RemoveAll(); if (!bRet) { @@ -4609,10 +4610,8 @@ FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t& iNext) { return FALSE; } CPDF_PageNode::~CPDF_PageNode() { - int32_t iSize = m_childNode.GetSize(); - for (int32_t i = 0; i < iSize; ++i) { - CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; - delete pNode; + for (int32_t i = 0; i < m_childNode.GetSize(); ++i) { + delete m_childNode[i]; } m_childNode.RemoveAll(); } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index a714d38615..8cfa8dc4fb 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -358,10 +358,10 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text( const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device) { CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->GetType3Font(); - for (int j = 0; j < m_Type3FontCache.GetSize(); j++) - if ((CPDF_Type3Font*)m_Type3FontCache.GetAt(j) == pType3Font) { + for (int j = 0; j < m_Type3FontCache.GetSize(); j++) { + if (m_Type3FontCache.GetAt(j) == pType3Font) return TRUE; - } + } CFX_Matrix dCTM = m_pDevice->GetCTM(); FX_FLOAT sa = FXSYS_fabs(dCTM.a); FX_FLOAT sd = FXSYS_fabs(dCTM.d); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index dbc9f1102b..d764c9a5ff 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -137,11 +137,12 @@ class CPDF_RenderStatus { FX_BOOL ContinueSingleObject(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause); + CPDF_RenderContext* GetContext() { return m_pContext; } + CPDF_RenderOptions m_Options; CPDF_Dictionary* m_pFormResource; CPDF_Dictionary* m_pPageResource; - CFX_PtrArray m_Type3FontCache; - CPDF_RenderContext* GetContext() { return m_pContext; } + CFX_ArrayTemplate<CPDF_Type3Font*> m_Type3FontCache; protected: friend class CPDF_ImageRenderer; |