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

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

Issue 1282653002: Remove dead code from CPDF_Metadata. Add missing nullptr check. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 4 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 "../../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
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 CFX_ByteString cbString; 81 CFX_ByteString cbString;
82 if (pAnnotDict->KeyExist("FT")) { 82 if (pAnnotDict->KeyExist("FT")) {
83 cbString = pAnnotDict->GetString("FT"); 83 cbString = pAnnotDict->GetString("FT");
84 } 84 }
85 if (cbString.Compare("Sig") == 0) { 85 if (cbString.Compare("Sig") == 0) {
86 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); 86 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG);
87 } 87 }
88 } 88 }
89 } 89 }
90 90
91 FX_BOOL CheckSharedForm(CXML_Element* pElement, CFX_ByteString cbName) { 91 FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
92 int count = pElement->CountAttrs(); 92 int count = pElement->CountAttrs();
93 int i = 0; 93 int i = 0;
94 for (i = 0; i < count; i++) { 94 for (i = 0; i < count; i++) {
95 CFX_ByteString space, name; 95 CFX_ByteString space, name;
96 CFX_WideString value; 96 CFX_WideString value;
97 pElement->GetAttrByIndex(i, space, name, value); 97 pElement->GetAttrByIndex(i, space, name, value);
98 if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") && 98 if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") &&
99 value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") { 99 value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
100 CXML_Element* pVersion = pElement->GetElement("adhocwf", cbName); 100 CXML_Element* pVersion = pElement->GetElement("adhocwf", cbName);
101 if (!pVersion) 101 if (!pVersion)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); 162 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW);
163 return; 163 return;
164 } 164 }
165 } 165 }
166 } 166 }
167 } 167 }
168 } 168 }
169 } 169 }
170 170
171 // SharedForm 171 // SharedForm
172 CPDF_Metadata metaData; 172 CPDF_Metadata metaData(pDoc);
173 metaData.LoadDoc(pDoc); 173 const CXML_Element* pElement = metaData.GetRoot();
174 CXML_Element* pElement = metaData.GetRoot();
175 if (pElement) 174 if (pElement)
176 CheckSharedForm(pElement, "workflowType"); 175 CheckSharedForm(pElement, "workflowType");
177 176
178 // XFA Forms 177 // XFA Forms
179 CPDF_InterForm* pInterForm = new CPDF_InterForm(pDoc, FALSE); 178 CPDF_InterForm* pInterForm = new CPDF_InterForm(pDoc, FALSE);
180 if (pInterForm->HasXFAForm()) { 179 if (pInterForm->HasXFAForm()) {
181 FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM); 180 FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM);
182 } 181 }
183 delete pInterForm; 182 delete pInterForm;
184 } 183 }
(...skipping 19 matching lines...) Expand all
204 return PAGEMODE_USETHUMBS; 203 return PAGEMODE_USETHUMBS;
205 if (strPageMode.EqualNoCase("FullScreen")) 204 if (strPageMode.EqualNoCase("FullScreen"))
206 return PAGEMODE_FULLSCREEN; 205 return PAGEMODE_FULLSCREEN;
207 if (strPageMode.EqualNoCase("UseOC")) 206 if (strPageMode.EqualNoCase("UseOC"))
208 return PAGEMODE_USEOC; 207 return PAGEMODE_USEOC;
209 if (strPageMode.EqualNoCase("UseAttachments")) 208 if (strPageMode.EqualNoCase("UseAttachments"))
210 return PAGEMODE_USEATTACHMENTS; 209 return PAGEMODE_USEATTACHMENTS;
211 210
212 return PAGEMODE_UNKNOWN; 211 return PAGEMODE_UNKNOWN;
213 } 212 }
OLDNEW
« core/src/fpdfdoc/doc_metadata.cpp ('K') | « core/src/fpdfdoc/doc_metadata.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698