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

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

Issue 1419643005: Merge to XFA: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 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
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 <vector> 7 #include <vector>
8 8
9 #include "../../../third_party/base/nonstd_unique_ptr.h" 9 #include "../../../third_party/base/nonstd_unique_ptr.h"
10 #include "../../include/fpdfdoc/fpdf_doc.h" 10 #include "../../include/fpdfdoc/fpdf_doc.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 return CFX_WideString(); 61 return CFX_WideString();
62 } 62 }
63 nonstd::unique_ptr<FX_WCHAR[]> buf(new FX_WCHAR[len]); 63 nonstd::unique_ptr<FX_WCHAR[]> buf(new FX_WCHAR[len]);
64 for (int i = 0; i < len; i++) { 64 for (int i = 0; i < len; i++) {
65 FX_WCHAR w = title[i]; 65 FX_WCHAR w = title[i];
66 buf[i] = w > 0x20 ? w : 0x20; 66 buf[i] = w > 0x20 ? w : 0x20;
67 } 67 }
68 return CFX_WideString(buf.get(), len); 68 return CFX_WideString(buf.get(), len);
69 } 69 }
70 CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const { 70 CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
71 if (!m_pDict) { 71 if (!m_pDict)
72 return CPDF_Dest(); 72 return CPDF_Dest();
73 } 73
74 CPDF_Object* pDest = m_pDict->GetElementValue("Dest"); 74 CPDF_Object* pDest = m_pDict->GetElementValue("Dest");
75 if (!pDest) 75 if (!pDest)
76 return CPDF_Dest(); 76 return CPDF_Dest();
77
78 if (pDest->IsString() || pDest->IsName()) { 77 if (pDest->IsString() || pDest->IsName()) {
79 CPDF_NameTree name_tree(pDocument, FX_BSTRC("Dests")); 78 CPDF_NameTree name_tree(pDocument, FX_BSTRC("Dests"));
80 CFX_ByteStringC name = pDest->GetString(); 79 CFX_ByteStringC name = pDest->GetString();
81 return CPDF_Dest(name_tree.LookupNamedDest(pDocument, name)); 80 return CPDF_Dest(name_tree.LookupNamedDest(pDocument, name));
82 } 81 }
83 if (pDest->GetType() == PDFOBJ_ARRAY) { 82 if (CPDF_Array* pArray = pDest->AsArray())
84 return CPDF_Dest((CPDF_Array*)pDest); 83 return CPDF_Dest(pArray);
85 }
86 return CPDF_Dest(); 84 return CPDF_Dest();
87 } 85 }
88 CPDF_Action CPDF_Bookmark::GetAction() const { 86 CPDF_Action CPDF_Bookmark::GetAction() const {
89 if (!m_pDict) { 87 if (!m_pDict) {
90 return CPDF_Action(); 88 return CPDF_Action();
91 } 89 }
92 return CPDF_Action(m_pDict->GetDict("A")); 90 return CPDF_Action(m_pDict->GetDict("A"));
93 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698