summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_action.cpp
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 /core/src/fpdfdoc/doc_action.cpp
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 'core/src/fpdfdoc/doc_action.cpp')
-rw-r--r--core/src/fpdfdoc/doc_action.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
index 324153563a..ac40335a4c 100644
--- a/core/src/fpdfdoc/doc_action.cpp
+++ b/core/src/fpdfdoc/doc_action.cpp
@@ -7,25 +7,26 @@
#include "../../include/fpdfdoc/fpdf_doc.h"
CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const
{
- if (m_pDict == NULL) {
- return NULL;
+ if (!m_pDict) {
+ return CPDF_Dest();
}
CFX_ByteString type = m_pDict->GetString("S");
if (type != "GoTo" && type != "GoToR") {
- return NULL;
+ return CPDF_Dest();
}
CPDF_Object* pDest = m_pDict->GetElementValue("D");
- if (pDest == NULL) {
- return NULL;
+ if (!pDest) {
+ return CPDF_Dest();
}
if (pDest->GetType() == PDFOBJ_STRING || pDest->GetType() == PDFOBJ_NAME) {
CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
CFX_ByteStringC name = pDest->GetString();
- return name_tree.LookupNamedDest(pDoc, name);
- } else if (pDest->GetType() == PDFOBJ_ARRAY) {
- return (CPDF_Array*)pDest;
+ return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
}
- return NULL;
+ if (pDest->GetType() == PDFOBJ_ARRAY) {
+ return CPDF_Dest((CPDF_Array*)pDest);
+ }
+ return CPDF_Dest();
}
const FX_CHAR* g_sATypes[] = {"Unknown", "GoTo", "GoToR", "GoToE", "Launch", "Thread", "URI", "Sound", "Movie",
"Hide", "Named", "SubmitForm", "ResetForm", "ImportData", "JavaScript", "SetOCGState",