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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp

Issue 1419643005: Merge to XFA: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
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_page/fpdf_page_parser_old.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index f051d0db5a1c394a159b26f23a9105cff9eba446..c27ede44cb4cfea3e5133f3cdeeb97bea277f5b4 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -332,16 +332,16 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
CFX_ByteString Decoder;
CPDF_Dictionary* pParam = NULL;
CPDF_Object* pFilter = pDict->GetElementValue(FX_BSTRC("Filter"));
- if (pFilter == NULL) {
- } else if (pFilter->GetType() == PDFOBJ_ARRAY) {
- Decoder = ((CPDF_Array*)pFilter)->GetString(0);
- CPDF_Array* pParams = pDict->GetArray(FX_BSTRC("DecodeParms"));
- if (pParams) {
- pParam = pParams->GetDict(0);
+ if (pFilter) {
+ if (CPDF_Array* pArray = pFilter->AsArray()) {
+ Decoder = pArray->GetString(0);
+ CPDF_Array* pParams = pDict->GetArray(FX_BSTRC("DecodeParms"));
+ if (pParams)
+ pParam = pParams->GetDict(0);
+ } else {
+ Decoder = pFilter->GetString();
+ pParam = pDict->GetDict(FX_BSTRC("DecodeParms"));
}
- } else {
- Decoder = pFilter->GetString();
- pParam = pDict->GetDict(FX_BSTRC("DecodeParms"));
}
FX_DWORD width = pDict->GetInteger(FX_BSTRC("Width"));
FX_DWORD height = pDict->GetInteger(FX_BSTRC("Height"));
@@ -403,12 +403,11 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
if (bDecode) {
m_Pos += dwStreamSize;
dwStreamSize = dwDestSize;
- if (pFilter->GetType() == PDFOBJ_ARRAY) {
- ((CPDF_Array*)pFilter)->RemoveAt(0);
+ if (CPDF_Array* pArray = pFilter->AsArray()) {
+ pArray->RemoveAt(0);
CPDF_Array* pParams = pDict->GetArray(FX_BSTRC("DecodeParms"));
- if (pParams) {
+ if (pParams)
pParams->RemoveAt(0);
- }
} else {
pDict->RemoveAt(FX_BSTRC("Filter"));
pDict->RemoveAt(FX_BSTRC("DecodeParms"));
@@ -965,8 +964,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) {
m_nStreams = 0;
m_pSingleStream = new CPDF_StreamAcc;
m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, FALSE);
- } else if (pContent->GetType() == PDFOBJ_ARRAY) {
- CPDF_Array* pArray = (CPDF_Array*)pContent;
+ } else if (CPDF_Array* pArray = pContent->AsArray()) {
m_nStreams = pArray->GetCount();
if (m_nStreams == 0) {
m_Status = Done;

Powered by Google App Engine
This is Rietveld 408576698