| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/xfa_parser_imp.h" | 7 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
| 8 | 8 |
| 9 #include "xfa/fgas/crt/fgas_codepage.h" | 9 #include "xfa/fgas/crt/fgas_codepage.h" |
| 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, | 67 int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, |
| 68 XFA_XDPPACKET ePacketID) { | 68 XFA_XDPPACKET ePacketID) { |
| 69 CloseParser(); | 69 CloseParser(); |
| 70 m_pFileRead = pStream; | 70 m_pFileRead = pStream; |
| 71 m_pStream = IFX_Stream::CreateStream( | 71 m_pStream = IFX_Stream::CreateStream( |
| 72 pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text); | 72 pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text); |
| 73 if (m_pStream == NULL) { | 73 if (m_pStream == NULL) { |
| 74 return XFA_PARSESTATUS_StreamErr; | 74 return XFA_PARSESTATUS_StreamErr; |
| 75 } | 75 } |
| 76 FX_WORD wCodePage = m_pStream->GetCodePage(); | 76 uint16_t wCodePage = m_pStream->GetCodePage(); |
| 77 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && | 77 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && |
| 78 wCodePage != FX_CODEPAGE_UTF8) { | 78 wCodePage != FX_CODEPAGE_UTF8) { |
| 79 m_pStream->SetCodePage(FX_CODEPAGE_UTF8); | 79 m_pStream->SetCodePage(FX_CODEPAGE_UTF8); |
| 80 } | 80 } |
| 81 m_pXMLDoc = IFDE_XMLDoc::Create(); | 81 m_pXMLDoc = IFDE_XMLDoc::Create(); |
| 82 if (m_pXMLDoc == NULL) { | 82 if (m_pXMLDoc == NULL) { |
| 83 return XFA_PARSESTATUS_StatusErr; | 83 return XFA_PARSESTATUS_StatusErr; |
| 84 } | 84 } |
| 85 m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream); | 85 m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream); |
| 86 if (m_pXMLParser == NULL) { | 86 if (m_pXMLParser == NULL) { |
| (...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 break; | 1559 break; |
| 1560 } | 1560 } |
| 1561 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) { | 1561 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) { |
| 1562 break; | 1562 break; |
| 1563 } | 1563 } |
| 1564 } | 1564 } |
| 1565 return (m_dwStatus == FDE_XMLSYNTAXSTATUS_Error || m_NodeStack.GetSize() != 1) | 1565 return (m_dwStatus == FDE_XMLSYNTAXSTATUS_Error || m_NodeStack.GetSize() != 1) |
| 1566 ? -1 | 1566 ? -1 |
| 1567 : m_pParser->GetStatus(); | 1567 : m_pParser->GetStatus(); |
| 1568 } | 1568 } |
| OLD | NEW |