| 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/include/fxcrt/fx_basic.h" | 7 #include "core/include/fxcrt/fx_basic.h" |
| 8 #include "third_party/base/numerics/safe_math.h" | 8 #include "third_party/base/numerics/safe_math.h" |
| 9 | 9 |
| 10 CFX_BasicArray::CFX_BasicArray(int unit_size) | 10 CFX_BasicArray::CFX_BasicArray(int unit_size) |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 FXSYS_memcpy(m_pData + nStartIndex * m_nUnitSize, pNewArray->m_pData, | 127 FXSYS_memcpy(m_pData + nStartIndex * m_nUnitSize, pNewArray->m_pData, |
| 128 pNewArray->m_nSize * m_nUnitSize); | 128 pNewArray->m_nSize * m_nUnitSize); |
| 129 return TRUE; | 129 return TRUE; |
| 130 } | 130 } |
| 131 const void* CFX_BasicArray::GetDataPtr(int index) const { | 131 const void* CFX_BasicArray::GetDataPtr(int index) const { |
| 132 if (index < 0 || index >= m_nSize || !m_pData) { | 132 if (index < 0 || index >= m_nSize || !m_pData) { |
| 133 return NULL; | 133 return NULL; |
| 134 } | 134 } |
| 135 return m_pData + index * m_nUnitSize; | 135 return m_pData + index * m_nUnitSize; |
| 136 } | 136 } |
| 137 #ifdef PDF_ENABLE_XFA |
| 137 CFX_BaseSegmentedArray::CFX_BaseSegmentedArray(int unit_size, | 138 CFX_BaseSegmentedArray::CFX_BaseSegmentedArray(int unit_size, |
| 138 int segment_units, | 139 int segment_units, |
| 139 int index_size) | 140 int index_size) |
| 140 : m_UnitSize(unit_size), | 141 : m_UnitSize(unit_size), |
| 141 m_SegmentSize(segment_units), | 142 m_SegmentSize(segment_units), |
| 142 m_IndexSize(index_size), | 143 m_IndexSize(index_size), |
| 143 m_IndexDepth(0), | 144 m_IndexDepth(0), |
| 144 m_DataSize(0), | 145 m_DataSize(0), |
| 145 m_pIndex(NULL) {} | 146 m_pIndex(NULL) {} |
| 146 void CFX_BaseSegmentedArray::SetUnitSize(int unit_size, | 147 void CFX_BaseSegmentedArray::SetUnitSize(int unit_size, |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 FX_Free(pIndex[i % m_IndexSize]); | 332 FX_Free(pIndex[i % m_IndexSize]); |
| 332 pIndex[i % m_IndexSize] = NULL; | 333 pIndex[i % m_IndexSize] = NULL; |
| 333 } | 334 } |
| 334 } else { | 335 } else { |
| 335 FX_Free(m_pIndex); | 336 FX_Free(m_pIndex); |
| 336 m_pIndex = NULL; | 337 m_pIndex = NULL; |
| 337 } | 338 } |
| 338 } | 339 } |
| 339 m_DataSize -= count; | 340 m_DataSize -= count; |
| 340 } | 341 } |
| 342 #endif // PDF_ENABLE_XFA |
| OLD | NEW |