diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-22 15:34:16 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-22 15:34:16 -0400 |
commit | 338805f1366dcdf9a5b48cf591541cf98d7490f1 (patch) | |
tree | 161b722bbb0628b290084b20fa8aa8f1d436c896 /core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | |
parent | c6d8683dbdd922c86375fb0520d420de13d683ed (diff) | |
download | pdfium-338805f1366dcdf9a5b48cf591541cf98d7490f1.tar.xz |
Add type cast definitions for CPDF_Stream.
This Cl adds ToStream, CPDF_Object::AsStream and CPDF_Object::IsStream and
updates the src to use them as needed.
BUG=pdfium:201
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1402413004 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index 32802d0001..383284e6f9 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); |