summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-09-30 16:06:36 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-30 16:06:36 -0700
commit3a88205e8ddce125d78fb6961f7eac2470bbcd55 (patch)
tree9c56dffcf92a95289eaf42d4e9587bcf7f02da2c
parentaa69291d2c0f86259351a857acc3f9f073b56a55 (diff)
downloadpdfium-3a88205e8ddce125d78fb6961f7eac2470bbcd55.tar.xz
Move CPDF_Reference::SafeGetDirect() out of the header.chromium/2879chromium/2878
Review-Url: https://codereview.chromium.org/2386433002
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_reference.cpp5
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_reference.h11
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<const CPDF_Object*>* 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;