OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/cxfa_simple_parser.h" | 7 #include "xfa/fxfa/parser/cxfa_simple_parser.h" |
8 | 8 |
9 #include "core/fxcrt/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 m_pRootNode(nullptr), | 270 m_pRootNode(nullptr), |
271 m_ePacketID(XFA_XDPPACKET_UNKNOWN), | 271 m_ePacketID(XFA_XDPPACKET_UNKNOWN), |
272 m_bDocumentParser(bDocumentParser) {} | 272 m_bDocumentParser(bDocumentParser) {} |
273 | 273 |
274 CXFA_SimpleParser::~CXFA_SimpleParser() {} | 274 CXFA_SimpleParser::~CXFA_SimpleParser() {} |
275 | 275 |
276 void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { | 276 void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { |
277 m_pFactory = pFactory; | 277 m_pFactory = pFactory; |
278 } | 278 } |
279 | 279 |
280 int32_t CXFA_SimpleParser::StartParse(IFX_SeekableReadStream* pStream, | 280 int32_t CXFA_SimpleParser::StartParse( |
281 XFA_XDPPACKET ePacketID) { | 281 const CFX_RetainPtr<IFX_SeekableReadStream>& pStream, |
| 282 XFA_XDPPACKET ePacketID) { |
282 CloseParser(); | 283 CloseParser(); |
283 m_pFileRead = pStream; | 284 m_pFileRead = pStream; |
284 m_pStream.reset(IFGAS_Stream::CreateStream( | 285 m_pStream.reset(IFGAS_Stream::CreateStream( |
285 pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text)); | 286 pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text)); |
286 if (!m_pStream) | 287 if (!m_pStream) |
287 return XFA_PARSESTATUS_StreamErr; | 288 return XFA_PARSESTATUS_StreamErr; |
288 | 289 |
289 uint16_t wCodePage = m_pStream->GetCodePage(); | 290 uint16_t wCodePage = m_pStream->GetCodePage(); |
290 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && | 291 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && |
291 wCodePage != FX_CODEPAGE_UTF8) { | 292 wCodePage != FX_CODEPAGE_UTF8) { |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, true); | 1301 pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, true); |
1301 } | 1302 } |
1302 } | 1303 } |
1303 } | 1304 } |
1304 } | 1305 } |
1305 | 1306 |
1306 void CXFA_SimpleParser::CloseParser() { | 1307 void CXFA_SimpleParser::CloseParser() { |
1307 m_pXMLDoc.reset(); | 1308 m_pXMLDoc.reset(); |
1308 m_pStream.reset(); | 1309 m_pStream.reset(); |
1309 } | 1310 } |
OLD | NEW |