summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_dest.cpp44
-rw-r--r--core/fpdfdoc/cpdf_dest.h6
2 files changed, 22 insertions, 28 deletions
diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp
index 8dd58b185a..308336e5d9 100644
--- a/core/fpdfdoc/cpdf_dest.cpp
+++ b/core/fpdfdoc/cpdf_dest.cpp
@@ -34,16 +34,15 @@ CPDF_Dest::CPDF_Dest() {}
CPDF_Dest::CPDF_Dest(const CPDF_Dest& that) = default;
-CPDF_Dest::CPDF_Dest(const CPDF_Array* pObj) : m_pObj(pObj) {}
+CPDF_Dest::CPDF_Dest(const CPDF_Array* pArray) : m_pArray(pArray) {}
CPDF_Dest::~CPDF_Dest() {}
int CPDF_Dest::GetDestPageIndex(CPDF_Document* pDoc) const {
- const CPDF_Array* pArray = ToArray(m_pObj.Get());
- if (!pArray)
+ if (!m_pArray)
return -1;
- const CPDF_Object* pPage = pArray->GetDirectObjectAt(0);
+ const CPDF_Object* pPage = m_pArray->GetDirectObjectAt(0);
if (!pPage)
return -1;
@@ -57,11 +56,10 @@ int CPDF_Dest::GetDestPageIndex(CPDF_Document* pDoc) const {
}
uint32_t CPDF_Dest::GetPageObjNum() const {
- const CPDF_Array* pArray = ToArray(m_pObj.Get());
- if (!pArray)
+ if (!m_pArray)
return 0;
- const CPDF_Object* pPage = pArray->GetDirectObjectAt(0);
+ const CPDF_Object* pPage = m_pArray->GetDirectObjectAt(0);
if (!pPage)
return 0;
if (pPage->IsNumber())
@@ -72,15 +70,14 @@ uint32_t CPDF_Dest::GetPageObjNum() const {
}
int CPDF_Dest::GetZoomMode() const {
- const CPDF_Array* pArray = ToArray(m_pObj.Get());
- if (!pArray)
+ if (!m_pArray)
return 0;
- const CPDF_Object* pObj = pArray->GetDirectObjectAt(1);
- if (!pObj)
+ const CPDF_Object* pArray = m_pArray->GetDirectObjectAt(1);
+ if (!pArray)
return 0;
- ByteString mode = pObj->GetString();
+ ByteString mode = pArray->GetString();
for (int i = 1; g_sZoomModes[i]; ++i) {
if (mode == g_sZoomModes[i])
return i;
@@ -99,20 +96,19 @@ bool CPDF_Dest::GetXYZ(bool* pHasX,
*pHasY = false;
*pHasZoom = false;
- const CPDF_Array* pArray = ToArray(m_pObj.Get());
- if (!pArray)
+ if (!m_pArray)
return false;
- if (pArray->GetCount() < 5)
+ if (m_pArray->GetCount() < 5)
return false;
- const CPDF_Name* xyz = ToName(pArray->GetDirectObjectAt(1));
+ const CPDF_Name* xyz = ToName(m_pArray->GetDirectObjectAt(1));
if (!xyz || xyz->GetString() != "XYZ")
return false;
- const CPDF_Number* numX = ToNumber(pArray->GetDirectObjectAt(2));
- const CPDF_Number* numY = ToNumber(pArray->GetDirectObjectAt(3));
- const CPDF_Number* numZoom = ToNumber(pArray->GetDirectObjectAt(4));
+ const CPDF_Number* numX = ToNumber(m_pArray->GetDirectObjectAt(2));
+ const CPDF_Number* numY = ToNumber(m_pArray->GetDirectObjectAt(3));
+ const CPDF_Number* numZoom = ToNumber(m_pArray->GetDirectObjectAt(4));
// If the value is a CPDF_Null then ToNumber will return nullptr.
*pHasX = !!numX;
@@ -137,20 +133,18 @@ bool CPDF_Dest::GetXYZ(bool* pHasX,
}
unsigned long CPDF_Dest::GetNumParams() const {
- const CPDF_Array* pArray = ToArray(m_pObj.Get());
- if (!pArray || pArray->GetCount() < 2)
+ if (!m_pArray || m_pArray->GetCount() < 2)
return 0;
unsigned long maxParamsForFitType = g_sZoomModeMaxParamCount[GetZoomMode()];
- unsigned long numParamsInArray = pArray->GetCount() - 2;
+ unsigned long numParamsInArray = m_pArray->GetCount() - 2;
return std::min(maxParamsForFitType, numParamsInArray);
}
float CPDF_Dest::GetParam(int index) const {
- const CPDF_Array* pArray = ToArray(m_pObj.Get());
- return pArray ? pArray->GetNumberAt(2 + index) : 0;
+ return m_pArray ? m_pArray->GetNumberAt(2 + index) : 0;
}
ByteString CPDF_Dest::GetRemoteName() const {
- return m_pObj ? m_pObj->GetString() : ByteString();
+ return m_pArray ? m_pArray->GetString() : ByteString();
}
diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h
index c30db1183c..ff8458d500 100644
--- a/core/fpdfdoc/cpdf_dest.h
+++ b/core/fpdfdoc/cpdf_dest.h
@@ -18,10 +18,10 @@ class CPDF_Dest {
public:
CPDF_Dest();
CPDF_Dest(const CPDF_Dest& that);
- explicit CPDF_Dest(const CPDF_Array* pObj);
+ explicit CPDF_Dest(const CPDF_Array* pArray);
~CPDF_Dest();
- const CPDF_Array* GetObject() const { return m_pObj.Get(); }
+ const CPDF_Array* GetArray() const { return m_pArray.Get(); }
ByteString GetRemoteName() const;
int GetDestPageIndex(CPDF_Document* pDoc) const;
@@ -41,7 +41,7 @@ class CPDF_Dest {
float* pZoom) const;
private:
- UnownedPtr<const CPDF_Array> const m_pObj;
+ UnownedPtr<const CPDF_Array> const m_pArray;
};
#endif // CORE_FPDFDOC_CPDF_DEST_H_