summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/pdf417
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode/pdf417')
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417.cpp10
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp18
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp8
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp148
4 files changed, 56 insertions, 128 deletions
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
index 15b448b37b..908901c04e 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
@@ -401,11 +401,11 @@ CBC_PDF417::CBC_PDF417(FX_BOOL compact) {
m_minRows = 3;
m_barcodeMatrix = NULL;
}
+
CBC_PDF417::~CBC_PDF417() {
- if (m_barcodeMatrix) {
- delete m_barcodeMatrix;
- }
+ delete m_barcodeMatrix;
}
+
CBC_BarcodeMatrix* CBC_PDF417::getBarcodeMatrix() {
return m_barcodeMatrix;
}
@@ -556,9 +556,7 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(
continue;
}
ratio = newRatio;
- if (dimension) {
- delete dimension;
- }
+ delete dimension;
dimension = new CFX_Int32Array;
dimension->Add(cols);
dimension->Add(rows);
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
index c8328ab1c6..d2ad98e408 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
@@ -42,20 +42,14 @@ CBC_BoundingBox::CBC_BoundingBox(CBC_BoundingBox* boundingBox) {
init(boundingBox->m_image, boundingBox->m_topLeft, boundingBox->m_bottomLeft,
boundingBox->m_topRight, boundingBox->m_bottomRight);
}
+
CBC_BoundingBox::~CBC_BoundingBox() {
- if (m_topLeft) {
- delete m_topLeft;
- }
- if (m_bottomLeft) {
- delete m_bottomLeft;
- }
- if (m_topRight) {
- delete m_topRight;
- }
- if (m_bottomRight) {
- delete m_bottomRight;
- }
+ delete m_topLeft;
+ delete m_bottomLeft;
+ delete m_topRight;
+ delete m_bottomRight;
}
+
CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox,
CBC_BoundingBox* rightBox,
int32_t& e) {
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp
index cfd52e56dc..345efd5648 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp
@@ -114,9 +114,7 @@ CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple,
CFX_PtrArray* vertices = findVertices(bitMatrix, row, column);
if (vertices->GetAt(0) == NULL && vertices->GetAt(3) == NULL) {
if (!foundBarcodeInRow) {
- if (vertices) {
- delete (vertices);
- }
+ delete vertices;
break;
}
foundBarcodeInRow = FALSE;
@@ -132,9 +130,7 @@ CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple,
}
}
row += ROW_STEP;
- if (vertices) {
- delete (vertices);
- }
+ delete vertices;
continue;
}
foundBarcodeInRow = TRUE;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
index 830b65e199..2c96f7005f 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
@@ -153,32 +153,20 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(
n = j;
if (rLast->isZero()) {
e = BCExceptionChecksumException;
- if (qtemp) {
- delete qtemp;
- }
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
+ delete qtemp;
+ delete rtemp;
+ delete ttemp;
+ return nullptr;
}
r = rLastLast;
CBC_PDF417ECModulusPoly* q = m_field->getZero();
int32_t denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree());
int32_t dltInverse = m_field->inverse(denominatorLeadingTerm, e);
if (e != BCExceptionNO) {
- if (qtemp) {
- delete qtemp;
- }
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
+ delete qtemp;
+ delete rtemp;
+ delete ttemp;
+ return nullptr;
}
while (r->getDegree() >= rLast->getDegree() && !r->isZero()) {
int32_t degreeDiff = r->getDegree() - rLast->getDegree();
@@ -187,81 +175,51 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(
CBC_PDF417ECModulusPoly* buildmonomial =
m_field->buildMonomial(degreeDiff, scale, e);
if (e != BCExceptionNO) {
- if (qtemp) {
- delete qtemp;
- }
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
+ delete qtemp;
+ delete rtemp;
+ delete ttemp;
+ return nullptr;
}
q = q->add(buildmonomial, e);
delete buildmonomial;
- if (qtemp) {
- delete qtemp;
- }
+ delete qtemp;
if (e != BCExceptionNO) {
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
+ delete rtemp;
+ delete ttemp;
+ return nullptr;
}
qtemp = q;
CBC_PDF417ECModulusPoly* multiply =
rLast->multiplyByMonomial(degreeDiff, scale, e);
if (e != BCExceptionNO) {
- if (qtemp) {
- delete qtemp;
- }
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
+ delete qtemp;
+ delete rtemp;
+ delete ttemp;
+ return nullptr;
}
CBC_PDF417ECModulusPoly* temp = r;
r = temp->subtract(multiply, e);
delete multiply;
if (m > 1 && i > m) {
delete temp;
- temp = NULL;
+ temp = nullptr;
}
if (e != BCExceptionNO) {
- if (qtemp) {
- delete qtemp;
- }
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
+ delete qtemp;
+ delete rtemp;
+ delete ttemp;
+ return nullptr;
}
rtemp = r;
i = m + 1;
}
ttemp = q->multiply(tLast, e);
- if (qtemp) {
- delete qtemp;
- qtemp = NULL;
- }
+ delete qtemp;
+ qtemp = nullptr;
if (e != BCExceptionNO) {
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
+ delete rtemp;
+ delete ttemp;
+ return nullptr;
}
t = ttemp->subtract(tLastLast, e);
if (n > 1 && j > n) {
@@ -269,19 +227,15 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(
}
delete ttemp;
if (e != BCExceptionNO) {
- if (rtemp) {
- delete rtemp;
- }
- return NULL;
+ delete rtemp;
+ return nullptr;
}
ttemp = t;
t = ttemp->negative(e);
delete ttemp;
if (e != BCExceptionNO) {
- if (rtemp) {
- delete rtemp;
- }
- return NULL;
+ delete rtemp;
+ return nullptr;
}
ttemp = t;
j++;
@@ -289,38 +243,24 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(
int32_t sigmaTildeAtZero = t->getCoefficient(0);
if (sigmaTildeAtZero == 0) {
e = BCExceptionChecksumException;
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
+ delete rtemp;
+ delete ttemp;
+ return nullptr;
}
int32_t inverse = m_field->inverse(sigmaTildeAtZero, e);
if (e != BCExceptionNO) {
- if (rtemp) {
- delete rtemp;
- }
- if (ttemp) {
- delete ttemp;
- }
- return NULL;
- }
- CBC_PDF417ECModulusPoly* sigma = t->multiply(inverse, e);
- if (ttemp) {
+ delete rtemp;
delete ttemp;
+ return nullptr;
}
+ CBC_PDF417ECModulusPoly* sigma = t->multiply(inverse, e);
+ delete ttemp;
if (e != BCExceptionNO) {
- if (rtemp) {
- delete rtemp;
- }
- return NULL;
- }
- CBC_PDF417ECModulusPoly* omega = r->multiply(inverse, e);
- if (rtemp) {
delete rtemp;
+ return nullptr;
}
+ CBC_PDF417ECModulusPoly* omega = r->multiply(inverse, e);
+ delete rtemp;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CFX_PtrArray* modulusPoly = new CFX_PtrArray;
modulusPoly->Add(sigma);