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 "../../include/fxcrt/fx_basic.h" | 7 #include "../../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) |
11 : m_pData(NULL), m_nSize(0), m_nMaxSize(0) { | 11 : m_pData(NULL), m_nSize(0), m_nMaxSize(0) { |
12 if (unit_size < 0 || unit_size > (1 << 28)) { | 12 if (unit_size < 0 || unit_size > (1 << 28)) { |
13 m_nUnitSize = 4; | 13 m_nUnitSize = 4; |
14 } else { | 14 } else { |
15 m_nUnitSize = unit_size; | 15 m_nUnitSize = unit_size; |
16 } | 16 } |
17 } | 17 } |
18 CFX_BasicArray::~CFX_BasicArray() { | 18 CFX_BasicArray::~CFX_BasicArray() { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 FX_Free(pIndex[i % m_IndexSize]); | 333 FX_Free(pIndex[i % m_IndexSize]); |
334 pIndex[i % m_IndexSize] = NULL; | 334 pIndex[i % m_IndexSize] = NULL; |
335 } | 335 } |
336 } else { | 336 } else { |
337 FX_Free(m_pIndex); | 337 FX_Free(m_pIndex); |
338 m_pIndex = NULL; | 338 m_pIndex = NULL; |
339 } | 339 } |
340 } | 340 } |
341 m_DataSize -= count; | 341 m_DataSize -= count; |
342 } | 342 } |
OLD | NEW |