| 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 "core/fxcrt/xml_int.h" | 7 #include "core/fxcrt/xml_int.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 m_nStart += (FX_FILESIZE)m_dwSize; | 146 m_nStart += (FX_FILESIZE)m_dwSize; |
| 147 if (m_nStart >= nLength) | 147 if (m_nStart >= nLength) |
| 148 return false; | 148 return false; |
| 149 | 149 |
| 150 static const FX_FILESIZE FX_XMLDATASTREAM_BufferSize = 32 * 1024; | 150 static const FX_FILESIZE FX_XMLDATASTREAM_BufferSize = 32 * 1024; |
| 151 m_dwSize = static_cast<size_t>( | 151 m_dwSize = static_cast<size_t>( |
| 152 std::min(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart)); | 152 std::min(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart)); |
| 153 if (!m_pBuffer) | 153 if (!m_pBuffer) |
| 154 m_pBuffer = FX_Alloc(uint8_t, m_dwSize); | 154 m_pBuffer = FX_Alloc(uint8_t, m_dwSize); |
| 155 | 155 |
| 156 return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize); | 156 return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize) == m_dwSize || |
| 157 m_pFileRead->IsEOF(); |
| 157 } | 158 } |
| 158 | 159 |
| 159 const uint8_t* CXML_DataStmAcc::GetBlockBuffer() { | 160 const uint8_t* CXML_DataStmAcc::GetBlockBuffer() { |
| 160 return (const uint8_t*)m_pBuffer; | 161 return (const uint8_t*)m_pBuffer; |
| 161 } | 162 } |
| 162 | 163 |
| 163 size_t CXML_DataStmAcc::GetBlockSize() { | 164 size_t CXML_DataStmAcc::GetBlockSize() { |
| 164 return m_dwSize; | 165 return m_dwSize; |
| 165 } | 166 } |
| 166 | 167 |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 m_pMap->push_back({space, name, CFX_WideString(value)}); | 914 m_pMap->push_back({space, name, CFX_WideString(value)}); |
| 914 } | 915 } |
| 915 | 916 |
| 916 int CXML_AttrMap::GetSize() const { | 917 int CXML_AttrMap::GetSize() const { |
| 917 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; | 918 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; |
| 918 } | 919 } |
| 919 | 920 |
| 920 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { | 921 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { |
| 921 return (*m_pMap)[index]; | 922 return (*m_pMap)[index]; |
| 922 } | 923 } |
| OLD | NEW |