From 3a88205e8ddce125d78fb6961f7eac2470bbcd55 Mon Sep 17 00:00:00 2001 From: thestig Date: Fri, 30 Sep 2016 16:06:36 -0700 Subject: Move CPDF_Reference::SafeGetDirect() out of the header. Review-Url: https://codereview.chromium.org/2386433002 --- core/fpdfapi/fpdf_parser/cpdf_reference.cpp | 5 +++++ core/fpdfapi/fpdf_parser/cpdf_reference.h | 11 +++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp index 06625a96ea..4f826dc86c 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp @@ -67,6 +67,11 @@ CPDF_Object* CPDF_Reference::CloneNonCyclic( return new CPDF_Reference(m_pObjList, m_RefObjNum); } +CPDF_Object* CPDF_Reference::SafeGetDirect() const { + CPDF_Object* obj = GetDirect(); + return (obj && !obj->IsReference()) ? obj : nullptr; +} + void CPDF_Reference::SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum) { m_pObjList = pDoc; m_RefObjNum = objnum; diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.h b/core/fpdfapi/fpdf_parser/cpdf_reference.h index af52f90c52..1322b97c6f 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_reference.h +++ b/core/fpdfapi/fpdf_parser/cpdf_reference.h @@ -25,8 +25,6 @@ class CPDF_Reference : public CPDF_Object { FX_FLOAT GetNumber() const override; int GetInteger() const override; CPDF_Dictionary* GetDict() const override; - - // TODO(weili): check whether GetUnicodeText() and GetArray() are needed. bool IsReference() const override; CPDF_Reference* AsReference() override; const CPDF_Reference* AsReference() const override; @@ -38,15 +36,12 @@ class CPDF_Reference : public CPDF_Object { protected: ~CPDF_Reference() override; + CPDF_Object* CloneNonCyclic( bool bDirect, std::set* pVisited) const override; - CPDF_Object* SafeGetDirect() const { - CPDF_Object* obj = GetDirect(); - if (!obj || obj->IsReference()) - return nullptr; - return obj; - } + + CPDF_Object* SafeGetDirect() const; CPDF_IndirectObjectHolder* m_pObjList; uint32_t m_RefObjNum; -- cgit v1.2.3