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

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

Issue 1402413004: Add type cast definitions for CPDF_Stream. (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
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 32802d00016385b7d0a298598bb83fc3563e4837..383284e6f92dc78409985b411364ec50e5fa40e9 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
@@ -131,12 +131,13 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) {
int i = 0;
for (i = 0; i < iCount; ++i) {
pContent = pArray->GetElement(i);
- if (!pContent || pContent->GetType() != PDFOBJ_STREAM) {
+ CPDF_Stream* pStream = ToStream(pContent);
+ if (!pStream)
continue;
- }
- CPDF_StreamAcc* pStream = new CPDF_StreamAcc();
- pStream->LoadAllData((CPDF_Stream*)pContent);
- pContentArray[i] = pStream;
+
+ CPDF_StreamAcc* pStreamAcc = new CPDF_StreamAcc();
+ pStreamAcc->LoadAllData(pStream);
+ pContentArray[i] = pStreamAcc;
size += pContentArray[i]->GetSize() + 1;
}
int pos = 0;
@@ -151,9 +152,9 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) {
ProcessForm(buf, pBuf, size, matrix);
FX_Free(pBuf);
FX_Free(pContentArray);
- } else if (pContent->GetType() == PDFOBJ_STREAM) {
+ } else if (CPDF_Stream* pStream = pContent->AsStream()) {
CPDF_StreamAcc contentStream;
- contentStream.LoadAllData((CPDF_Stream*)pContent);
+ contentStream.LoadAllData(pStream);
ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix);
}
CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);

Powered by Google App Engine
This is Rietveld 408576698