summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfdoc/cpdf_dest.cpp44
-rw-r--r--core/fpdfdoc/cpdf_dest.h6
-rw-r--r--fpdfsdk/cpdfsdk_actionhandler.cpp2
-rw-r--r--fpdfsdk/fpdf_doc.cpp12
-rw-r--r--fxjs/cjs_document.cpp2
5 files changed, 30 insertions, 36 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_
diff --git a/fpdfsdk/cpdfsdk_actionhandler.cpp b/fpdfsdk/cpdfsdk_actionhandler.cpp
index 64d82b93ba..f951bfb9fe 100644
--- a/fpdfsdk/cpdfsdk_actionhandler.cpp
+++ b/fpdfsdk/cpdfsdk_actionhandler.cpp
@@ -364,7 +364,7 @@ void CPDFSDK_ActionHandler::DoAction_GoTo(
CPDF_Dest MyDest = action.GetDest(pPDFDocument);
int nPageIndex = MyDest.GetDestPageIndex(pPDFDocument);
int nFitType = MyDest.GetZoomMode();
- const CPDF_Array* pMyArray = ToArray(MyDest.GetObject());
+ const CPDF_Array* pMyArray = MyDest.GetArray();
std::vector<float> posArray;
if (pMyArray) {
for (size_t i = 2; i < pMyArray->GetCount(); i++)
diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp
index 1f0d4f27e0..d3c8e23818 100644
--- a/fpdfsdk/fpdf_doc.cpp
+++ b/fpdfsdk/fpdf_doc.cpp
@@ -121,14 +121,14 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFBookmark_GetDest(FPDF_DOCUMENT document,
return nullptr;
CPDF_Bookmark bookmark(CPDFDictionaryFromFPDFBookmark(pDict));
CPDF_Dest dest = bookmark.GetDest(pDoc);
- if (dest.GetObject())
- return FPDFDestFromCPDFArray(dest.GetObject());
+ if (dest.GetArray())
+ return FPDFDestFromCPDFArray(dest.GetArray());
// If this bookmark is not directly associated with a dest, we try to get
// action
CPDF_Action action = bookmark.GetAction();
if (!action.GetDict())
return nullptr;
- return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetObject());
+ return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
}
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV
@@ -167,7 +167,7 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
if (!pDoc)
return nullptr;
CPDF_Action action(CPDFDictionaryFromFPDFAction(pDict));
- return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetObject());
+ return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
}
FPDF_EXPORT unsigned long FPDF_CALLCONV
@@ -302,14 +302,14 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document,
if (!pDoc)
return nullptr;
CPDF_Link link(CPDFDictionaryFromFPDFLink(pDict));
- FPDF_DEST dest = FPDFDestFromCPDFArray(link.GetDest(pDoc).GetObject());
+ FPDF_DEST dest = FPDFDestFromCPDFArray(link.GetDest(pDoc).GetArray());
if (dest)
return dest;
// If this link is not directly associated with a dest, we try to get action
CPDF_Action action = link.GetAction();
if (!action.GetDict())
return nullptr;
- return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetObject());
+ return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
}
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK pDict) {
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 486da1159c..c839e9f487 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -1458,7 +1458,7 @@ CJS_Result CJS_Document::gotoNamedDest(
return CJS_Result::Failure(JSMessage::kBadObjectError);
CPDF_Dest dest(destArray);
- const CPDF_Array* arrayObject = ToArray(dest.GetObject());
+ const CPDF_Array* arrayObject = dest.GetArray();
std::vector<float> scrollPositionArray;
if (arrayObject) {
for (size_t i = 2; i < arrayObject->GetCount(); i++)