diff options
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataimporter.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.cpp | 19 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.h | 5 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.h | 4 |
6 files changed, 15 insertions, 27 deletions
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index ad7bbd9531..fd3a1234b0 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -168,9 +168,8 @@ CXFA_FFDoc::~CXFA_FFDoc() { int32_t CXFA_FFDoc::Load() { m_pNotify = pdfium::MakeUnique<CXFA_FFNotify>(this); m_pDocumentParser = pdfium::MakeUnique<CXFA_DocumentParser>(m_pNotify.get()); - m_pDocumentParser->StartParse(m_pStream, XFA_PacketType::Xdp); - int32_t iStatus = m_pDocumentParser->DoParse(); + int32_t iStatus = m_pDocumentParser->Parse(m_pStream, XFA_PacketType::Xdp); if (iStatus != XFA_PARSESTATUS_Done) return iStatus; if (!m_pPDFDoc) diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp index 7c6e0ec12d..c5c23fcfb9 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp @@ -28,10 +28,7 @@ bool CXFA_DataImporter::ImportData( const RetainPtr<IFX_SeekableStream>& pDataDocument) { auto pDataDocumentParser = pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument.Get()); - if (pDataDocumentParser->StartParse( - pDataDocument, XFA_PacketType::Datasets) != XFA_PARSESTATUS_Ready) { - return false; - } + pDataDocumentParser->StartParse(pDataDocument, XFA_PacketType::Datasets); if (pDataDocumentParser->DoParse() < XFA_PARSESTATUS_Done) return false; diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index 3e4aa58dd9..8df91bc1cc 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -18,23 +18,18 @@ CXFA_DocumentParser::~CXFA_DocumentParser() { m_pDocument->ReleaseXMLNodesIfNeeded(); } -int32_t CXFA_DocumentParser::StartParse( - const RetainPtr<IFX_SeekableStream>& pStream, - XFA_PacketType ePacketID) { +int32_t CXFA_DocumentParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream, + XFA_PacketType ePacketID) { m_pDocument.reset(); m_nodeParser.CloseParser(); - int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID); - if (nRetStatus == XFA_PARSESTATUS_Ready) { - m_pDocument = pdfium::MakeUnique<CXFA_Document>(GetNotify()); - m_nodeParser.SetFactory(m_pDocument.get()); - } - return nRetStatus; -} + m_nodeParser.StartParse(pStream, ePacketID); + + m_pDocument = pdfium::MakeUnique<CXFA_Document>(GetNotify()); + m_nodeParser.SetFactory(m_pDocument.get()); -int32_t CXFA_DocumentParser::DoParse() { int32_t nRetStatus = m_nodeParser.DoParse(); - if (nRetStatus >= XFA_PARSESTATUS_Done) { + if (nRetStatus == XFA_PARSESTATUS_Done) { ASSERT(m_pDocument); m_pDocument->SetRoot(m_nodeParser.GetRootNode()); } diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h index 77265e4d05..c7056c215a 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.h +++ b/xfa/fxfa/parser/cxfa_document_parser.h @@ -22,9 +22,8 @@ class CXFA_DocumentParser { explicit CXFA_DocumentParser(CXFA_FFNotify* pNotify); ~CXFA_DocumentParser(); - int32_t StartParse(const RetainPtr<IFX_SeekableStream>& pStream, - XFA_PacketType ePacketID); - int32_t DoParse(); + int32_t Parse(const RetainPtr<IFX_SeekableStream>& pStream, + XFA_PacketType ePacketID); CXFA_FFNotify* GetNotify() const; CXFA_Document* GetDocument() const; diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index de9f74f291..a59ea9d951 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -339,9 +339,8 @@ void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { m_pFactory = pFactory; } -int32_t CXFA_SimpleParser::StartParse( - const RetainPtr<IFX_SeekableStream>& pStream, - XFA_PacketType ePacketID) { +void CXFA_SimpleParser::StartParse(const RetainPtr<IFX_SeekableStream>& pStream, + XFA_PacketType ePacketID) { CloseParser(); m_pFileRead = pStream; m_pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(pStream, false); @@ -355,7 +354,6 @@ int32_t CXFA_SimpleParser::StartParse( m_bParseStarted = true; m_ePacketID = ePacketID; - return XFA_PARSESTATUS_Ready; } int32_t CXFA_SimpleParser::DoParse() { diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h index 1300a8c4f2..c5c3eade87 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_simple_parser.h @@ -25,8 +25,8 @@ class CXFA_SimpleParser { explicit CXFA_SimpleParser(CXFA_Document* pFactory); ~CXFA_SimpleParser(); - int32_t StartParse(const RetainPtr<IFX_SeekableStream>& pStream, - XFA_PacketType ePacketID); + void StartParse(const RetainPtr<IFX_SeekableStream>& pStream, + XFA_PacketType ePacketID); int32_t DoParse(); CFX_XMLNode* ParseXMLData(const ByteString& wsXML); void ConstructXFANode(CXFA_Node* pXFANode, CFX_XMLNode* pXMLNode); |