diff options
author | tsepez <tsepez@chromium.org> | 2016-04-29 11:24:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-29 11:24:15 -0700 |
commit | d5d07dcf59ddc6439f73382c6e0b9e6d1851000d (patch) | |
tree | 3430639a1c286570a60e946e1b850aeeedaaa05a /xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp | |
parent | cd1e9ff4f432cbc29ed279e6891fb7ddc2ea3734 (diff) | |
download | pdfium-d5d07dcf59ddc6439f73382c6e0b9e6d1851000d.tar.xz |
Replace CFX_PtrArray with typesafe CFX_ArrayTemplate, part 8
This also removes another hand-written bubblesort in favor of
the std::sort() STL function.
Review-Url: https://codereview.chromium.org/1937513002
Diffstat (limited to 'xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp')
-rw-r--r-- | xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp index e441a29e44..d1dcc23e7b 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp @@ -25,14 +25,15 @@ #include "xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h" #include "xfa/fxbarcode/utils.h" -CFX_PtrArray* CBC_DataMatrixVersion::VERSIONS = NULL; +CFX_ArrayTemplate<CBC_DataMatrixVersion*>* CBC_DataMatrixVersion::VERSIONS = + nullptr; void CBC_DataMatrixVersion::Initialize() { - VERSIONS = new CFX_PtrArray(); + VERSIONS = new CFX_ArrayTemplate<CBC_DataMatrixVersion*>(); } void CBC_DataMatrixVersion::Finalize() { for (int32_t i = 0; i < VERSIONS->GetSize(); i++) { - delete ((CBC_DataMatrixVersion*)(VERSIONS->GetAt(i))); + delete VERSIONS->GetAt(i); } VERSIONS->RemoveAll(); delete VERSIONS; @@ -84,7 +85,7 @@ ECBlocks* CBC_DataMatrixVersion::GetECBlocks() { } void CBC_DataMatrixVersion::ReleaseAll() { for (int32_t i = 0; i < VERSIONS->GetSize(); i++) { - delete (CBC_DataMatrixVersion*)VERSIONS->GetAt(i); + delete VERSIONS->GetAt(i); } VERSIONS->RemoveAll(); } @@ -94,7 +95,7 @@ CBC_DataMatrixVersion* CBC_DataMatrixVersion::GetVersionForDimensions( int32_t& e) { if ((numRows & 0x01) != 0 || (numColumns & 0x01) != 0) { e = BCExceptionNotFound; - return NULL; + return nullptr; } if (VERSIONS->GetSize() == 0) { VERSIONS->Add(new CBC_DataMatrixVersion(1, 10, 10, 8, 8, @@ -161,13 +162,11 @@ CBC_DataMatrixVersion* CBC_DataMatrixVersion::GetVersionForDimensions( } int32_t numVersions = VERSIONS->GetSize(); for (int32_t i = 0; i < numVersions; ++i) { - if (((CBC_DataMatrixVersion*)((*VERSIONS)[i]))->m_symbolSizeRows == - numRows && - ((CBC_DataMatrixVersion*)((*VERSIONS)[i]))->m_symbolSizeColumns == - numColumns) { - return (CBC_DataMatrixVersion*)(*VERSIONS)[i]; + if ((*VERSIONS)[i]->m_symbolSizeRows == numRows && + (*VERSIONS)[i]->m_symbolSizeColumns == numColumns) { + return (*VERSIONS)[i]; } } e = BCExceptionNotFound; - return NULL; + return nullptr; } |