summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-02 09:34:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-02 09:34:35 -0700
commit8f0d0da1b12e29133fb48a778603c03bf0056124 (patch)
treeeacee99738a238d488c74723fef01a6b5c2f485d /xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp
parenta86d113be692153d7707da377d11d4f09cb12c9b (diff)
downloadpdfium-8f0d0da1b12e29133fb48a778603c03bf0056124.tar.xz
Replace CFX_PtrArray with typesafe CFX_ArrayTemplate, part 10
Review-Url: https://codereview.chromium.org/1936733002
Diffstat (limited to 'xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp')
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp
index 1966146805..360a69a0ec 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp
@@ -74,26 +74,24 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits,
CBC_QRCoderErrorCorrectionLevel* ecLevel = temp->GetErrorCorrectionLevel();
std::unique_ptr<CFX_ByteArray> codewords(parser.ReadCodewords(e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CFX_PtrArray* dataBlocks =
+ CFX_ArrayTemplate<CBC_QRDataBlock*>* dataBlocks =
CBC_QRDataBlock::GetDataBlocks(codewords.get(), version, ecLevel, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
int32_t totalBytes = 0;
for (int32_t i = 0; i < dataBlocks->GetSize(); i++) {
- totalBytes += ((CBC_QRDataBlock*)((*dataBlocks)[i]))->GetNumDataCodewords();
+ totalBytes += (*dataBlocks)[i]->GetNumDataCodewords();
}
CFX_ByteArray resultBytes;
for (int32_t j = 0; j < dataBlocks->GetSize(); j++) {
- CBC_QRDataBlock* dataBlock = (CBC_QRDataBlock*)((*dataBlocks)[j]);
+ CBC_QRDataBlock* dataBlock = (*dataBlocks)[j];
CFX_ByteArray* codewordBytes = dataBlock->GetCodewords();
int32_t numDataCodewords = dataBlock->GetNumDataCodewords();
CorrectErrors(codewordBytes, numDataCodewords, e);
if (e != BCExceptionNO) {
for (int32_t k = 0; k < dataBlocks->GetSize(); k++) {
- delete (CBC_QRDataBlock*)(*dataBlocks)[k];
+ delete (*dataBlocks)[k];
}
- dataBlocks->RemoveAll();
delete dataBlocks;
- dataBlocks = NULL;
return NULL;
}
for (int32_t i = 0; i < numDataCodewords; i++) {
@@ -101,11 +99,9 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits,
}
}
for (int32_t k = 0; k < dataBlocks->GetSize(); k++) {
- delete (CBC_QRDataBlock*)(*dataBlocks)[k];
+ delete (*dataBlocks)[k];
}
- dataBlocks->RemoveAll();
delete dataBlocks;
- dataBlocks = NULL;
CBC_CommonDecoderResult* cdr = CBC_QRDecodedBitStreamParser::Decode(
&resultBytes, version, ecLevel, byteModeDecode, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);