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

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

Issue 1418923005: Revert "Revert "Add type cast definitions for CPDF_Reference."" (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_page/fpdf_page_parser.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 3295b7f9e034875582758e7efa8cffddfc95c80d..b12a65a84438098c63bac2e12efaee5760bc6f3f 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -671,51 +671,28 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
CFX_ByteString name = GetString(0);
if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() &&
m_pLastImage->GetStream()->GetObjNum()) {
- AddImage(NULL, m_pLastImage, FALSE);
+ AddImage(nullptr, m_pLastImage, FALSE);
return;
}
+
if (m_Options.m_bTextOnly) {
- CPDF_Object* pRes = NULL;
- if (m_pResources == NULL) {
+ if (!m_pResources)
return;
- }
- if (m_pResources == m_pPageResources) {
- CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject"));
- if (pList == NULL) {
- return;
- }
- pRes = pList->GetElement(name);
- if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) {
- return;
- }
- } else {
- CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject"));
- if (pList == NULL) {
- if (m_pPageResources == NULL) {
- return;
- }
- CPDF_Dictionary* pList = m_pPageResources->GetDict(FX_BSTRC("XObject"));
- if (pList == NULL) {
- return;
- }
- pRes = pList->GetElement(name);
- if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) {
- return;
- }
- } else {
- pRes = pList->GetElement(name);
- if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) {
- return;
- }
- }
- }
+
+ CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject"));
+ if (!pList && m_pPageResources && m_pResources != m_pPageResources)
+ pList = m_pPageResources->GetDict(FX_BSTRC("XObject"));
+ if (!pList)
+ return;
+ CPDF_Reference* pRes = ToReference(pList->GetElement(name));
+ if (!pRes)
+ return;
+
FX_BOOL bForm;
- if (m_pDocument->IsFormStream(((CPDF_Reference*)pRes)->GetRefObjNum(),
- bForm) &&
- !bForm) {
+ if (m_pDocument->IsFormStream(pRes->GetRefObjNum(), bForm) && !bForm)
return;
- }
}
+
CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name));
if (!pXObject) {
m_bResourceMissing = TRUE;
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698