summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-22 15:02:06 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-22 15:02:06 -0400
commit2b11dc1220746d2f6f97a940fc9e4235c8ed4975 (patch)
treee25b2ba13112f4ead789260ee57fe5b40c13b83e /core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
parentbc6c6723c37772b02de9e6e43fa0fd9439874905 (diff)
downloadpdfium-2b11dc1220746d2f6f97a940fc9e4235c8ed4975.tar.xz
Merge to XFA: Add type cast definitions for CPDF_Array.
This Cl adds ToArray, CPDF_Object::AsArray and CPDF_Object::IsArray and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1417893003 . (cherry picked from commit c2bfc000e502c42c9a3017038fd9104c7997d126) Review URL: https://codereview.chromium.org/1419643005 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
index 79bfbdb13a..32802d0001 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
@@ -120,13 +120,11 @@ void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf,
void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) {
CPDF_Dictionary* pDict = m_pPage->m_pFormDict;
CPDF_Object* pContent = pDict ? pDict->GetElementValue("Contents") : NULL;
- if (!pContent) {
+ if (!pContent)
return;
- }
+
CFX_ByteTextBuf buf;
- int type = pContent->GetType();
- if (type == PDFOBJ_ARRAY) {
- CPDF_Array* pArray = (CPDF_Array*)pContent;
+ if (CPDF_Array* pArray = pContent->AsArray()) {
int iCount = pArray->GetCount();
CPDF_StreamAcc** pContentArray = FX_Alloc(CPDF_StreamAcc*, iCount);
int size = 0;
@@ -153,7 +151,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) {
ProcessForm(buf, pBuf, size, matrix);
FX_Free(pBuf);
FX_Free(pContentArray);
- } else if (type == PDFOBJ_STREAM) {
+ } else if (pContent->GetType() == PDFOBJ_STREAM) {
CPDF_StreamAcc contentStream;
contentStream.LoadAllData((CPDF_Stream*)pContent);
ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix);