Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1923)

Side by Side Diff: core/src/fpdfdoc/doc_action.cpp

Issue 984703004: Make conversion to CPDF_Dest explicit (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | core/src/fpdfdoc/doc_bookmark.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const 8 CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const
9 { 9 {
10 if (m_pDict == NULL) { 10 if (!m_pDict) {
11 return NULL; 11 return CPDF_Dest();
12 } 12 }
13 CFX_ByteString type = m_pDict->GetString("S"); 13 CFX_ByteString type = m_pDict->GetString("S");
14 if (type != "GoTo" && type != "GoToR") { 14 if (type != "GoTo" && type != "GoToR") {
15 return NULL; 15 return CPDF_Dest();
16 } 16 }
17 CPDF_Object* pDest = m_pDict->GetElementValue("D"); 17 CPDF_Object* pDest = m_pDict->GetElementValue("D");
18 if (pDest == NULL) { 18 if (!pDest) {
19 return NULL; 19 return CPDF_Dest();
20 } 20 }
21 if (pDest->GetType() == PDFOBJ_STRING || pDest->GetType() == PDFOBJ_NAME) { 21 if (pDest->GetType() == PDFOBJ_STRING || pDest->GetType() == PDFOBJ_NAME) {
22 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); 22 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
23 CFX_ByteStringC name = pDest->GetString(); 23 CFX_ByteStringC name = pDest->GetString();
24 return name_tree.LookupNamedDest(pDoc, name); 24 return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
25 } else if (pDest->GetType() == PDFOBJ_ARRAY) {
26 return (CPDF_Array*)pDest;
27 } 25 }
28 return NULL; 26 if (pDest->GetType() == PDFOBJ_ARRAY) {
27 return CPDF_Dest((CPDF_Array*)pDest);
28 }
29 return CPDF_Dest();
29 } 30 }
30 const FX_CHAR* g_sATypes[] = {"Unknown", "GoTo", "GoToR", "GoToE", "Launch", "Th read", "URI", "Sound", "Movie", 31 const FX_CHAR* g_sATypes[] = {"Unknown", "GoTo", "GoToR", "GoToE", "Launch", "Th read", "URI", "Sound", "Movie",
31 "Hide", "Named", "SubmitForm", "ResetForm", "Imp ortData", "JavaScript", "SetOCGState", 32 "Hide", "Named", "SubmitForm", "ResetForm", "Imp ortData", "JavaScript", "SetOCGState",
32 "Rendition", "Trans", "GoTo3DView", "" 33 "Rendition", "Trans", "GoTo3DView", ""
33 }; 34 };
34 CPDF_Action::ActionType CPDF_Action::GetType() const 35 CPDF_Action::ActionType CPDF_Action::GetType() const
35 { 36 {
36 ActionType eType = Unknown; 37 ActionType eType = Unknown;
37 if (m_pDict != NULL) { 38 if (m_pDict != NULL) {
38 CFX_ByteString csType = m_pDict->GetString("S"); 39 CFX_ByteString csType = m_pDict->GetString("S");
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 return CPDF_Action(); 356 return CPDF_Action();
356 } 357 }
357 return CPDF_Action(pAction->GetDict()); 358 return CPDF_Action(pAction->GetDict());
358 } 359 }
359 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const 360 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const
360 { 361 {
361 ASSERT(m_pDocument != NULL); 362 ASSERT(m_pDocument != NULL);
362 CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript")); 363 CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
363 return name_tree.GetIndex(csName); 364 return name_tree.GetIndex(csName);
364 } 365 }
OLDNEW
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | core/src/fpdfdoc/doc_bookmark.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698