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

Side by Side Diff: xfa/fxfa/parser/xfa_parser_imp.cpp

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 | « xfa/fxfa/parser/xfa_parser_imp.h ('k') | xfa/fxfa/parser/xfa_script.h » ('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 "xfa/fxfa/parser/xfa_parser_imp.h" 7 #include "xfa/fxfa/parser/xfa_parser_imp.h"
8 8
9 #include "xfa/fde/xml/fde_xml_imp.h" 9 #include "xfa/fde/xml/fde_xml_imp.h"
10 #include "xfa/fgas/crt/fgas_codepage.h" 10 #include "xfa/fgas/crt/fgas_codepage.h"
11 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 11 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
12 #include "xfa/fxfa/parser/xfa_basic_imp.h" 12 #include "xfa/fxfa/parser/xfa_basic_imp.h"
13 #include "xfa/fxfa/parser/xfa_docdata.h" 13 #include "xfa/fxfa/parser/xfa_docdata.h"
14 #include "xfa/fxfa/parser/xfa_doclayout.h" 14 #include "xfa/fxfa/parser/xfa_doclayout.h"
15 #include "xfa/fxfa/parser/xfa_document.h" 15 #include "xfa/fxfa/parser/xfa_document.h"
16 #include "xfa/fxfa/parser/xfa_localemgr.h" 16 #include "xfa/fxfa/parser/xfa_localemgr.h"
17 #include "xfa/fxfa/parser/xfa_object.h" 17 #include "xfa/fxfa/parser/xfa_object.h"
18 #include "xfa/fxfa/parser/xfa_parser.h" 18 #include "xfa/fxfa/parser/xfa_parser.h"
19 #include "xfa/fxfa/parser/xfa_script.h" 19 #include "xfa/fxfa/parser/xfa_script.h"
20 #include "xfa/fxfa/parser/xfa_utils.h" 20 #include "xfa/fxfa/parser/xfa_utils.h"
21 #include "xfa/include/fxfa/xfa_checksum.h"
21 22
22 IXFA_Parser* IXFA_Parser::Create(IXFA_ObjFactory* pFactory, 23 IXFA_Parser* IXFA_Parser::Create(CXFA_Document* pFactory,
23 FX_BOOL bDocumentParser) { 24 FX_BOOL bDocumentParser) {
24 return new CXFA_SimpleParser(pFactory, bDocumentParser); 25 return new CXFA_SimpleParser(pFactory, bDocumentParser);
25 } 26 }
26 CXFA_SimpleParser::CXFA_SimpleParser(IXFA_ObjFactory* pFactory, 27 CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory,
27 FX_BOOL bDocumentParser) 28 FX_BOOL bDocumentParser)
28 : m_pXMLParser(nullptr), 29 : m_pXMLParser(nullptr),
29 m_pXMLDoc(nullptr), 30 m_pXMLDoc(nullptr),
30 m_pStream(nullptr), 31 m_pStream(nullptr),
31 m_pFileRead(nullptr), 32 m_pFileRead(nullptr),
32 m_pFactory(pFactory), 33 m_pFactory(pFactory),
33 m_pRootNode(nullptr), 34 m_pRootNode(nullptr),
34 m_ePacketID(XFA_XDPPACKET_UNKNOWN), 35 m_ePacketID(XFA_XDPPACKET_UNKNOWN),
35 m_bDocumentParser(bDocumentParser) {} 36 m_bDocumentParser(bDocumentParser) {}
36 CXFA_SimpleParser::~CXFA_SimpleParser() { 37 CXFA_SimpleParser::~CXFA_SimpleParser() {
37 CloseParser(); 38 CloseParser();
38 } 39 }
39 void CXFA_SimpleParser::SetFactory(IXFA_ObjFactory* pFactory) { 40 void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) {
40 m_pFactory = pFactory; 41 m_pFactory = pFactory;
41 } 42 }
42 static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( 43 static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode(
43 CFDE_XMLDoc* pXMLDoc, 44 CFDE_XMLDoc* pXMLDoc,
44 FX_BOOL bVerifyWellFormness = FALSE) { 45 FX_BOOL bVerifyWellFormness = FALSE) {
45 if (!pXMLDoc) { 46 if (!pXMLDoc) {
46 return NULL; 47 return NULL;
47 } 48 }
48 CFDE_XMLNode* pXMLFakeRoot = pXMLDoc->GetRoot(); 49 CFDE_XMLNode* pXMLFakeRoot = pXMLDoc->GetRoot();
49 for (CFDE_XMLNode* pXMLNode = 50 for (CFDE_XMLNode* pXMLNode =
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI, 558 XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI,
558 XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) { 559 XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) {
559 CFDE_XMLElement* pXMLDocumentElement = 560 CFDE_XMLElement* pXMLDocumentElement =
560 static_cast<CFDE_XMLElement*>(pXMLDocumentNode); 561 static_cast<CFDE_XMLElement*>(pXMLDocumentNode);
561 CFX_WideString wsChecksum; 562 CFX_WideString wsChecksum;
562 pXMLDocumentElement->GetString(L"checksum", wsChecksum); 563 pXMLDocumentElement->GetString(L"checksum", wsChecksum);
563 if (wsChecksum.GetLength() != 28 || 564 if (wsChecksum.GetLength() != 28 ||
564 m_pXMLParser->m_dwCheckStatus != 0x03) { 565 m_pXMLParser->m_dwCheckStatus != 0x03) {
565 return NULL; 566 return NULL;
566 } 567 }
567 IXFA_ChecksumContext* pChecksum = XFA_Checksum_Create(); 568 CXFA_ChecksumContext* pChecksum = new CXFA_ChecksumContext;
568 pChecksum->StartChecksum(); 569 pChecksum->StartChecksum();
569 pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0], 570 pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0],
570 m_pXMLParser->m_nSize[0]); 571 m_pXMLParser->m_nSize[0]);
571 pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[1], 572 pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[1],
572 m_pXMLParser->m_nSize[1]); 573 m_pXMLParser->m_nSize[1]);
573 pChecksum->FinishChecksum(); 574 pChecksum->FinishChecksum();
574 CFX_ByteString bsCheck; 575 CFX_ByteString bsCheck;
575 pChecksum->GetChecksum(bsCheck); 576 pChecksum->GetChecksum(bsCheck);
576 pChecksum->Release(); 577 pChecksum->Release();
577 if (bsCheck != wsChecksum.UTF8Encode()) { 578 if (bsCheck != wsChecksum.UTF8Encode()) {
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 void CXFA_SimpleParser::CloseParser() { 1336 void CXFA_SimpleParser::CloseParser() {
1336 if (m_pXMLDoc) { 1337 if (m_pXMLDoc) {
1337 m_pXMLDoc->Release(); 1338 m_pXMLDoc->Release();
1338 m_pXMLDoc = NULL; 1339 m_pXMLDoc = NULL;
1339 } 1340 }
1340 if (m_pStream) { 1341 if (m_pStream) {
1341 m_pStream->Release(); 1342 m_pStream->Release();
1342 m_pStream = NULL; 1343 m_pStream = NULL;
1343 } 1344 }
1344 } 1345 }
1345 IXFA_DocParser* IXFA_DocParser::Create(IXFA_Notify* pNotify) { 1346
1346 return new CXFA_DocumentParser(pNotify); 1347 CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify)
1347 }
1348 CXFA_DocumentParser::CXFA_DocumentParser(IXFA_Notify* pNotify)
1349 : m_nodeParser(NULL, TRUE), m_pNotify(pNotify), m_pDocument(NULL) {} 1348 : m_nodeParser(NULL, TRUE), m_pNotify(pNotify), m_pDocument(NULL) {}
1350 CXFA_DocumentParser::~CXFA_DocumentParser() { 1349 CXFA_DocumentParser::~CXFA_DocumentParser() {
1351 CloseParser(); 1350 CloseParser();
1352 } 1351 }
1353 int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream, 1352 int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream,
1354 XFA_XDPPACKET ePacketID) { 1353 XFA_XDPPACKET ePacketID) {
1355 CloseParser(); 1354 CloseParser();
1356 int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID); 1355 int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID);
1357 if (nRetStatus == XFA_PARSESTATUS_Ready) { 1356 if (nRetStatus == XFA_PARSESTATUS_Ready) {
1358 m_pDocument = new CXFA_Document(this); 1357 m_pDocument = new CXFA_Document(this);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 break; 1555 break;
1557 } 1556 }
1558 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) { 1557 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) {
1559 break; 1558 break;
1560 } 1559 }
1561 } 1560 }
1562 return (m_dwStatus == FDE_XMLSYNTAXSTATUS_Error || m_NodeStack.GetSize() != 1) 1561 return (m_dwStatus == FDE_XMLSYNTAXSTATUS_Error || m_NodeStack.GetSize() != 1)
1563 ? -1 1562 ? -1
1564 : m_pParser->GetStatus(); 1563 : m_pParser->GetStatus();
1565 } 1564 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_parser_imp.h ('k') | xfa/fxfa/parser/xfa_script.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698