summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-03-06 10:34:48 -0800
committerTom Sepez <tsepez@chromium.org>2015-03-06 10:34:48 -0800
commit5a370d77d0db7550e91888f0ff50ee305f0f9f3d (patch)
tree8904d0b898864938c5ad8b4eb26c0ae9fbcb21b4 /fpdfsdk
parent7348faecc70ca3bff5aa3715da32032f0c897c23 (diff)
downloadpdfium-5a370d77d0db7550e91888f0ff50ee305f0f9f3d.tar.xz
Make conversion between CPDF_Dest and its object explicit.
Precursor to taking a second shot at cleaning up the FPDF_* APIs. A FPDF_Dest is a CPDF_Array, and a CPDF_Dest is a structure holding a FPDF_Dest. This goes against the convention that FPDF_ types get cast to CPDF_* types, so we want to make it clear where objects are getting constructed, etc. R=thestig@chromium.org Review URL: https://codereview.chromium.org/984703004
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/src/fpdfdoc.cpp12
-rw-r--r--fpdfsdk/src/fsdk_actionhandler.cpp2
2 files changed, 7 insertions, 7 deletions
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index f21d5cf938..ab3dd2c5b8 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -84,12 +84,12 @@ DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BO
CPDF_Document* pDoc = (CPDF_Document*)document;
CPDF_Dest dest = bookmark.GetDest(pDoc);
if (dest)
- return dest;
+ return dest.GetObject();
// If this bookmark is not directly associated with a dest, we try to get action
CPDF_Action action = bookmark.GetAction();
if (!action)
return NULL;
- return action.GetDest(pDoc);
+ return action.GetDest(pDoc).GetObject();
}
DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK pDict)
@@ -129,7 +129,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTI
return NULL;
CPDF_Document* pDoc = (CPDF_Document*)document;
CPDF_Action action((CPDF_Dictionary*)pDict);
- return action.GetDest(pDoc);
+ return action.GetDest(pDoc).GetObject();
}
DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION pDict,
@@ -155,7 +155,7 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FP
if (!pDict)
return 0;
CPDF_Document* pDoc = (CPDF_Document*)document;
- CPDF_Dest dest = (CPDF_Array*)pDict;
+ CPDF_Dest dest((CPDF_Array*)pDict);
return dest.GetPageIndex(pDoc);
}
@@ -188,14 +188,14 @@ DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK p
return NULL;
CPDF_Link link = (CPDF_Dictionary*)pDict;
- FPDF_DEST dest = link.GetDest(pDoc);
+ FPDF_DEST dest = link.GetDest(pDoc).GetObject();
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)
return NULL;
- return action.GetDest(pDoc);
+ return action.GetDest(pDoc).GetObject();
}
DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict)
diff --git a/fpdfsdk/src/fsdk_actionhandler.cpp b/fpdfsdk/src/fsdk_actionhandler.cpp
index e3fdad393d..fb8bcb2cb7 100644
--- a/fpdfsdk/src/fsdk_actionhandler.cpp
+++ b/fpdfsdk/src/fsdk_actionhandler.cpp
@@ -564,7 +564,7 @@ void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument,
CPDF_Dest MyDest = action.GetDest(pPDFDocument);
int nPageIndex = MyDest.GetPageIndex(pPDFDocument);
int nFitType = MyDest.GetZoomMode();
- const CPDF_Array * pMyArray = (CPDF_Array*)MyDest.m_pObj;
+ const CPDF_Array * pMyArray = (CPDF_Array*)MyDest.GetObject();
float* pPosAry = NULL;
int sizeOfAry = 0;
if (pMyArray != NULL)