diff options
author | dan sinclair <dsinclair@chromium.org> | 2018-04-17 18:45:50 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-17 18:45:50 +0000 |
commit | 8e753ca397ea332b29d65736b0e0bf9ad466df56 (patch) | |
tree | d8a53c3c3852ec6c4dd66dc69ce2b04f69d61742 /core/fxcrt/xml/cfx_xmlparser.cpp | |
parent | 5925398cc46eccdec720166c1b6bbb87cfb19564 (diff) | |
download | pdfium-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 'core/fxcrt/xml/cfx_xmlparser.cpp')
-rw-r--r-- | core/fxcrt/xml/cfx_xmlparser.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp index 8292b33206..9336c11f87 100644 --- a/core/fxcrt/xml/cfx_xmlparser.cpp +++ b/core/fxcrt/xml/cfx_xmlparser.cpp @@ -10,6 +10,7 @@ #include <cwctype> #include <iterator> +#include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" #include "core/fxcrt/xml/cfx_xmlchardata.h" @@ -81,10 +82,10 @@ bool CFX_XMLParser::IsXMLNameChar(wchar_t ch, bool bFirstChar) { } CFX_XMLParser::CFX_XMLParser(CFX_XMLNode* pParent, - const RetainPtr<CFX_SeekableStreamProxy>& pStream) + const RetainPtr<IFX_SeekableStream>& pStream) : m_pParent(pParent), m_pChild(nullptr), - m_pStream(pStream), + m_pStream(pdfium::MakeRetain<CFX_SeekableStreamProxy>(pStream)), m_iXMLPlaneSize(1024), m_iCurrentPos(0), m_iCurrentNodeNum(-1), @@ -106,6 +107,12 @@ CFX_XMLParser::CFX_XMLParser(CFX_XMLNode* pParent, ASSERT(m_pParent); ASSERT(pStream); + uint16_t wCodePage = m_pStream->GetCodePage(); + if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && + wCodePage != FX_CODEPAGE_UTF8) { + m_pStream->SetCodePage(FX_CODEPAGE_UTF8); + } + m_NodeStack.push(m_pParent); m_CurNode.iNodeNum = -1; |