summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-28 14:56:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-28 14:56:27 -0700
commitaef780db30c434e1d681d81852fb13160e72ed1e (patch)
tree24810c630b3b27649c0dd856d795c0069ca5bcd6 /xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
parent8e957baa851aed4b02511d04a66c0f95387d1e10 (diff)
downloadpdfium-aef780db30c434e1d681d81852fb13160e72ed1e.tar.xz
Replace CFX_PtrArray with typesafe CFX_ArrayTemplate, part 4
Review-Url: https://codereview.chromium.org/1932703003
Diffstat (limited to 'xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp')
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
index 1ff557ede2..e92267819c 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
@@ -53,15 +53,15 @@ CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber,
CBC_QRCoderECBlocks* ecBlocks3,
CBC_QRCoderECBlocks* ecBlocks4) {
m_versionNumber = versionNumber;
- m_ecBlocks.Add(ecBlocks1);
- m_ecBlocks.Add(ecBlocks2);
- m_ecBlocks.Add(ecBlocks3);
- m_ecBlocks.Add(ecBlocks4);
+ m_ecBlocksArray.Add(ecBlocks1);
+ m_ecBlocksArray.Add(ecBlocks2);
+ m_ecBlocksArray.Add(ecBlocks3);
+ m_ecBlocksArray.Add(ecBlocks4);
int32_t total = 0;
int32_t ecCodeWords = ecBlocks1->GetECCodeWordsPerBlock();
- CFX_PtrArray* ecbArray = ecBlocks1->GetECBlocks();
+ CFX_ArrayTemplate<CBC_QRCoderECB*>* ecbArray = ecBlocks1->GetECBlocks();
for (int32_t i = 0; i < ecbArray->GetSize(); i++) {
- CBC_QRCoderECB* ecBlock = (CBC_QRCoderECB*)((*ecbArray)[i]);
+ CBC_QRCoderECB* ecBlock = (*ecbArray)[i];
total += ecBlock->GetCount() * (ecBlock->GetDataCodeWords() + ecCodeWords);
}
m_totalCodeWords = total;
@@ -326,16 +326,12 @@ CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber,
break;
}
}
+
CBC_QRCoderVersion::~CBC_QRCoderVersion() {
- if (m_ecBlocks.GetSize() != 0) {
- int32_t itBeg = 0;
- int32_t itEnd = m_ecBlocks.GetSize();
- while (itBeg != itEnd) {
- delete ((CBC_QRCoderECBlocks*)(m_ecBlocks[itBeg]));
- itBeg++;
- }
- }
+ for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); ++i)
+ delete m_ecBlocksArray[i];
}
+
int32_t CBC_QRCoderVersion::GetVersionNumber() {
return m_versionNumber;
}
@@ -350,7 +346,7 @@ int32_t CBC_QRCoderVersion::GetDimensionForVersion() {
}
CBC_QRCoderECBlocks* CBC_QRCoderVersion::GetECBlocksForLevel(
CBC_QRCoderErrorCorrectionLevel* ecLevel) {
- return (CBC_QRCoderECBlocks*)m_ecBlocks[ecLevel->Ordinal()];
+ return m_ecBlocksArray[ecLevel->Ordinal()];
}
CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension(
int32_t dimension,