summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/pdf417
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode/pdf417')
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h8
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp15
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h9
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp90
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Reader.h6
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp95
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h10
7 files changed, 106 insertions, 127 deletions
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h
index 29f0a833a9..0be71a1fb2 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h
@@ -9,10 +9,11 @@
#include "core/fxcrt/include/fx_basic.h"
-class CBC_BarcodeValue {
+class CBC_BarcodeValue final {
public:
CBC_BarcodeValue();
- virtual ~CBC_BarcodeValue();
+ ~CBC_BarcodeValue();
+
void setValue(int32_t value);
CFX_Int32Array* getValue();
int32_t getConfidence(int32_t value);
@@ -22,4 +23,7 @@ class CBC_BarcodeValue {
CFX_Int32Array m_values;
};
+using CBC_BarcodeValueArray = CFX_ArrayTemplate<CBC_BarcodeValue*>;
+using CBC_BarcodeValueArrayArray = CFX_ArrayTemplate<CBC_BarcodeValueArray*>;
+
#endif // XFA_FXBARCODE_PDF417_BC_PDF417BARCODEVALUE_H_
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
index 2c96f7005f..6a1f46fd02 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
@@ -65,7 +65,7 @@ int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array& received,
delete syndrome;
return -1;
}
- CFX_PtrArray* sigmaOmega =
+ CFX_ArrayTemplate<CBC_PDF417ECModulusPoly*>* sigmaOmega =
runEuclideanAlgorithm(buildmonomial, syndrome, numECCodewords, e);
delete buildmonomial;
delete syndrome;
@@ -123,11 +123,11 @@ int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array& received,
delete sigmaOmega;
return result;
}
-CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(
- CBC_PDF417ECModulusPoly* a,
- CBC_PDF417ECModulusPoly* b,
- int32_t R,
- int32_t& e) {
+CFX_ArrayTemplate<CBC_PDF417ECModulusPoly*>*
+CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a,
+ CBC_PDF417ECModulusPoly* b,
+ int32_t R,
+ int32_t& e) {
if (a->getDegree() < b->getDegree()) {
CBC_PDF417ECModulusPoly* temp = a;
a = b;
@@ -262,7 +262,8 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(
CBC_PDF417ECModulusPoly* omega = r->multiply(inverse, e);
delete rtemp;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CFX_PtrArray* modulusPoly = new CFX_PtrArray;
+ CFX_ArrayTemplate<CBC_PDF417ECModulusPoly*>* modulusPoly =
+ new CFX_ArrayTemplate<CBC_PDF417ECModulusPoly*>();
modulusPoly->Add(sigma);
modulusPoly->Add(omega);
return modulusPoly;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h
index d7b56defe9..95e691a60a 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h
@@ -22,10 +22,11 @@ class CBC_PDF417ECErrorCorrection {
private:
static CBC_PDF417ECModulusGF* m_field;
- static CFX_PtrArray* runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a,
- CBC_PDF417ECModulusPoly* b,
- int32_t R,
- int32_t& e);
+ static CFX_ArrayTemplate<CBC_PDF417ECModulusPoly*>* runEuclideanAlgorithm(
+ CBC_PDF417ECModulusPoly* a,
+ CBC_PDF417ECModulusPoly* b,
+ int32_t R,
+ int32_t& e);
static CFX_Int32Array* findErrorLocations(
CBC_PDF417ECModulusPoly* errorLocator,
int32_t& e);
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp
index 4d953e006a..e68969ef30 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp
@@ -20,7 +20,9 @@
* limitations under the License.
*/
+#include <algorithm>
#include <limits>
+#include <memory>
#include "xfa/fxbarcode/BC_BinaryBitmap.h"
#include "xfa/fxbarcode/BC_BinaryBitmap.h"
@@ -64,27 +66,25 @@ CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image,
int32_t hints,
int32_t& e) {
CFX_ByteString results;
- CBC_PDF417DetectorResult* detectorResult =
- CBC_Detector::detect(image, hints, multiple, e);
+ std::unique_ptr<CBC_PDF417DetectorResult> detectorResult(
+ CBC_Detector::detect(image, hints, multiple, e));
BC_EXCEPTION_CHECK_ReturnValue(e, "");
for (int32_t i = 0; i < detectorResult->getPoints()->GetSize(); i++) {
- CFX_PtrArray* points = (CFX_PtrArray*)detectorResult->getPoints()->GetAt(i);
- CBC_CommonDecoderResult* ResultTemp = CBC_PDF417ScanningDecoder::decode(
- detectorResult->getBits(), (CBC_ResultPoint*)points->GetAt(4),
- (CBC_ResultPoint*)points->GetAt(5), (CBC_ResultPoint*)points->GetAt(6),
- (CBC_ResultPoint*)points->GetAt(7), getMinCodewordWidth(*points),
- getMaxCodewordWidth(*points), e);
- if (ResultTemp == NULL) {
- delete detectorResult;
+ CBC_ResultPointArray* points = detectorResult->getPoints()->GetAt(i);
+ std::unique_ptr<CBC_CommonDecoderResult> ResultTemp(
+ CBC_PDF417ScanningDecoder::decode(
+ detectorResult->getBits(), points->GetAt(4), points->GetAt(5),
+ points->GetAt(6), points->GetAt(7), getMinCodewordWidth(*points),
+ getMaxCodewordWidth(*points), e));
+ if (!ResultTemp) {
e = BCExceptiontNotFoundInstance;
- return "";
+ return CFX_ByteString();
}
results += ResultTemp->GetText();
- delete ResultTemp;
}
- delete detectorResult;
return results;
}
+
CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image,
int32_t hints,
int32_t& e) {
@@ -105,45 +105,29 @@ int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1,
return std::numeric_limits<int32_t>::max();
return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX());
}
-int32_t CBC_PDF417Reader::getMaxCodewordWidth(CFX_PtrArray& p) {
- int32_t a =
- getMaxWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) *
- CBC_PDF417Common::MODULES_IN_CODEWORD /
- CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- int32_t b =
- getMaxWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) *
- CBC_PDF417Common::MODULES_IN_CODEWORD /
- CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- int32_t c = getMaxWidth((CBC_ResultPoint*)p.GetAt(0),
- (CBC_ResultPoint*)p.GetAt(4)) < a
- ? getMaxWidth((CBC_ResultPoint*)p.GetAt(0),
- (CBC_ResultPoint*)p.GetAt(4))
- : a;
- int32_t d = getMaxWidth((CBC_ResultPoint*)p.GetAt(1),
- (CBC_ResultPoint*)p.GetAt(5)) < b
- ? getMaxWidth((CBC_ResultPoint*)p.GetAt(1),
- (CBC_ResultPoint*)p.GetAt(5))
- : b;
- return c < d ? c : d;
+
+int32_t CBC_PDF417Reader::getMaxCodewordWidth(
+ const CFX_ArrayTemplate<CBC_ResultPoint*>& p) {
+ int32_t a = getMaxWidth(p.GetAt(6), p.GetAt(2)) *
+ CBC_PDF417Common::MODULES_IN_CODEWORD /
+ CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t b = getMaxWidth(p.GetAt(7), p.GetAt(3)) *
+ CBC_PDF417Common::MODULES_IN_CODEWORD /
+ CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t c = std::min(a, getMaxWidth(p.GetAt(0), p.GetAt(4)));
+ int32_t d = std::min(b, getMaxWidth(p.GetAt(1), p.GetAt(5)));
+ return std::min(c, d);
}
-int32_t CBC_PDF417Reader::getMinCodewordWidth(CFX_PtrArray& p) {
- int32_t a =
- getMinWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) *
- CBC_PDF417Common::MODULES_IN_CODEWORD /
- CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- int32_t b =
- getMinWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) *
- CBC_PDF417Common::MODULES_IN_CODEWORD /
- CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- int32_t c = getMinWidth((CBC_ResultPoint*)p.GetAt(0),
- (CBC_ResultPoint*)p.GetAt(4)) < a
- ? getMinWidth((CBC_ResultPoint*)p.GetAt(0),
- (CBC_ResultPoint*)p.GetAt(4))
- : a;
- int32_t d = getMinWidth((CBC_ResultPoint*)p.GetAt(1),
- (CBC_ResultPoint*)p.GetAt(5)) < b
- ? getMinWidth((CBC_ResultPoint*)p.GetAt(1),
- (CBC_ResultPoint*)p.GetAt(5))
- : b;
- return c < d ? c : d;
+
+int32_t CBC_PDF417Reader::getMinCodewordWidth(
+ const CFX_ArrayTemplate<CBC_ResultPoint*>& p) {
+ int32_t a = getMinWidth(p.GetAt(6), p.GetAt(2)) *
+ CBC_PDF417Common::MODULES_IN_CODEWORD /
+ CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t b = getMinWidth(p.GetAt(7), p.GetAt(3)) *
+ CBC_PDF417Common::MODULES_IN_CODEWORD /
+ CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t c = std::min(a, getMinWidth(p.GetAt(0), p.GetAt(4)));
+ int32_t d = std::min(b, getMinWidth(p.GetAt(1), p.GetAt(5)));
+ return std::min(c, d);
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Reader.h b/xfa/fxbarcode/pdf417/BC_PDF417Reader.h
index 808de29014..73499b9cdf 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Reader.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Reader.h
@@ -28,8 +28,10 @@ class CBC_PDF417Reader : public CBC_Reader {
private:
static int32_t getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2);
static int32_t getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2);
- static int32_t getMaxCodewordWidth(CFX_PtrArray& p);
- static int32_t getMinCodewordWidth(CFX_PtrArray& p);
+ static int32_t getMaxCodewordWidth(
+ const CFX_ArrayTemplate<CBC_ResultPoint*>& p);
+ static int32_t getMinCodewordWidth(
+ const CFX_ArrayTemplate<CBC_ResultPoint*>& p);
};
#endif // XFA_FXBARCODE_PDF417_BC_PDF417READER_H_
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
index e0eaf3e91f..4c3d4dbdf2 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <memory>
+
#include "xfa/fxbarcode/BC_DecoderResult.h"
#include "xfa/fxbarcode/BC_ResultPoint.h"
#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
@@ -155,16 +157,14 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
}
return decoderresult;
}
+
CFX_ByteString CBC_PDF417ScanningDecoder::toString(
- CFX_PtrArray* barcodeMatrix) {
+ CBC_BarcodeValueArrayArray* barcodeMatrix) {
CFX_ByteString result;
for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) {
result += row;
- int32_t l = 0;
- for (; l < ((CFX_PtrArray*)barcodeMatrix->GetAt(row))->GetSize(); l++) {
- CBC_BarcodeValue* barcodeValue =
- (CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(row))
- ->GetAt(l);
+ for (int32_t l = 0; l < barcodeMatrix->GetAt(row)->GetSize(); l++) {
+ CBC_BarcodeValue* barcodeValue = barcodeMatrix->GetAt(row)->GetAt(l);
if (barcodeValue->getValue()->GetSize() == 0) {
result += "";
} else {
@@ -176,6 +176,7 @@ CFX_ByteString CBC_PDF417ScanningDecoder::toString(
}
return result;
}
+
CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(
CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn,
CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn,
@@ -323,13 +324,13 @@ CBC_PDF417ScanningDecoder::getRowIndicatorColumn(CBC_CommonBitMatrix* image,
}
return rowIndicatorColumn;
}
+
void CBC_PDF417ScanningDecoder::adjustCodewordCount(
CBC_DetectionResult* detectionResult,
- CFX_PtrArray* barcodeMatrix,
+ CBC_BarcodeValueArrayArray* barcodeMatrix,
int32_t& e) {
- CFX_Int32Array* numberOfCodewords =
- ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(0))->GetAt(1))
- ->getValue();
+ std::unique_ptr<CFX_Int32Array> numberOfCodewords(
+ barcodeMatrix->GetAt(0)->GetAt(1)->getValue());
int32_t calculatedNumberOfCodewords =
detectionResult->getBarcodeColumnCount() *
detectionResult->getBarcodeRowCount() -
@@ -339,47 +340,39 @@ void CBC_PDF417ScanningDecoder::adjustCodewordCount(
calculatedNumberOfCodewords >
CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE) {
e = BCExceptiontNotFoundInstance;
- delete numberOfCodewords;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(0))->GetAt(1))
- ->setValue(calculatedNumberOfCodewords);
+ barcodeMatrix->GetAt(0)->GetAt(1)->setValue(calculatedNumberOfCodewords);
} else if (numberOfCodewords->GetAt(0) != calculatedNumberOfCodewords) {
- ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(0))->GetAt(1))
- ->setValue(calculatedNumberOfCodewords);
+ barcodeMatrix->GetAt(0)->GetAt(1)->setValue(calculatedNumberOfCodewords);
}
- delete numberOfCodewords;
}
+
CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(
CBC_DetectionResult* detectionResult,
int32_t& e) {
- CFX_PtrArray* barcodeMatrix = createBarcodeMatrix(detectionResult);
- adjustCodewordCount(detectionResult, barcodeMatrix, e);
+ std::unique_ptr<CBC_BarcodeValueArrayArray> barcodeMatrix(
+ createBarcodeMatrix(detectionResult));
+ adjustCodewordCount(detectionResult, barcodeMatrix.get(), e);
if (e != BCExceptionNO) {
for (int32_t i = 0; i < barcodeMatrix->GetSize(); i++) {
- CFX_PtrArray* temp = (CFX_PtrArray*)barcodeMatrix->GetAt(i);
- for (int32_t j = 0; j < temp->GetSize(); j++) {
- delete (CBC_BarcodeValue*)temp->GetAt(j);
- }
- temp->RemoveAll();
+ CBC_BarcodeValueArray* temp = barcodeMatrix->GetAt(i);
+ for (int32_t j = 0; j < temp->GetSize(); j++)
+ delete temp->GetAt(j);
delete temp;
}
- barcodeMatrix->RemoveAll();
- delete barcodeMatrix;
- return NULL;
+ return nullptr;
}
CFX_Int32Array erasures;
CFX_Int32Array codewords;
codewords.SetSize(detectionResult->getBarcodeRowCount() *
detectionResult->getBarcodeColumnCount());
- CFX_PtrArray ambiguousIndexValuesList;
+ CFX_ArrayTemplate<CFX_Int32Array*> ambiguousIndexValuesList;
CFX_Int32Array ambiguousIndexesList;
for (int32_t row = 0; row < detectionResult->getBarcodeRowCount(); row++) {
for (int32_t l = 0; l < detectionResult->getBarcodeColumnCount(); l++) {
CFX_Int32Array* values =
- ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(row))
- ->GetAt(l + 1))
- ->getValue();
+ barcodeMatrix->GetAt(row)->GetAt(l + 1)->getValue();
int32_t codewordIndex =
row * detectionResult->getBarcodeColumnCount() + l;
if (values->GetSize() == 0) {
@@ -392,35 +385,33 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(
}
}
}
- CFX_PtrArray ambiguousIndexValues;
+ CFX_ArrayTemplate<CFX_Int32Array*> ambiguousIndexValues;
ambiguousIndexValues.SetSize(ambiguousIndexValuesList.GetSize());
for (int32_t i = 0; i < ambiguousIndexValues.GetSize(); i++) {
ambiguousIndexValues.SetAt(i, ambiguousIndexValuesList.GetAt(i));
}
for (int32_t l = 0; l < barcodeMatrix->GetSize(); l++) {
- CFX_PtrArray* temp = (CFX_PtrArray*)barcodeMatrix->GetAt(l);
- for (int32_t j = 0; j < temp->GetSize(); j++) {
- delete (CBC_BarcodeValue*)temp->GetAt(j);
- }
+ CBC_BarcodeValueArray* temp = barcodeMatrix->GetAt(l);
+ for (int32_t j = 0; j < temp->GetSize(); j++)
+ delete temp->GetAt(j);
temp->RemoveAll();
delete temp;
}
- barcodeMatrix->RemoveAll();
- delete barcodeMatrix;
CBC_CommonDecoderResult* decoderResult =
createDecoderResultFromAmbiguousValues(
detectionResult->getBarcodeECLevel(), codewords, erasures,
ambiguousIndexesList, ambiguousIndexValues, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return decoderResult;
}
+
CBC_CommonDecoderResult*
CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(
int32_t ecLevel,
CFX_Int32Array& codewords,
CFX_Int32Array& erasureArray,
CFX_Int32Array& ambiguousIndexes,
- CFX_PtrArray& ambiguousIndexValues,
+ CFX_ArrayTemplate<CFX_Int32Array*>& ambiguousIndexValues,
int32_t& e) {
CFX_Int32Array ambiguousIndexCount;
ambiguousIndexCount.SetSize(ambiguousIndexes.GetSize());
@@ -428,8 +419,7 @@ CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(
while (tries-- > 0) {
for (int32_t l = 0; l < ambiguousIndexCount.GetSize(); l++) {
codewords[ambiguousIndexes[l]] =
- ((CFX_Int32Array*)ambiguousIndexValues.GetAt(l))
- ->GetAt(ambiguousIndexCount[l]);
+ ambiguousIndexValues.GetAt(l)->GetAt(ambiguousIndexCount[l]);
}
CBC_CommonDecoderResult* decoderResult =
decodeCodewords(codewords, ecLevel, erasureArray, e);
@@ -445,7 +435,7 @@ CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(
}
for (int32_t i = 0; i < ambiguousIndexCount.GetSize(); i++) {
if (ambiguousIndexCount[i] <
- ((CFX_Int32Array*)(ambiguousIndexValues.GetAt(i)))->GetSize() - 1) {
+ ambiguousIndexValues.GetAt(i)->GetSize() - 1) {
ambiguousIndexCount[i]++;
break;
} else {
@@ -460,28 +450,24 @@ CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(
e = BCExceptionChecksumInstance;
return NULL;
}
-CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(
+CBC_BarcodeValueArrayArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(
CBC_DetectionResult* detectionResult) {
- CFX_PtrArray* barcodeMatrix = new CFX_PtrArray;
+ CBC_BarcodeValueArrayArray* barcodeMatrix = new CBC_BarcodeValueArrayArray;
barcodeMatrix->SetSize(detectionResult->getBarcodeRowCount());
- CFX_PtrArray* temp = NULL;
- int32_t colume = 0;
for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) {
- temp = new CFX_PtrArray;
+ CBC_BarcodeValueArray* temp = new CBC_BarcodeValueArray;
temp->SetSize(detectionResult->getBarcodeColumnCount() + 2);
- for (colume = 0; colume < detectionResult->getBarcodeColumnCount() + 2;
- colume++) {
- temp->SetAt(colume, new CBC_BarcodeValue());
+ for (int32_t column = 0;
+ column < detectionResult->getBarcodeColumnCount() + 2; column++) {
+ temp->SetAt(column, new CBC_BarcodeValue());
}
barcodeMatrix->SetAt(row, temp);
}
- colume = -1;
for (int32_t i = 0;
i < detectionResult->getDetectionResultColumns().GetSize(); i++) {
CBC_DetectionResultColumn* detectionResultColumn =
(CBC_DetectionResultColumn*)detectionResult->getDetectionResultColumns()
.GetAt(i);
- colume++;
if (detectionResultColumn == NULL) {
continue;
}
@@ -492,9 +478,8 @@ CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(
if (codeword == NULL || codeword->getRowNumber() == -1) {
continue;
}
- ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(
- codeword->getRowNumber()))
- ->GetAt(colume))
+ barcodeMatrix->GetAt(codeword->getRowNumber())
+ ->GetAt(i)
->setValue(codeword->getValue());
}
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h
index 6dbc125c31..aa99d5a0d4 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_
#define XFA_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_
+#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h"
+
class CBC_CommonDecoderResult;
class CBC_CommonBitMatrix;
class CBC_Codeword;
@@ -30,7 +32,7 @@ class CBC_PDF417ScanningDecoder {
int32_t minCodewordWidth,
int32_t maxCodewordWidth,
int32_t& e);
- static CFX_ByteString toString(CFX_PtrArray* barcodeMatrix);
+ static CFX_ByteString toString(CBC_BarcodeValueArrayArray* barcodeMatrix);
private:
static int32_t CODEWORD_SKEW_SIZE;
@@ -56,7 +58,7 @@ class CBC_PDF417ScanningDecoder {
int32_t minCodewordWidth,
int32_t maxCodewordWidth);
static void adjustCodewordCount(CBC_DetectionResult* detectionResult,
- CFX_PtrArray* barcodeMatrix,
+ CBC_BarcodeValueArrayArray* barcodeMatrix,
int32_t& e);
static CBC_CommonDecoderResult* createDecoderResult(
CBC_DetectionResult* detectionResult,
@@ -66,9 +68,9 @@ class CBC_PDF417ScanningDecoder {
CFX_Int32Array& codewords,
CFX_Int32Array& erasureArray,
CFX_Int32Array& ambiguousIndexes,
- CFX_PtrArray& ambiguousIndexValues,
+ CFX_ArrayTemplate<CFX_Int32Array*>& ambiguousIndexValues,
int32_t& e);
- static CFX_PtrArray* createBarcodeMatrix(
+ static CBC_BarcodeValueArrayArray* createBarcodeMatrix(
CBC_DetectionResult* detectionResult);
static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult,
int32_t barcodeColumn);