Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "xfa/src/foxitlib.h" | 9 #include "xfa/src/foxitlib.h" |
| 10 #include "fde_xml.h" | 10 #include "fde_xml_imp.h" |
|
Lei Zhang
2016/01/12 22:27:23
xfa/src/fdp/src/xml/fde_xml_imp.h, and move it to
| |
| 11 #ifdef __cplusplus | 11 #ifdef __cplusplus |
| 12 extern "C" { | 12 extern "C" { |
| 13 #endif | 13 #endif |
| 14 #define FDE_XMLVALIDCHARRANGENUM 5 | 14 #define FDE_XMLVALIDCHARRANGENUM 5 |
| 15 static FX_WCHAR g_XMLValidCharRange[FDE_XMLVALIDCHARRANGENUM][2] = { | 15 static FX_WCHAR g_XMLValidCharRange[FDE_XMLVALIDCHARRANGENUM][2] = { |
| 16 {0x09, 0x09}, | 16 {0x09, 0x09}, |
| 17 {0x0A, 0x0A}, | 17 {0x0A, 0x0A}, |
| 18 {0x0D, 0x0D}, | 18 {0x0D, 0x0D}, |
| 19 {0x20, 0xD7FF}, | 19 {0x20, 0xD7FF}, |
| 20 {0xE000, 0xFFFD}}; | 20 {0xE000, 0xFFFD}}; |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1313 } | 1313 } |
| 1314 inline void CFDE_XMLSAXParser::Pop() { | 1314 inline void CFDE_XMLSAXParser::Pop() { |
| 1315 m_TagStack.Pop(); | 1315 m_TagStack.Pop(); |
| 1316 m_pTagTop = m_TagStack.GetTopElement(); | 1316 m_pTagTop = m_TagStack.GetTopElement(); |
| 1317 } | 1317 } |
| 1318 #ifdef _FDE_BLOCK_BUFFER | 1318 #ifdef _FDE_BLOCK_BUFFER |
| 1319 CFDE_BlockBuffer::CFDE_BlockBuffer(int32_t iAllocStep) | 1319 CFDE_BlockBuffer::CFDE_BlockBuffer(int32_t iAllocStep) |
| 1320 : m_iDataLength(0), | 1320 : m_iDataLength(0), |
| 1321 m_iBufferSize(0), | 1321 m_iBufferSize(0), |
| 1322 m_iAllocStep(iAllocStep), | 1322 m_iAllocStep(iAllocStep), |
| 1323 m_iStartPosition(0) { | 1323 m_iStartPosition(0) {} |
| 1324 } | |
| 1325 CFDE_BlockBuffer::~CFDE_BlockBuffer() { | 1324 CFDE_BlockBuffer::~CFDE_BlockBuffer() { |
| 1326 ClearBuffer(); | 1325 ClearBuffer(); |
| 1327 } | 1326 } |
| 1328 FX_WCHAR* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) { | 1327 FX_WCHAR* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) { |
| 1329 iIndexInBlock = 0; | 1328 iIndexInBlock = 0; |
| 1330 if (!m_BlockArray.GetSize()) { | 1329 if (!m_BlockArray.GetSize()) { |
| 1331 return nullptr; | 1330 return nullptr; |
| 1332 } | 1331 } |
| 1333 int32_t iRealIndex = m_iStartPosition + m_iDataLength; | 1332 int32_t iRealIndex = m_iStartPosition + m_iDataLength; |
| 1334 if (iRealIndex == m_iBufferSize) { | 1333 if (iRealIndex == m_iBufferSize) { |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2629 m_iTextDataSize += 1024 * 1024; | 2628 m_iTextDataSize += 1024 * 1024; |
| 2630 } | 2629 } |
| 2631 m_pwsTextData = FX_Realloc(FX_WCHAR, m_pwsTextData, m_iTextDataSize); | 2630 m_pwsTextData = FX_Realloc(FX_WCHAR, m_pwsTextData, m_iTextDataSize); |
| 2632 } | 2631 } |
| 2633 void CFDE_XMLSyntaxParser::GetData(CFX_WideString& wsData) const { | 2632 void CFDE_XMLSyntaxParser::GetData(CFX_WideString& wsData) const { |
| 2634 FX_WCHAR* pBuf = wsData.GetBuffer(m_iTextDataLength); | 2633 FX_WCHAR* pBuf = wsData.GetBuffer(m_iTextDataLength); |
| 2635 FXSYS_memcpy(pBuf, m_pwsTextData, m_iTextDataLength * sizeof(FX_WCHAR)); | 2634 FXSYS_memcpy(pBuf, m_pwsTextData, m_iTextDataLength * sizeof(FX_WCHAR)); |
| 2636 wsData.ReleaseBuffer(m_iTextDataLength); | 2635 wsData.ReleaseBuffer(m_iTextDataLength); |
| 2637 } | 2636 } |
| 2638 #endif | 2637 #endif |
| OLD | NEW |