summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp17
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.h3
-rw-r--r--xfa/fxfa/parser/cxfa_xmllocale.cpp9
3 files changed, 10 insertions, 19 deletions
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index f52d52ff3c..62828d71a7 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -9,7 +9,7 @@
#include <utility>
#include <vector>
-#include "core/fxcrt/cfx_seekablestreamproxy.h"
+#include "core/fxcrt/cfx_memorystream.h"
#include "core/fxcrt/cfx_widetextbuf.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
@@ -329,14 +329,7 @@ CXFA_DocumentParser::~CXFA_DocumentParser() {}
bool CXFA_DocumentParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream,
XFA_PacketType ePacketID) {
- auto pStreamProxy = pdfium::MakeRetain<CFX_SeekableStreamProxy>(pStream);
- uint16_t wCodePage = pStreamProxy->GetCodePage();
- if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE &&
- wCodePage != FX_CODEPAGE_UTF8) {
- pStreamProxy->SetCodePage(FX_CODEPAGE_UTF8);
- }
-
- m_pNodeTree = LoadXML(pStreamProxy);
+ m_pNodeTree = LoadXML(pStream);
if (!m_pNodeTree)
return false;
@@ -345,14 +338,14 @@ bool CXFA_DocumentParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream,
}
CFX_XMLNode* CXFA_DocumentParser::ParseXMLData(const ByteString& wsXML) {
- auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(
- const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength());
+ auto pStream = pdfium::MakeRetain<CFX_MemoryStream>(
+ const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength(), false);
m_pNodeTree = LoadXML(pStream);
return m_pNodeTree ? GetDocumentNode(m_pNodeTree.get()) : nullptr;
}
std::unique_ptr<CFX_XMLNode> CXFA_DocumentParser::LoadXML(
- const RetainPtr<CFX_SeekableStreamProxy>& pStream) {
+ const RetainPtr<IFX_SeekableStream>& pStream) {
ASSERT(pStream);
auto root = pdfium::MakeUnique<CFX_XMLNode>();
diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h
index acd27e6238..d76d5953ac 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.h
+++ b/xfa/fxfa/parser/cxfa_document_parser.h
@@ -18,7 +18,6 @@ class CXFA_Node;
class CFX_XMLDoc;
class CFX_XMLInstruction;
class IFX_SeekableStream;
-class CFX_SeekableStreamProxy;
class CXFA_DocumentParser {
public:
@@ -36,7 +35,7 @@ class CXFA_DocumentParser {
private:
std::unique_ptr<CFX_XMLNode> LoadXML(
- const RetainPtr<CFX_SeekableStreamProxy>& pStream);
+ const RetainPtr<IFX_SeekableStream>& pStream);
CXFA_Node* ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode,
XFA_PacketType ePacketID);
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp
index 4354ed98de..ffb4cd9dde 100644
--- a/xfa/fxfa/parser/cxfa_xmllocale.cpp
+++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp
@@ -8,6 +8,7 @@
#include <utility>
+#include "core/fxcrt/cfx_memorystream.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlparser.h"
@@ -30,11 +31,9 @@ constexpr wchar_t kCurrencySymbol[] = L"currencySymbol";
std::unique_ptr<CXFA_XMLLocale> CXFA_XMLLocale::Create(
pdfium::span<uint8_t> data) {
auto root = pdfium::MakeUnique<CFX_XMLElement>(L"root");
- auto proxy =
- pdfium::MakeRetain<CFX_SeekableStreamProxy>(data.data(), data.size());
- proxy->SetCodePage(FX_CODEPAGE_UTF8);
-
- CFX_XMLParser parser(root.get(), proxy);
+ auto stream =
+ pdfium::MakeRetain<CFX_MemoryStream>(data.data(), data.size(), false);
+ CFX_XMLParser parser(root.get(), stream);
if (!parser.Parse())
return nullptr;