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

Side by Side Diff: fpdfsdk/src/fpdf_ext.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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 | « fpdfsdk/src/fpdf_dataavail.cpp ('k') | fpdfsdk/src/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 "../../core/include/fxcrt/fx_xml.h" 7 #include "../../core/include/fxcrt/fx_xml.h"
8 #include "../../public/fpdf_ext.h" 8 #include "../../public/fpdf_ext.h"
9 #include "../include/fsdk_define.h" 9 #include "../include/fsdk_define.h"
10 10
11 #define FPDFSDK_UNSUPPORT_CALL 100 11 #define FPDFSDK_UNSUPPORT_CALL 100
12 12
13 class CFSDK_UnsupportInfo_Adapter 13 class CFSDK_UnsupportInfo_Adapter
14 { 14 {
15 public: 15 public:
16 CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info){ m_unsp_info = un sp_info;} 16 CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info){ m_unsp_info = un sp_info;}
17 //» FX_BOOL NeedToPauseNow(); 17 //» bool NeedToPauseNow();
18 void ReportError(int nErrorType); 18 void ReportError(int nErrorType);
19 19
20 private: 20 private:
21 UNSUPPORT_INFO* m_unsp_info; 21 UNSUPPORT_INFO* m_unsp_info;
22 }; 22 };
23 23
24 void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType) 24 void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType)
25 { 25 {
26 if(m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler) 26 if(m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler)
27 { 27 {
28 m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info,nErrorType); 28 m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info,nErrorType);
29 } 29 }
30 } 30 }
31 31
32 void FreeUnsupportInfo(void* pData) 32 void FreeUnsupportInfo(void* pData)
33 { 33 {
34 CFSDK_UnsupportInfo_Adapter * pAdapter = (CFSDK_UnsupportInfo_Adapter *) pData; 34 CFSDK_UnsupportInfo_Adapter * pAdapter = (CFSDK_UnsupportInfo_Adapter *) pData;
35 delete pAdapter; 35 delete pAdapter;
36 } 36 }
37 37
38 FX_BOOL FPDF_UnSupportError(int nError) 38 bool FPDF_UnSupportError(int nError)
39 { 39 {
40 CFSDK_UnsupportInfo_Adapter * pAdapter = (CFSDK_UnsupportInfo_Adapter *) CPDF_ModuleMgr::Get()->GetPrivateData((void *)FPDFSDK_UNSUPPORT_CALL); 40 CFSDK_UnsupportInfo_Adapter * pAdapter = (CFSDK_UnsupportInfo_Adapter *) CPDF_ModuleMgr::Get()->GetPrivateData((void *)FPDFSDK_UNSUPPORT_CALL);
41 41
42 if(!pAdapter) 42 if(!pAdapter)
43 » » return FALSE; 43 » » return false;
44 pAdapter->ReportError(nError); 44 pAdapter->ReportError(nError);
45 » return TRUE; 45 » return true;
46 } 46 }
47 47
48 DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_i nfo) 48 DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_i nfo)
49 { 49 {
50 if (!unsp_info || unsp_info->version!=1) 50 if (!unsp_info || unsp_info->version!=1)
51 » » return FALSE; 51 » » return false;
52 CFSDK_UnsupportInfo_Adapter * pAdapter = new CFSDK_UnsupportInfo_Adapter (unsp_info); 52 CFSDK_UnsupportInfo_Adapter * pAdapter = new CFSDK_UnsupportInfo_Adapter (unsp_info);
53 53
54 CPDF_ModuleMgr::Get()->SetPrivateData((void *)FPDFSDK_UNSUPPORT_CALL,pAd apter, &FreeUnsupportInfo); 54 CPDF_ModuleMgr::Get()->SetPrivateData((void *)FPDFSDK_UNSUPPORT_CALL,pAd apter, &FreeUnsupportInfo);
55 55
56 » return TRUE; 56 » return true;
57 } 57 }
58 58
59 void CheckUnSupportAnnot(CPDF_Document * pDoc, CPDF_Annot* pPDFAnnot) 59 void CheckUnSupportAnnot(CPDF_Document * pDoc, CPDF_Annot* pPDFAnnot)
60 { 60 {
61 CFX_ByteString cbSubType = pPDFAnnot->GetSubType(); 61 CFX_ByteString cbSubType = pPDFAnnot->GetSubType();
62 if(cbSubType.Compare("3D") == 0) 62 if(cbSubType.Compare("3D") == 0)
63 { 63 {
64 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); 64 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
65 } 65 }
66 else if(cbSubType.Compare("Screen") ==0) 66 else if(cbSubType.Compare("Screen") ==0)
(...skipping 30 matching lines...) Expand all
97 cbString = pAnnotDict->GetString("FT"); 97 cbString = pAnnotDict->GetString("FT");
98 } 98 }
99 if(cbString.Compare("Sig") == 0) 99 if(cbString.Compare("Sig") == 0)
100 { 100 {
101 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); 101 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG);
102 } 102 }
103 } 103 }
104 104
105 } 105 }
106 106
107 FX_BOOL CheckSharedForm(CXML_Element * pElement, CFX_ByteString cbName) 107 bool CheckSharedForm(CXML_Element * pElement, CFX_ByteString cbName)
108 { 108 {
109 int count = pElement->CountAttrs(); 109 int count = pElement->CountAttrs();
110 int i=0; 110 int i=0;
111 for (i = 0; i < count; i++) 111 for (i = 0; i < count; i++)
112 { 112 {
113 CFX_ByteString space, name; 113 CFX_ByteString space, name;
114 CFX_WideString value; 114 CFX_WideString value;
115 pElement->GetAttrByIndex(i, space, name, value); 115 pElement->GetAttrByIndex(i, space, name, value);
116 if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") && value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") 116 if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") && value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/")
117 { 117 {
(...skipping 18 matching lines...) Expand all
136 } 136 }
137 137
138 FX_DWORD nCount = pElement->CountChildren(); 138 FX_DWORD nCount = pElement->CountChildren();
139 for(i=0; i<(int)nCount; i++) 139 for(i=0; i<(int)nCount; i++)
140 { 140 {
141 CXML_Element::ChildType childType = pElement->GetChildType(i); 141 CXML_Element::ChildType childType = pElement->GetChildType(i);
142 if(childType == CXML_Element::Element) 142 if(childType == CXML_Element::Element)
143 { 143 {
144 CXML_Element * pChild = pElement->GetElement(i); 144 CXML_Element * pChild = pElement->GetElement(i);
145 if(CheckSharedForm(pChild, cbName)) 145 if(CheckSharedForm(pChild, cbName))
146 » » » » return TRUE; 146 » » » » return true;
147 } 147 }
148 } 148 }
149 » return FALSE; 149 » return false;
150 } 150 }
151 151
152 void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code) 152 void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code)
153 { 153 {
154 // Security 154 // Security
155 if(err_code == FPDF_ERR_SECURITY) 155 if(err_code == FPDF_ERR_SECURITY)
156 { 156 {
157 FPDF_UnSupportError(FPDF_UNSP_DOC_SECURITY); 157 FPDF_UnSupportError(FPDF_UNSP_DOC_SECURITY);
158 return ; 158 return ;
159 } 159 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 // SharedForm 201 // SharedForm
202 CPDF_Metadata metaData; 202 CPDF_Metadata metaData;
203 metaData.LoadDoc(pDoc); 203 metaData.LoadDoc(pDoc);
204 CXML_Element * pElement = metaData.GetRoot(); 204 CXML_Element * pElement = metaData.GetRoot();
205 if(pElement) 205 if(pElement)
206 CheckSharedForm(pElement, "workflowType"); 206 CheckSharedForm(pElement, "workflowType");
207 207
208 // XFA Forms 208 // XFA Forms
209 » CPDF_InterForm * pInterForm = new CPDF_InterForm(pDoc,FALSE); 209 » CPDF_InterForm * pInterForm = new CPDF_InterForm(pDoc,false);
210 if (pInterForm->HasXFAForm()) 210 if (pInterForm->HasXFAForm())
211 { 211 {
212 FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM); 212 FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM);
213 } 213 }
214 delete pInterForm; 214 delete pInterForm;
215 } 215 }
216 216
217 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) 217 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document)
218 { 218 {
219 if (!document) 219 if (!document)
(...skipping 16 matching lines...) Expand all
236 return PAGEMODE_USETHUMBS; 236 return PAGEMODE_USETHUMBS;
237 if (strPageMode.EqualNoCase("FullScreen")) 237 if (strPageMode.EqualNoCase("FullScreen"))
238 return PAGEMODE_FULLSCREEN; 238 return PAGEMODE_FULLSCREEN;
239 if (strPageMode.EqualNoCase("UseOC")) 239 if (strPageMode.EqualNoCase("UseOC"))
240 return PAGEMODE_USEOC; 240 return PAGEMODE_USEOC;
241 if (strPageMode.EqualNoCase("UseAttachments")) 241 if (strPageMode.EqualNoCase("UseAttachments"))
242 return PAGEMODE_USEATTACHMENTS; 242 return PAGEMODE_USEATTACHMENTS;
243 243
244 return PAGEMODE_UNKNOWN; 244 return PAGEMODE_UNKNOWN;
245 } 245 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_dataavail.cpp ('k') | fpdfsdk/src/fpdf_flatten.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698