summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/parser/cxfa_dataimporter.cpp9
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp14
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.h8
4 files changed, 12 insertions, 23 deletions
diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp
index c5c23fcfb9..01e95b1c3a 100644
--- a/xfa/fxfa/parser/cxfa_dataimporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp
@@ -26,13 +26,12 @@ CXFA_DataImporter::~CXFA_DataImporter() {}
bool CXFA_DataImporter::ImportData(
const RetainPtr<IFX_SeekableStream>& pDataDocument) {
- auto pDataDocumentParser =
- pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument.Get());
- pDataDocumentParser->StartParse(pDataDocument, XFA_PacketType::Datasets);
- if (pDataDocumentParser->DoParse() < XFA_PARSESTATUS_Done)
+ CXFA_SimpleParser parser(m_pDocument.Get());
+ int status = parser.Parse(pDataDocument, XFA_PacketType::Datasets);
+ if (status < XFA_PARSESTATUS_Done)
return false;
- CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode();
+ CXFA_Node* pImportDataRoot = parser.GetRootNode();
if (!pImportDataRoot)
return false;
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index 8df91bc1cc..18f9955210 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -23,12 +23,10 @@ int32_t CXFA_DocumentParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream,
m_pDocument.reset();
m_nodeParser.CloseParser();
- m_nodeParser.StartParse(pStream, ePacketID);
-
m_pDocument = pdfium::MakeUnique<CXFA_Document>(GetNotify());
m_nodeParser.SetFactory(m_pDocument.get());
- int32_t nRetStatus = m_nodeParser.DoParse();
+ int32_t nRetStatus = m_nodeParser.Parse(pStream, ePacketID);
if (nRetStatus == XFA_PARSESTATUS_Done) {
ASSERT(m_pDocument);
m_pDocument->SetRoot(m_nodeParser.GetRootNode());
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index a59ea9d951..7021285dff 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -339,8 +339,8 @@ void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) {
m_pFactory = pFactory;
}
-void CXFA_SimpleParser::StartParse(const RetainPtr<IFX_SeekableStream>& pStream,
- XFA_PacketType ePacketID) {
+int32_t CXFA_SimpleParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream,
+ XFA_PacketType ePacketID) {
CloseParser();
m_pFileRead = pStream;
m_pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(pStream, false);
@@ -351,13 +351,7 @@ void CXFA_SimpleParser::StartParse(const RetainPtr<IFX_SeekableStream>& pStream,
}
m_pXMLDoc = pdfium::MakeUnique<CFX_XMLDoc>(m_pStream);
-
- m_bParseStarted = true;
- m_ePacketID = ePacketID;
-}
-
-int32_t CXFA_SimpleParser::DoParse() {
- if (!m_pXMLDoc || !m_bParseStarted)
+ if (!m_pXMLDoc)
return XFA_PARSESTATUS_StatusErr;
int32_t iRet = m_pXMLDoc->DoLoad();
@@ -366,7 +360,7 @@ int32_t CXFA_SimpleParser::DoParse() {
if (iRet < 100)
return iRet / 2;
- m_pRootNode = ParseAsXDPPacket(GetDocumentNode(m_pXMLDoc.get()), m_ePacketID);
+ m_pRootNode = ParseAsXDPPacket(GetDocumentNode(m_pXMLDoc.get()), ePacketID);
m_pXMLDoc->CloseXML();
m_pStream.Reset();
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h
index c5c3eade87..cef9c9af54 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.h
+++ b/xfa/fxfa/parser/cxfa_simple_parser.h
@@ -25,9 +25,9 @@ class CXFA_SimpleParser {
explicit CXFA_SimpleParser(CXFA_Document* pFactory);
~CXFA_SimpleParser();
- void StartParse(const RetainPtr<IFX_SeekableStream>& pStream,
- XFA_PacketType ePacketID);
- int32_t DoParse();
+ int32_t Parse(const RetainPtr<IFX_SeekableStream>& pStream,
+ XFA_PacketType ePacketID);
+
CFX_XMLNode* ParseXMLData(const ByteString& wsXML);
void ConstructXFANode(CXFA_Node* pXFANode, CFX_XMLNode* pXMLNode);
CXFA_Node* GetRootNode() const;
@@ -77,8 +77,6 @@ class CXFA_SimpleParser {
UnownedPtr<CXFA_Document> m_pFactory;
// TODO(dsinclair): Figure out who owns this.
CXFA_Node* m_pRootNode = nullptr;
- XFA_PacketType m_ePacketID = XFA_PacketType::User;
- bool m_bParseStarted = false;
const bool m_bDocumentParser;
};