summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_document_parser.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2018-04-17 18:45:50 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-17 18:45:50 +0000
commit8e753ca397ea332b29d65736b0e0bf9ad466df56 (patch)
treed8a53c3c3852ec6c4dd66dc69ce2b04f69d61742 /xfa/fxfa/parser/cxfa_document_parser.cpp
parent5925398cc46eccdec720166c1b6bbb87cfb19564 (diff)
downloadpdfium-8e753ca397ea332b29d65736b0e0bf9ad466df56.tar.xz
Convert CFX_XMLParser to take a IFX_SeekableStream
This CL changes the CFX_XMLParser to accept an IFX_SeekableStream intead of a CFX_SeekableStreamProxy. Change-Id: I3534288a8a00095acd78a60bf6b925c6a0357892 Reviewed-on: https://pdfium-review.googlesource.com/30856 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_document_parser.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp17
1 files changed, 5 insertions, 12 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>();