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

Side by Side Diff: fpdfsdk/fpdf_ext.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month 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 | « fpdfsdk/fpdf_dataavail.cpp ('k') | fpdfsdk/fpdf_flatten.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 "public/fpdf_ext.h" 7 #include "public/fpdf_ext.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "core/fpdfapi/cpdf_modulemgr.h" 11 #include "core/fpdfapi/cpdf_modulemgr.h"
12 #include "core/fpdfapi/parser/cpdf_array.h" 12 #include "core/fpdfapi/parser/cpdf_array.h"
13 #include "core/fpdfapi/parser/cpdf_document.h" 13 #include "core/fpdfapi/parser/cpdf_document.h"
14 #include "core/fpdfdoc/cpdf_annot.h" 14 #include "core/fpdfdoc/cpdf_annot.h"
15 #include "core/fpdfdoc/cpdf_interform.h" 15 #include "core/fpdfdoc/cpdf_interform.h"
16 #include "core/fpdfdoc/cpdf_metadata.h" 16 #include "core/fpdfdoc/cpdf_metadata.h"
17 #include "core/fxcrt/fx_basic.h" 17 #include "core/fxcrt/fx_basic.h"
18 #include "core/fxcrt/fx_memory.h" 18 #include "core/fxcrt/fx_memory.h"
19 #include "core/fxcrt/fx_xml.h" 19 #include "core/fxcrt/fx_xml.h"
20 #include "fpdfsdk/fsdk_define.h" 20 #include "fpdfsdk/fsdk_define.h"
21 #include "third_party/base/ptr_util.h" 21 #include "third_party/base/ptr_util.h"
22 22
23 #ifdef PDF_ENABLE_XFA 23 #ifdef PDF_ENABLE_XFA
24 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" 24 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
25 #endif // PDF_ENABLE_XFA 25 #endif // PDF_ENABLE_XFA
26 26
27 FX_BOOL FPDF_UnSupportError(int nError) { 27 bool FPDF_UnSupportError(int nError) {
28 CFSDK_UnsupportInfo_Adapter* pAdapter = 28 CFSDK_UnsupportInfo_Adapter* pAdapter =
29 CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter(); 29 CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter();
30 if (!pAdapter) 30 if (!pAdapter)
31 return FALSE; 31 return false;
32 32
33 UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(pAdapter->GetUnspInfo()); 33 UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(pAdapter->GetUnspInfo());
34 if (info && info->FSDK_UnSupport_Handler) 34 if (info && info->FSDK_UnSupport_Handler)
35 info->FSDK_UnSupport_Handler(info, nError); 35 info->FSDK_UnSupport_Handler(info, nError);
36 return TRUE; 36 return true;
37 } 37 }
38 38
39 DLLEXPORT FPDF_BOOL STDCALL 39 DLLEXPORT FPDF_BOOL STDCALL
40 FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { 40 FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) {
41 if (!unsp_info || unsp_info->version != 1) 41 if (!unsp_info || unsp_info->version != 1)
42 return FALSE; 42 return false;
43 43
44 CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter( 44 CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter(
45 pdfium::MakeUnique<CFSDK_UnsupportInfo_Adapter>(unsp_info)); 45 pdfium::MakeUnique<CFSDK_UnsupportInfo_Adapter>(unsp_info));
46 return TRUE; 46 return true;
47 } 47 }
48 48
49 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { 49 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) {
50 CPDF_Annot::Subtype nAnnotSubtype = pPDFAnnot->GetSubtype(); 50 CPDF_Annot::Subtype nAnnotSubtype = pPDFAnnot->GetSubtype();
51 if (nAnnotSubtype == CPDF_Annot::Subtype::THREED) { 51 if (nAnnotSubtype == CPDF_Annot::Subtype::THREED) {
52 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); 52 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
53 } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) { 53 } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) {
54 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); 54 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
55 CFX_ByteString cbString; 55 CFX_ByteString cbString;
56 if (pAnnotDict->KeyExist("IT")) 56 if (pAnnotDict->KeyExist("IT"))
(...skipping 11 matching lines...) Expand all
68 } else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) { 68 } else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) {
69 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); 69 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
70 CFX_ByteString cbString; 70 CFX_ByteString cbString;
71 if (pAnnotDict->KeyExist("FT")) 71 if (pAnnotDict->KeyExist("FT"))
72 cbString = pAnnotDict->GetStringFor("FT"); 72 cbString = pAnnotDict->GetStringFor("FT");
73 if (cbString.Compare("Sig") == 0) 73 if (cbString.Compare("Sig") == 0)
74 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); 74 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG);
75 } 75 }
76 } 76 }
77 77
78 FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { 78 bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
79 int count = pElement->CountAttrs(); 79 int count = pElement->CountAttrs();
80 int i = 0; 80 int i = 0;
81 for (i = 0; i < count; i++) { 81 for (i = 0; i < count; i++) {
82 CFX_ByteString space, name; 82 CFX_ByteString space, name;
83 CFX_WideString value; 83 CFX_WideString value;
84 pElement->GetAttrByIndex(i, space, name, value); 84 pElement->GetAttrByIndex(i, space, name, value);
85 if (space == "xmlns" && name == "adhocwf" && 85 if (space == "xmlns" && name == "adhocwf" &&
86 value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") { 86 value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
87 CXML_Element* pVersion = 87 CXML_Element* pVersion =
88 pElement->GetElement("adhocwf", cbName.AsStringC()); 88 pElement->GetElement("adhocwf", cbName.AsStringC());
(...skipping 14 matching lines...) Expand all
103 } 103 }
104 } 104 }
105 } 105 }
106 106
107 uint32_t nCount = pElement->CountChildren(); 107 uint32_t nCount = pElement->CountChildren();
108 for (i = 0; i < (int)nCount; i++) { 108 for (i = 0; i < (int)nCount; i++) {
109 CXML_Element::ChildType childType = pElement->GetChildType(i); 109 CXML_Element::ChildType childType = pElement->GetChildType(i);
110 if (childType == CXML_Element::Element) { 110 if (childType == CXML_Element::Element) {
111 CXML_Element* pChild = pElement->GetElement(i); 111 CXML_Element* pChild = pElement->GetElement(i);
112 if (CheckSharedForm(pChild, cbName)) 112 if (CheckSharedForm(pChild, cbName))
113 return TRUE; 113 return true;
114 } 114 }
115 } 115 }
116 return FALSE; 116 return false;
117 } 117 }
118 118
119 void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { 119 void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) {
120 // Security 120 // Security
121 if (err_code == FPDF_ERR_SECURITY) { 121 if (err_code == FPDF_ERR_SECURITY) {
122 FPDF_UnSupportError(FPDF_UNSP_DOC_SECURITY); 122 FPDF_UnSupportError(FPDF_UNSP_DOC_SECURITY);
123 return; 123 return;
124 } 124 }
125 if (!pDoc) 125 if (!pDoc)
126 return; 126 return;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return PAGEMODE_USETHUMBS; 191 return PAGEMODE_USETHUMBS;
192 if (strPageMode.EqualNoCase("FullScreen")) 192 if (strPageMode.EqualNoCase("FullScreen"))
193 return PAGEMODE_FULLSCREEN; 193 return PAGEMODE_FULLSCREEN;
194 if (strPageMode.EqualNoCase("UseOC")) 194 if (strPageMode.EqualNoCase("UseOC"))
195 return PAGEMODE_USEOC; 195 return PAGEMODE_USEOC;
196 if (strPageMode.EqualNoCase("UseAttachments")) 196 if (strPageMode.EqualNoCase("UseAttachments"))
197 return PAGEMODE_USEATTACHMENTS; 197 return PAGEMODE_USEATTACHMENTS;
198 198
199 return PAGEMODE_UNKNOWN; 199 return PAGEMODE_UNKNOWN;
200 } 200 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_dataavail.cpp ('k') | fpdfsdk/fpdf_flatten.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698