summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-26 13:02:07 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-26 13:02:07 -0400
commit7e155865c90cc1115cc7193b7646a341d8f9093e (patch)
tree44e4351192f0af909671df95a1aac16a1609f750 /core/src/fpdfdoc
parent9024e026dae1af064b8467bb0f62278417fb82d1 (diff)
downloadpdfium-7e155865c90cc1115cc7193b7646a341d8f9093e.tar.xz
Revert "Add type cast definitions for CPDF_Reference."
This is causing pixel test failures on the bots. FAILURE: bug_543018_2.in FAILURE: bug_543018_1.in FAILURE: bug_524043_1.in This reverts commit 9024e026dae1af064b8467bb0f62278417fb82d1. Add type cast definitions for CPDF_Reference. This Cl adds ToReference, CPDF_Object::AsReference and CPDF_Object::IsReference and updates the src to use them as needed. BUG=pdfium:201 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1420973002 . Review URL: https://codereview.chromium.org/1414393006 .
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r--core/src/fpdfdoc/doc_form.cpp7
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp30
2 files changed, 20 insertions, 17 deletions
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 3192445d90..8078608883 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -1086,12 +1086,13 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
}
pField = new CPDF_FormField(this, pParent);
CPDF_Object* pTObj = pDict->GetElement("T");
- if (ToReference(pTObj)) {
+ if (pTObj && pTObj->GetType() == PDFOBJ_REFERENCE) {
CPDF_Object* pClone = pTObj->Clone(TRUE);
- if (pClone)
+ if (pClone) {
pDict->SetAt("T", pClone);
- else
+ } else {
pDict->SetAtName("T", "");
+ }
}
m_pFieldTree->SetField(csWName, pField);
}
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index f1877c6573..f74aa7f6f5 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -173,10 +173,10 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict,
FX_DWORD i;
FX_BOOL bSave = FALSE;
for (i = 0; i < pTopKids->GetCount(); i++) {
- CPDF_Reference* pKidRef = ToReference(pTopKids->GetElement(i));
- if (!pKidRef)
+ CPDF_Object* pKidRef = pTopKids->GetElement(i);
+ if (!pKidRef || pKidRef->GetType() != PDFOBJ_REFERENCE)
continue;
- if (pKidRef->GetRefObjNum() != pDict->GetObjNum())
+ if (((CPDF_Reference*)pKidRef)->GetRefObjNum() != pDict->GetObjNum())
continue;
if (m_Kids[i])
@@ -225,8 +225,8 @@ void CPDF_StructElementImpl::Release() {
void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) {
CPDF_Object* pObj = pDict->GetElement(FX_BSTRC("Pg"));
FX_DWORD PageObjNum = 0;
- if (CPDF_Reference* pRef = ToReference(pObj))
- PageObjNum = pRef->GetRefObjNum();
+ if (pObj && pObj->GetType() == PDFOBJ_REFERENCE)
+ PageObjNum = ((CPDF_Reference*)pObj)->GetRefObjNum();
CPDF_Object* pKids = pDict->GetElementValue(FX_BSTRC("K"));
if (!pKids)
@@ -264,18 +264,20 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum,
if (!pKidDict)
return;
- if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement(FX_BSTRC("Pg"))))
- PageObjNum = pRef->GetRefObjNum();
-
+ CPDF_Object* pPageObj = pKidDict->GetElement(FX_BSTRC("Pg"));
+ if (pPageObj && pPageObj->GetType() == PDFOBJ_REFERENCE) {
+ PageObjNum = ((CPDF_Reference*)pPageObj)->GetRefObjNum();
+ }
CFX_ByteString type = pKidDict->GetString(FX_BSTRC("Type"));
if (type == FX_BSTRC("MCR")) {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
pKid->m_Type = CPDF_StructKid::StreamContent;
- if (CPDF_Reference* pRef =
- ToReference(pKidDict->GetElement(FX_BSTRC("Stm")))) {
- pKid->m_StreamContent.m_RefObjNum = pRef->GetRefObjNum();
+ CPDF_Object* pStreamObj = pKidDict->GetElement(FX_BSTRC("Stm"));
+ if (pStreamObj && pStreamObj->GetType() == PDFOBJ_REFERENCE) {
+ pKid->m_StreamContent.m_RefObjNum =
+ ((CPDF_Reference*)pStreamObj)->GetRefObjNum();
} else {
pKid->m_StreamContent.m_RefObjNum = 0;
}
@@ -286,9 +288,9 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum,
return;
}
pKid->m_Type = CPDF_StructKid::Object;
- if (CPDF_Reference* pObj =
- ToReference(pKidDict->GetElement(FX_BSTRC("Obj")))) {
- pKid->m_Object.m_RefObjNum = pObj->GetRefObjNum();
+ CPDF_Object* pObj = pKidDict->GetElement(FX_BSTRC("Obj"));
+ if (pObj && pObj->GetType() == PDFOBJ_REFERENCE) {
+ pKid->m_Object.m_RefObjNum = ((CPDF_Reference*)pObj)->GetRefObjNum();
} else {
pKid->m_Object.m_RefObjNum = 0;
}