Chromium Code Reviews| Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp |
| diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp |
| index 5333fe808786f231ee62be815ee7773cda799baa..820b88ef7c1cb3174d9c2fe94e4ede081da4170d 100644 |
| --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp |
| +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp |
| @@ -190,9 +190,8 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, |
| } |
| if (count && count == pKidList->GetCount()) { |
| for (FX_DWORD i = 0; i < count; i++) { |
| - CPDF_Object* pKid = pKidList->GetElement(i); |
| - if (pKid && pKid->GetType() == PDFOBJ_REFERENCE) { |
| - if (((CPDF_Reference*)pKid)->GetRefObjNum() == objnum) { |
| + if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) { |
| + if (pKid->GetRefObjNum() == objnum) { |
| m_PageList.SetAt(index + i, objnum); |
| return index + i; |
| } |
| @@ -308,13 +307,11 @@ FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, |
| if (pContents->GetDirectType() == PDFOBJ_ARRAY) { |
| CPDF_Array* pArray = pContents->GetDirect()->AsArray(); |
| for (FX_DWORD j = 0; j < pArray->GetCount(); j++) { |
| - CPDF_Object* pRef = pArray->GetElement(j); |
| - if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) { |
| + CPDF_Reference* pRef = ToReference(pArray->GetElement(j)); |
| + if (!pRef) |
|
Tom Sepez
2015/10/22 21:49:14
nit: I think this is easier if you invert the test
dsinclair
2015/10/26 13:55:44
Done.
|
| continue; |
| - } |
| - if (((CPDF_Reference*)pRef)->GetRefObjNum() == objnum) { |
| + if (pRef->GetRefObjNum() == objnum) |
| return TRUE; |
| - } |
| } |
| } else if (pContents->GetObjNum() == objnum) { |
| return TRUE; |