summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp25
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.h14
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp23
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp10
-rw-r--r--xfa/fxfa/parser/xfa_utils.h1
5 files changed, 11 insertions, 62 deletions
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 4f10d0ddfe..7773aeb190 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -15,35 +15,24 @@
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/xfa_utils.h"
-CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument)
- : m_pDocument(pDocument) {
- ASSERT(m_pDocument);
-}
-
-CXFA_DataExporter::~CXFA_DataExporter() {}
+CXFA_DataExporter::CXFA_DataExporter() = default;
-bool CXFA_DataExporter::Export(const RetainPtr<IFX_SeekableStream>& pWrite) {
- return Export(pWrite, m_pDocument->GetRoot(), 0, nullptr);
-}
+CXFA_DataExporter::~CXFA_DataExporter() = default;
bool CXFA_DataExporter::Export(const RetainPtr<IFX_SeekableStream>& pWrite,
- CXFA_Node* pNode,
- uint32_t dwFlag,
- const char* pChecksum) {
+ CXFA_Node* pNode) {
ASSERT(pWrite);
if (!pWrite)
return false;
auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(pWrite, true);
pStream->SetCodePage(FX_CODEPAGE_UTF8);
- return Export(pStream, pNode, dwFlag, pChecksum);
+ return Export(pStream, pNode);
}
bool CXFA_DataExporter::Export(
const RetainPtr<CFX_SeekableStreamProxy>& pStream,
- CXFA_Node* pNode,
- uint32_t dwFlag,
- const char* pChecksum) {
+ CXFA_Node* pNode) {
if (pNode->IsModelNode()) {
switch (pNode->GetPacketType()) {
case XFA_PacketType::Xdp: {
@@ -51,7 +40,7 @@ bool CXFA_DataExporter::Export(
L"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">");
for (CXFA_Node* pChild = pNode->GetFirstChild(); pChild;
pChild = pChild->GetNextSibling()) {
- Export(pStream, pChild, dwFlag, pChecksum);
+ Export(pStream, pChild);
}
pStream->WriteString(L"</xdp:xdp\n>");
break;
@@ -69,7 +58,7 @@ bool CXFA_DataExporter::Export(
break;
}
case XFA_PacketType::Form: {
- XFA_DataExporter_RegenerateFormFile(pNode, pStream, pChecksum, false);
+ XFA_DataExporter_RegenerateFormFile(pNode, pStream, false);
break;
}
case XFA_PacketType::Template:
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h
index a2a55b3c13..5e3b58fefb 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.h
+++ b/xfa/fxfa/parser/cxfa_dataexporter.h
@@ -17,22 +17,14 @@ class CFX_SeekableStreamProxy;
class CXFA_DataExporter {
public:
- explicit CXFA_DataExporter(CXFA_Document* pDocument);
+ CXFA_DataExporter();
~CXFA_DataExporter();
- bool Export(const RetainPtr<IFX_SeekableStream>& pWrite);
- bool Export(const RetainPtr<IFX_SeekableStream>& pWrite,
- CXFA_Node* pNode,
- uint32_t dwFlag,
- const char* pChecksum);
+ bool Export(const RetainPtr<IFX_SeekableStream>& pWrite, CXFA_Node* pNode);
private:
bool Export(const RetainPtr<CFX_SeekableStreamProxy>& pStream,
- CXFA_Node* pNode,
- uint32_t dwFlag,
- const char* pChecksum);
-
- UnownedPtr<CXFA_Document> const m_pDocument;
+ CXFA_Node* pNode);
};
#endif // XFA_FXFA_PARSER_CXFA_DATAEXPORTER_H_
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 7021285dff..b916b4dfc4 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -9,7 +9,6 @@
#include <utility>
#include <vector>
-#include "core/fxcrt/cfx_checksumcontext.h"
#include "core/fxcrt/cfx_seekablestreamproxy.h"
#include "core/fxcrt/cfx_widetextbuf.h"
#include "core/fxcrt/fx_codepage.h"
@@ -376,7 +375,6 @@ CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const ByteString& wsXML) {
auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(
const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength());
m_pXMLDoc = pdfium::MakeUnique<CFX_XMLDoc>(pStream);
- m_pXMLDoc->GetParser()->m_dwCheckStatus = 0x03;
int32_t iRet = m_pXMLDoc->DoLoad();
if (iRet < 0 || iRet >= 100)
@@ -642,33 +640,12 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Form(
return nullptr;
}
- CFX_XMLElement* pXMLDocumentElement =
- static_cast<CFX_XMLElement*>(pXMLDocumentNode);
- WideString wsChecksum = pXMLDocumentElement->GetString(L"checksum");
- if (wsChecksum.GetLength() != 28 ||
- m_pXMLDoc->GetParser()->m_dwCheckStatus != 0x03) {
- return nullptr;
- }
-
- auto pChecksum = pdfium::MakeUnique<CFX_ChecksumContext>();
- pChecksum->StartChecksum();
- pChecksum->UpdateChecksum(m_pFileRead, m_pXMLDoc->GetParser()->m_nStart[0],
- m_pXMLDoc->GetParser()->m_nSize[0]);
- pChecksum->UpdateChecksum(m_pFileRead, m_pXMLDoc->GetParser()->m_nStart[1],
- m_pXMLDoc->GetParser()->m_nSize[1]);
- pChecksum->FinishChecksum();
- ByteString bsCheck = pChecksum->GetChecksum();
- if (bsCheck != wsChecksum.UTF8Encode())
- return nullptr;
-
CXFA_Node* pNode =
m_pFactory->CreateNode(XFA_PacketType::Form, XFA_Element::Form);
if (!pNode)
return nullptr;
pNode->JSObject()->SetCData(XFA_Attribute::Name, packet->name, false, false);
- pNode->JSObject()->SetAttribute(XFA_Attribute::Checksum,
- wsChecksum.AsStringView(), false);
CXFA_Template* pTemplateRoot =
m_pRootNode->GetFirstChildByClass<CXFA_Template>(XFA_Element::Template);
CXFA_Subform* pTemplateChosen =
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 65be9625ba..7b4e4b1989 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -520,17 +520,9 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) {
void XFA_DataExporter_RegenerateFormFile(
CXFA_Node* pNode,
const RetainPtr<CFX_SeekableStreamProxy>& pStream,
- const char* pChecksum,
bool bSaveXML) {
if (pNode->IsModelNode()) {
- pStream->WriteString(L"<form");
- if (pChecksum) {
- WideString wsChecksum = WideString::FromUTF8(pChecksum);
- pStream->WriteString(L" checksum=\"");
- pStream->WriteString(wsChecksum.AsStringView());
- pStream->WriteString(L"\"");
- }
- pStream->WriteString(L" xmlns=\"");
+ pStream->WriteString(L"<form xmlns=\"");
pStream->WriteString(WideStringView(kFormNS));
WideString wsVersionNumber = RecognizeXFAVersionNumber(
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index 3b59ac8b3a..d78b9ca57c 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -32,7 +32,6 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode);
void XFA_DataExporter_RegenerateFormFile(
CXFA_Node* pNode,
const RetainPtr<CFX_SeekableStreamProxy>& pStream,
- const char* pChecksum,
bool bSaveXML);
const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName(