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/fgas/crt/fgas_utils.h" | 7 #include "xfa/fgas/crt/fgas_utils.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "core/fxcrt/include/fx_basic.h" | 11 #include "core/fxcrt/include/fx_basic.h" |
12 | 12 |
13 class FX_BASEARRAYDATA : public CFX_Target { | 13 class FX_BASEARRAYDATA : public CFX_Target { |
14 public: | 14 public: |
15 FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize) | 15 FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize); |
16 : iGrowSize(growsize), | 16 ~FX_BASEARRAYDATA() override; |
17 iBlockSize(blocksize), | |
18 iTotalCount(0), | |
19 iBlockCount(0), | |
20 pBuffer(nullptr) {} | |
21 | |
22 ~FX_BASEARRAYDATA() { FX_Free(pBuffer); } | |
23 | 17 |
24 int32_t iGrowSize; | 18 int32_t iGrowSize; |
25 int32_t iBlockSize; | 19 int32_t iBlockSize; |
26 int32_t iTotalCount; | 20 int32_t iTotalCount; |
27 int32_t iBlockCount; | 21 int32_t iBlockCount; |
28 uint8_t* pBuffer; | 22 uint8_t* pBuffer; |
29 }; | 23 }; |
| 24 |
| 25 FX_BASEARRAYDATA::FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize) |
| 26 : iGrowSize(growsize), |
| 27 iBlockSize(blocksize), |
| 28 iTotalCount(0), |
| 29 iBlockCount(0), |
| 30 pBuffer(nullptr) {} |
| 31 |
| 32 FX_BASEARRAYDATA::~FX_BASEARRAYDATA() { |
| 33 FX_Free(pBuffer); |
| 34 } |
| 35 |
30 CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) { | 36 CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) { |
31 ASSERT(iGrowSize > 0 && iBlockSize > 0); | 37 ASSERT(iGrowSize > 0 && iBlockSize > 0); |
32 m_pData = new FX_BASEARRAYDATA(iGrowSize, iBlockSize); | 38 m_pData = new FX_BASEARRAYDATA(iGrowSize, iBlockSize); |
33 } | 39 } |
34 CFX_BaseArray::~CFX_BaseArray() { | 40 CFX_BaseArray::~CFX_BaseArray() { |
35 RemoveAll(); | 41 RemoveAll(); |
36 delete m_pData; | 42 delete m_pData; |
37 } | 43 } |
38 int32_t CFX_BaseArray::GetSize() const { | 44 int32_t CFX_BaseArray::GetSize() const { |
39 return m_pData->iBlockCount; | 45 return m_pData->iBlockCount; |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 427 } |
422 int32_t CFX_BaseStack::GetSize() const { | 428 int32_t CFX_BaseStack::GetSize() const { |
423 return m_pData->m_iBlockCount; | 429 return m_pData->m_iBlockCount; |
424 } | 430 } |
425 uint8_t* CFX_BaseStack::GetAt(int32_t index) const { | 431 uint8_t* CFX_BaseStack::GetAt(int32_t index) const { |
426 return m_pData->GetAt(index); | 432 return m_pData->GetAt(index); |
427 } | 433 } |
428 void CFX_BaseStack::RemoveAll(FX_BOOL bLeaveMemory) { | 434 void CFX_BaseStack::RemoveAll(FX_BOOL bLeaveMemory) { |
429 m_pData->RemoveAll(bLeaveMemory); | 435 m_pData->RemoveAll(bLeaveMemory); |
430 } | 436 } |
OLD | NEW |