Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1885)

Unified Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp

Issue 1417893003: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/include/fpdfapi/fpdf_objects.h ('k') | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
index 79bfbdb13a8cea3a336c4845df9ef4c1099b28c8..32802d00016385b7d0a298598bb83fc3563e4837 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);
« no previous file with comments | « core/include/fpdfapi/fpdf_objects.h ('k') | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698