summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/pdf417
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-09 18:39:33 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-09 18:39:33 -0700
commit6dc1d7753691c0ff2f390e8ffd95a3182064487e (patch)
tree43d77664973a76c107832ae7b3c3e0f04bba1fe0 /xfa/fxbarcode/pdf417
parentfcf61b39ee597c73e80ba789833fb7fe49878422 (diff)
downloadpdfium-6dc1d7753691c0ff2f390e8ffd95a3182064487e.tar.xz
Get rid of NULLs in xfa/fxbarcode/
Review-Url: https://codereview.chromium.org/2048983002
Diffstat (limited to 'xfa/fxbarcode/pdf417')
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417.cpp12
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp31
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp10
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp24
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp4
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp42
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp10
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp20
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp10
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp32
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp3
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp111
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp2
13 files changed, 155 insertions, 156 deletions
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
index 908901c04e..317a1cb92b 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
@@ -390,7 +390,7 @@ CBC_PDF417::CBC_PDF417() {
m_maxCols = 30;
m_maxRows = 90;
m_minRows = 3;
- m_barcodeMatrix = NULL;
+ m_barcodeMatrix = nullptr;
}
CBC_PDF417::CBC_PDF417(FX_BOOL compact) {
m_compact = compact;
@@ -399,7 +399,7 @@ CBC_PDF417::CBC_PDF417(FX_BOOL compact) {
m_maxCols = 30;
m_maxRows = 90;
m_minRows = 3;
- m_barcodeMatrix = NULL;
+ m_barcodeMatrix = nullptr;
}
CBC_PDF417::~CBC_PDF417() {
@@ -539,7 +539,7 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(
int32_t errorCorrectionCodeWords,
int32_t& e) {
FX_FLOAT ratio = 0.0f;
- CFX_Int32Array* dimension = NULL;
+ CFX_Int32Array* dimension = nullptr;
for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) {
int32_t rows =
calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols);
@@ -561,7 +561,7 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(
dimension->Add(cols);
dimension->Add(rows);
}
- if (dimension == NULL) {
+ if (!dimension) {
int32_t rows = calculateNumberOfRows(sourceCodeWords,
errorCorrectionCodeWords, m_minCols);
if (rows < m_minRows) {
@@ -574,9 +574,9 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(
dimension->Add(rows);
}
}
- if (dimension == NULL) {
+ if (!dimension) {
e = BCExceptionUnableToFitMessageInColumns;
- return NULL;
+ return nullptr;
}
return dimension;
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
index d2ad98e408..928ddc5782 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
@@ -31,9 +31,8 @@ CBC_BoundingBox::CBC_BoundingBox(CBC_CommonBitMatrix* image,
CBC_ResultPoint* topRight,
CBC_ResultPoint* bottomRight,
int32_t& e) {
- if ((topLeft == NULL && topRight == NULL) ||
- (bottomLeft == NULL && bottomRight == NULL) ||
- (topLeft && bottomLeft == NULL) || (topRight && bottomRight == NULL)) {
+ if ((!topLeft && !topRight) || (!bottomLeft && !bottomRight) ||
+ (topLeft && !bottomLeft) || (topRight && !bottomRight)) {
e = BCExceptionNotFoundInstance;
}
init(image, topLeft, bottomLeft, topRight, bottomRight);
@@ -53,19 +52,19 @@ CBC_BoundingBox::~CBC_BoundingBox() {
CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox,
CBC_BoundingBox* rightBox,
int32_t& e) {
- CBC_BoundingBox* boundingBox = NULL;
- if (leftBox == NULL) {
+ CBC_BoundingBox* boundingBox = nullptr;
+ if (!leftBox) {
boundingBox = new CBC_BoundingBox(rightBox);
return boundingBox;
}
- if (rightBox == NULL) {
+ if (!rightBox) {
boundingBox = new CBC_BoundingBox(leftBox);
return boundingBox;
}
boundingBox = new CBC_BoundingBox(leftBox->m_image, leftBox->m_topLeft,
leftBox->m_bottomLeft, rightBox->m_topRight,
rightBox->m_bottomRight, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return boundingBox;
}
CBC_BoundingBox* CBC_BoundingBox::addMissingRows(int32_t missingStartRows,
@@ -76,8 +75,8 @@ CBC_BoundingBox* CBC_BoundingBox::addMissingRows(int32_t missingStartRows,
CBC_ResultPoint* newBottomLeft = m_bottomLeft;
CBC_ResultPoint* newTopRight = m_topRight;
CBC_ResultPoint* newBottomRight = m_bottomRight;
- CBC_ResultPoint* newTop = NULL;
- CBC_ResultPoint* newBottom = NULL;
+ CBC_ResultPoint* newTop = nullptr;
+ CBC_ResultPoint* newBottom = nullptr;
if (missingStartRows > 0) {
CBC_ResultPoint* top = isLeft ? m_topLeft : m_topRight;
int32_t newMinY = (int32_t)top->GetY() - missingStartRows;
@@ -110,7 +109,7 @@ CBC_BoundingBox* CBC_BoundingBox::addMissingRows(int32_t missingStartRows,
m_image, newTopLeft, newBottomLeft, newTopRight, newBottomRight, e);
delete newTop;
delete newBottom;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return boundingBox;
}
void CBC_BoundingBox::setTopRight(CBC_ResultPoint topRight) {
@@ -156,10 +155,10 @@ void CBC_BoundingBox::init(CBC_CommonBitMatrix* image,
CBC_ResultPoint* bottomLeft,
CBC_ResultPoint* topRight,
CBC_ResultPoint* bottomRight) {
- m_topLeft = NULL;
- m_bottomLeft = NULL;
- m_topRight = NULL;
- m_bottomRight = NULL;
+ m_topLeft = nullptr;
+ m_bottomLeft = nullptr;
+ m_topRight = nullptr;
+ m_bottomRight = nullptr;
m_image = image;
if (topLeft) {
m_topLeft = new CBC_ResultPoint(topLeft->GetX(), topLeft->GetY());
@@ -177,10 +176,10 @@ void CBC_BoundingBox::init(CBC_CommonBitMatrix* image,
calculateMinMaxValues();
}
void CBC_BoundingBox::calculateMinMaxValues() {
- if (m_topLeft == NULL) {
+ if (!m_topLeft) {
m_topLeft = new CBC_ResultPoint(0, m_topRight->GetY());
m_bottomLeft = new CBC_ResultPoint(0, m_bottomRight->GetY());
- } else if (m_topRight == NULL) {
+ } else if (!m_topRight) {
m_topRight = new CBC_ResultPoint((FX_FLOAT)m_image->GetWidth() - 1,
(FX_FLOAT)m_topLeft->GetY());
m_bottomRight = new CBC_ResultPoint((FX_FLOAT)m_image->GetWidth() - 1,
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp b/xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp
index 92351d0c61..64ebbe13af 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp
@@ -79,7 +79,7 @@ CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(
break;
case NUMERIC_COMPACTION_MODE_LATCH:
codeIndex = numericCompaction(codewords, codeIndex, result, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
break;
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
codeIndex = byteCompaction(code, codewords, codeIndex, result);
@@ -91,7 +91,7 @@ CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(
codeIndex = decodeMacroBlock(codewords, codeIndex, resultMetadata, e);
if (e != BCExceptionNO) {
delete resultMetadata;
- return NULL;
+ return nullptr;
}
break;
default:
@@ -104,20 +104,20 @@ CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(
} else {
e = BCExceptionFormatInstance;
delete resultMetadata;
- return NULL;
+ return nullptr;
}
}
if (result.GetLength() == 0) {
e = BCExceptionFormatInstance;
delete resultMetadata;
- return NULL;
+ return nullptr;
}
CFX_ByteArray rawBytes;
CBC_CommonDecoderResult* tempCd = new CBC_CommonDecoderResult();
tempCd->Init(rawBytes, result, ecLevel, e);
if (e != BCExceptionNO) {
delete resultMetadata;
- return NULL;
+ return nullptr;
}
tempCd->setOther(resultMetadata);
return tempCd;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
index 79754b020e..931a83163c 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
@@ -122,9 +122,9 @@ int32_t CBC_DetectionResult::adjustRowNumbers() {
m_detectionResultColumns[barcodeColumn]->getCodewords();
for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize();
codewordsRow++) {
- if (codewords->GetAt(codewordsRow) == NULL) {
+ if (!codewords->GetAt(codewordsRow))
continue;
- }
+
if (!codewords->GetAt(codewordsRow)->hasValidRowNumber()) {
adjustRowNumbers(barcodeColumn, codewordsRow, codewords);
}
@@ -180,9 +180,9 @@ int32_t CBC_DetectionResult::adjustRowNumbersFromRRI() {
m_detectionResultColumns.GetAt(m_barcodeColumnCount + 1)->getCodewords();
for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize();
codewordsRow++) {
- if (codewords->GetAt(codewordsRow) == NULL) {
+ if (!codewords->GetAt(codewordsRow))
continue;
- }
+
int32_t rowIndicatorRowNumber =
codewords->GetAt(codewordsRow)->getRowNumber();
int32_t invalidRowCounts = 0;
@@ -204,17 +204,17 @@ int32_t CBC_DetectionResult::adjustRowNumbersFromRRI() {
return unadjustedCount;
}
int32_t CBC_DetectionResult::adjustRowNumbersFromLRI() {
- if (m_detectionResultColumns[0] == NULL) {
+ if (!m_detectionResultColumns[0])
return 0;
- }
+
int32_t unadjustedCount = 0;
CFX_ArrayTemplate<CBC_Codeword*>* codewords =
m_detectionResultColumns.GetAt(0)->getCodewords();
for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize();
codewordsRow++) {
- if (codewords->GetAt(codewordsRow) == NULL) {
+ if (!codewords->GetAt(codewordsRow))
continue;
- }
+
int32_t rowIndicatorRowNumber =
codewords->GetAt(codewordsRow)->getRowNumber();
int32_t invalidRowCounts = 0;
@@ -239,9 +239,9 @@ int32_t CBC_DetectionResult::adjustRowNumberIfValid(
int32_t rowIndicatorRowNumber,
int32_t invalidRowCounts,
CBC_Codeword* codeword) {
- if (codeword == NULL) {
+ if (!codeword)
return invalidRowCounts;
- }
+
if (!codeword->hasValidRowNumber()) {
if (codeword->isValidRowNumber(rowIndicatorRowNumber)) {
codeword->setRowNumber(rowIndicatorRowNumber);
@@ -298,9 +298,9 @@ void CBC_DetectionResult::adjustRowNumbers(
}
FX_BOOL CBC_DetectionResult::adjustRowNumber(CBC_Codeword* codeword,
CBC_Codeword* otherCodeword) {
- if (otherCodeword == NULL) {
+ if (!otherCodeword)
return FALSE;
- }
+
if (otherCodeword->hasValidRowNumber() &&
otherCodeword->getBucket() == codeword->getBucket()) {
codeword->setRowNumber(otherCodeword->getRowNumber());
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
index 110a5f375e..635dc20a6f 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
@@ -60,7 +60,7 @@ CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow) {
}
}
}
- return NULL;
+ return nullptr;
}
int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow) {
return imageRow - m_boundingBox->getMinY();
@@ -88,7 +88,7 @@ CFX_ByteString CBC_DetectionResultColumn::toString() {
int32_t row = 0;
for (int32_t i = 0; i < m_codewords->GetSize(); i++) {
CBC_Codeword* codeword = (CBC_Codeword*)m_codewords->GetAt(i);
- if (codeword == NULL) {
+ if (!codeword) {
result += (FX_CHAR)row;
row++;
continue;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
index 8783e87f1b..5149c3db14 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
@@ -67,9 +67,9 @@ CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRowNumbers(
int32_t currentRowHeight = 0;
for (int32_t codewordsRow = firstRow; codewordsRow < lastRow;
codewordsRow++) {
- if (codewords->GetAt(codewordsRow) == NULL) {
+ if (!codewords->GetAt(codewordsRow))
continue;
- }
+
CBC_Codeword* codeword = codewords->GetAt(codewordsRow);
int32_t rowDifference = codeword->getRowNumber() - barcodeRow;
if (rowDifference == 0) {
@@ -80,11 +80,11 @@ CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRowNumbers(
currentRowHeight = 1;
barcodeRow = codeword->getRowNumber();
} else if (rowDifference < 0) {
- codewords->SetAt(codewordsRow, NULL);
+ codewords->SetAt(codewordsRow, nullptr);
} else if (codeword->getRowNumber() >= barcodeMetadata.getRowCount()) {
- codewords->SetAt(codewordsRow, NULL);
+ codewords->SetAt(codewordsRow, nullptr);
} else if (rowDifference > codewordsRow) {
- codewords->SetAt(codewordsRow, NULL);
+ codewords->SetAt(codewordsRow, nullptr);
} else {
int32_t checkedRows;
if (maxRowHeight > 2) {
@@ -95,10 +95,10 @@ CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRowNumbers(
FX_BOOL closePreviousCodewordFound = checkedRows >= codewordsRow;
for (int32_t i = 1; i <= checkedRows && !closePreviousCodewordFound;
i++) {
- closePreviousCodewordFound = codewords->GetAt(codewordsRow - i) != NULL;
+ closePreviousCodewordFound = !!codewords->GetAt(codewordsRow - i);
}
if (closePreviousCodewordFound) {
- codewords->SetAt(codewordsRow, NULL);
+ codewords->SetAt(codewordsRow, nullptr);
} else {
barcodeRow = codeword->getRowNumber();
currentRowHeight = 1;
@@ -110,9 +110,9 @@ CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRowNumbers(
CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(
int32_t& e) {
CBC_BarcodeMetadata* barcodeMetadata = getBarcodeMetadata();
- if (barcodeMetadata == NULL) {
+ if (!barcodeMetadata) {
e = BCExceptionCannotMetadata;
- return NULL;
+ return nullptr;
}
adjustIncompleteIndicatorColumnRowNumbers(*barcodeMetadata);
CFX_Int32Array* result = new CFX_Int32Array;
@@ -144,9 +144,9 @@ int32_t CBC_DetectionResultRowIndicatorColumn::
int32_t currentRowHeight = 0;
for (int32_t codewordsRow = firstRow; codewordsRow < lastRow;
codewordsRow++) {
- if (codewords->GetAt(codewordsRow) == NULL) {
+ if (!codewords->GetAt(codewordsRow))
continue;
- }
+
CBC_Codeword* codeword = codewords->GetAt(codewordsRow);
codeword->setRowNumberAsRowIndicatorColumn();
int32_t rowDifference = codeword->getRowNumber() - barcodeRow;
@@ -158,7 +158,7 @@ int32_t CBC_DetectionResultRowIndicatorColumn::
currentRowHeight = 1;
barcodeRow = codeword->getRowNumber();
} else if (codeword->getRowNumber() >= barcodeMetadata.getRowCount()) {
- codewords->SetAt(codewordsRow, NULL);
+ codewords->SetAt(codewordsRow, nullptr);
} else {
barcodeRow = codeword->getRowNumber();
currentRowHeight = 1;
@@ -175,9 +175,9 @@ CBC_DetectionResultRowIndicatorColumn::getBarcodeMetadata() {
CBC_BarcodeValue barcodeECLevel;
for (int32_t i = 0; i < codewords->GetSize(); i++) {
CBC_Codeword* codeword = codewords->GetAt(i);
- if (codeword == NULL) {
+ if (!codeword)
continue;
- }
+
codeword->setRowNumberAsRowIndicatorColumn();
int32_t rowIndicatorValue = codeword->getValue() % 30;
int32_t codewordRowNumber = codeword->getRowNumber();
@@ -208,7 +208,7 @@ CBC_DetectionResultRowIndicatorColumn::getBarcodeMetadata() {
barcodeRowCountUpperPart.getValue()->GetAt(0) +
barcodeRowCountLowerPart.getValue()->GetAt(0) >
CBC_PDF417Common::MAX_ROWS_IN_BARCODE) {
- return NULL;
+ return nullptr;
}
CBC_BarcodeMetadata* barcodeMetadata =
new CBC_BarcodeMetadata(barcodeColumnCount.getValue()->GetAt(0),
@@ -231,13 +231,13 @@ void CBC_DetectionResultRowIndicatorColumn::removeIncorrectCodewords(
for (int32_t codewordRow = 0; codewordRow < codewords->GetSize();
codewordRow++) {
CBC_Codeword* codeword = codewords->GetAt(codewordRow);
- if (codeword == NULL) {
+ if (!codeword)
continue;
- }
+
int32_t rowIndicatorValue = codeword->getValue() % 30;
int32_t codewordRowNumber = codeword->getRowNumber();
if (codewordRowNumber > barcodeMetadata.getRowCount()) {
- codewords->SetAt(codewordRow, NULL);
+ codewords->SetAt(codewordRow, nullptr);
continue;
}
if (!m_isLeft) {
@@ -247,19 +247,19 @@ void CBC_DetectionResultRowIndicatorColumn::removeIncorrectCodewords(
case 0:
if (rowIndicatorValue * 3 + 1 !=
barcodeMetadata.getRowCountUpperPart()) {
- codewords->SetAt(codewordRow, NULL);
+ codewords->SetAt(codewordRow, nullptr);
}
break;
case 1:
if (rowIndicatorValue / 3 !=
barcodeMetadata.getErrorCorrectionLevel() ||
rowIndicatorValue % 3 != barcodeMetadata.getRowCountLowerPart()) {
- codewords->SetAt(codewordRow, NULL);
+ codewords->SetAt(codewordRow, nullptr);
}
break;
case 2:
if (rowIndicatorValue + 1 != barcodeMetadata.getColumnCount()) {
- codewords->SetAt(codewordRow, NULL);
+ codewords->SetAt(codewordRow, nullptr);
}
break;
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp
index 6c217621b2..064f6cc30b 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp
@@ -57,7 +57,7 @@ CBC_PDF417DetectorResult* CBC_Detector::detect(CBC_BinaryBitmap* image,
FX_BOOL multiple,
int32_t& e) {
CBC_CommonBitMatrix* bitMatrix = image->GetBlackMatrix(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
CBC_ResultPointArrayArray* barcodeCoordinates = detect(multiple, bitMatrix);
if (barcodeCoordinates->GetSize() == 0) {
rotate180(bitMatrix);
@@ -65,7 +65,7 @@ CBC_PDF417DetectorResult* CBC_Detector::detect(CBC_BinaryBitmap* image,
}
if (barcodeCoordinates->GetSize() == 0) {
e = BCExceptionUnSupportedBarcode;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
}
return new CBC_PDF417DetectorResult(bitMatrix, barcodeCoordinates);
}
@@ -115,7 +115,7 @@ CBC_ResultPointArrayArray* CBC_Detector::detect(
FX_BOOL foundBarcodeInRow = FALSE;
while (row < bitMatrix->GetHeight()) {
CBC_ResultPointArray* vertices = findVertices(bitMatrix, row, column);
- if (vertices->GetAt(0) == NULL && vertices->GetAt(3) == NULL) {
+ if (!vertices->GetAt(0) && !vertices->GetAt(3)) {
if (!foundBarcodeInRow) {
delete vertices;
break;
@@ -255,7 +255,7 @@ CBC_ResultPointArray* CBC_Detector::findRowsWithPattern(
}
if (stopRow - startRow < BARCODE_MIN_HEIGHT) {
for (int32_t i = 0; i < result->GetSize(); i++) {
- result->SetAt(i, NULL);
+ result->SetAt(i, nullptr);
}
}
return result;
@@ -316,7 +316,7 @@ CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix,
}
}
delete intarray;
- return NULL;
+ return nullptr;
}
int32_t CBC_Detector::patternMatchVariance(CFX_Int32Array& counters,
int32_t* pattern,
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
index 6a1f46fd02..aadb1a6ac5 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
@@ -26,7 +26,7 @@
#include "xfa/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h"
#include "xfa/fxbarcode/utils.h"
-CBC_PDF417ECModulusGF* CBC_PDF417ECErrorCorrection::m_field = NULL;
+CBC_PDF417ECModulusGF* CBC_PDF417ECErrorCorrection::m_field = nullptr;
void CBC_PDF417ECErrorCorrection::Initialize(int32_t& e) {
m_field =
@@ -137,9 +137,9 @@ CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a,
CBC_PDF417ECModulusPoly* r = b;
CBC_PDF417ECModulusPoly* tLast = m_field->getZero();
CBC_PDF417ECModulusPoly* t = m_field->getOne();
- CBC_PDF417ECModulusPoly* qtemp = NULL;
- CBC_PDF417ECModulusPoly* rtemp = NULL;
- CBC_PDF417ECModulusPoly* ttemp = NULL;
+ CBC_PDF417ECModulusPoly* qtemp = nullptr;
+ CBC_PDF417ECModulusPoly* rtemp = nullptr;
+ CBC_PDF417ECModulusPoly* ttemp = nullptr;
int32_t i = 0;
int32_t j = 0;
int32_t m = 0;
@@ -261,7 +261,7 @@ CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a,
}
CBC_PDF417ECModulusPoly* omega = r->multiply(inverse, e);
delete rtemp;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
CFX_ArrayTemplate<CBC_PDF417ECModulusPoly*>* modulusPoly =
new CFX_ArrayTemplate<CBC_PDF417ECModulusPoly*>();
modulusPoly->Add(sigma);
@@ -280,7 +280,7 @@ CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(
result->SetAt(ee, m_field->inverse(i, e));
if (e != BCExceptionNO) {
delete result;
- return NULL;
+ return nullptr;
}
ee++;
}
@@ -288,7 +288,7 @@ CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(
if (ee != numErrors) {
e = BCExceptionChecksumException;
delete result;
- return NULL;
+ return nullptr;
}
return result;
}
@@ -306,7 +306,7 @@ CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(
}
CBC_PDF417ECModulusPoly formalDerivative(m_field,
formalDerivativeCoefficients, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
int32_t s = errorLocations.GetSize();
CFX_Int32Array* result = new CFX_Int32Array;
result->SetSize(s);
@@ -314,7 +314,7 @@ CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(
int32_t xiInverse = m_field->inverse(errorLocations[i], e);
if (e != BCExceptionNO) {
delete result;
- return NULL;
+ return nullptr;
}
int32_t numerator =
m_field->subtract(0, errorEvaluator->evaluateAt(xiInverse));
@@ -322,7 +322,7 @@ CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(
m_field->inverse(formalDerivative.evaluateAt(xiInverse), e);
if (e != BCExceptionNO) {
delete result;
- return NULL;
+ return nullptr;
}
result->SetAt(i, m_field->multiply(numerator, denominator));
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp
index 4779d80157..03879dbabb 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp
@@ -25,7 +25,7 @@
#include "xfa/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h"
#include "xfa/fxbarcode/utils.h"
-CBC_PDF417ECModulusGF* CBC_PDF417ECModulusGF::PDF417_GF = NULL;
+CBC_PDF417ECModulusGF* CBC_PDF417ECModulusGF::PDF417_GF = nullptr;
void CBC_PDF417ECModulusGF::Initialize(int32_t& e) {
PDF417_GF =
new CBC_PDF417ECModulusGF(CBC_PDF417Common::NUMBER_OF_CODEWORDS, 3, e);
@@ -70,20 +70,20 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::buildMonomial(
int32_t& e) {
if (degree < 0) {
e = BCExceptionIllegalArgument;
- return NULL;
+ return nullptr;
}
- CBC_PDF417ECModulusPoly* modulusPoly = NULL;
+ CBC_PDF417ECModulusPoly* modulusPoly = nullptr;
if (coefficient == 0) {
modulusPoly = new CBC_PDF417ECModulusPoly(m_zero->getField(),
m_zero->getCoefficients(), e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
CFX_Int32Array coefficients;
coefficients.SetSize(degree + 1);
coefficients[0] = coefficient;
modulusPoly = new CBC_PDF417ECModulusPoly(this, coefficients, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
int32_t CBC_PDF417ECModulusGF::add(int32_t a, int32_t b) {
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp
index 47fbcce5d0..a41eeea472 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp
@@ -94,16 +94,16 @@ int32_t CBC_PDF417ECModulusPoly::evaluateAt(int32_t a) {
CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add(
CBC_PDF417ECModulusPoly* other,
int32_t& e) {
- CBC_PDF417ECModulusPoly* modulusPoly = NULL;
+ CBC_PDF417ECModulusPoly* modulusPoly = nullptr;
if (isZero()) {
modulusPoly = new CBC_PDF417ECModulusPoly(other->getField(),
other->getCoefficients(), e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
if (other->isZero()) {
modulusPoly = new CBC_PDF417ECModulusPoly(m_field, m_coefficients, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
CFX_Int32Array smallerCoefficients;
@@ -128,34 +128,34 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add(
largerCoefficients[i]);
}
modulusPoly = new CBC_PDF417ECModulusPoly(m_field, sumDiff, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::subtract(
CBC_PDF417ECModulusPoly* other,
int32_t& e) {
- CBC_PDF417ECModulusPoly* modulusPoly = NULL;
+ CBC_PDF417ECModulusPoly* modulusPoly = nullptr;
if (other->isZero()) {
modulusPoly = new CBC_PDF417ECModulusPoly(m_field, m_coefficients, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
CBC_PDF417ECModulusPoly* poly = other->negative(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
modulusPoly = add(poly, e);
delete poly;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(
CBC_PDF417ECModulusPoly* other,
int32_t& e) {
- CBC_PDF417ECModulusPoly* modulusPoly = NULL;
+ CBC_PDF417ECModulusPoly* modulusPoly = nullptr;
if (isZero() || other->isZero()) {
modulusPoly =
new CBC_PDF417ECModulusPoly(m_field->getZero()->getField(),
m_field->getZero()->getCoefficients(), e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
CFX_Int32Array aCoefficients;
@@ -174,7 +174,7 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(
}
}
modulusPoly = new CBC_PDF417ECModulusPoly(m_field, product, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::negative(int32_t& e) {
@@ -186,22 +186,22 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::negative(int32_t& e) {
}
CBC_PDF417ECModulusPoly* modulusPoly =
new CBC_PDF417ECModulusPoly(m_field, negativeCoefficients, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(int32_t scalar,
int32_t& e) {
- CBC_PDF417ECModulusPoly* modulusPoly = NULL;
+ CBC_PDF417ECModulusPoly* modulusPoly = nullptr;
if (scalar == 0) {
modulusPoly =
new CBC_PDF417ECModulusPoly(m_field->getZero()->getField(),
m_field->getZero()->getCoefficients(), e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
if (scalar == 1) {
modulusPoly = new CBC_PDF417ECModulusPoly(m_field, m_coefficients, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
int32_t size = m_coefficients.GetSize();
@@ -211,7 +211,7 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(int32_t scalar,
product[i] = m_field->multiply(m_coefficients[i], scalar);
}
modulusPoly = new CBC_PDF417ECModulusPoly(m_field, product, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return modulusPoly;
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp
index e68969ef30..894b5d3fad 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp
@@ -94,9 +94,8 @@ CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image,
}
int32_t CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1,
CBC_ResultPoint* p2) {
- if (p1 == NULL || p2 == NULL) {
+ if (!p1 || !p2)
return 0;
- }
return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX());
}
int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1,
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
index 4e1d8dd1e9..a6e882b1cb 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
@@ -46,7 +46,8 @@
int32_t CBC_PDF417ScanningDecoder::CODEWORD_SKEW_SIZE = 2;
int32_t CBC_PDF417ScanningDecoder::MAX_ERRORS = 3;
int32_t CBC_PDF417ScanningDecoder::MAX_EC_CODEWORDS = 512;
-CBC_PDF417ECErrorCorrection* CBC_PDF417ScanningDecoder::errorCorrection = NULL;
+CBC_PDF417ECErrorCorrection* CBC_PDF417ScanningDecoder::errorCorrection =
+ nullptr;
CBC_PDF417ScanningDecoder::CBC_PDF417ScanningDecoder() {}
CBC_PDF417ScanningDecoder::~CBC_PDF417ScanningDecoder() {}
@@ -67,10 +68,10 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
int32_t& e) {
CBC_BoundingBox* boundingBox = new CBC_BoundingBox(
image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn = NULL;
- CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn = NULL;
- CBC_DetectionResult* detectionResult = NULL;
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn = nullptr;
+ CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn = nullptr;
+ CBC_DetectionResult* detectionResult = nullptr;
for (int32_t i = 0; i < 2; i++) {
if (imageTopLeft) {
leftRowIndicatorColumn =
@@ -88,7 +89,7 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
delete leftRowIndicatorColumn;
delete rightRowIndicatorColumn;
delete boundingBox;
- return NULL;
+ return nullptr;
}
if (i == 0 && (detectionResult->getBoundingBox()->getMinY() <
boundingBox->getMinY() ||
@@ -105,7 +106,7 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
detectionResult->setDetectionResultColumn(0, leftRowIndicatorColumn);
detectionResult->setDetectionResultColumn(maxBarcodeColumn,
rightRowIndicatorColumn);
- FX_BOOL leftToRight = leftRowIndicatorColumn != NULL;
+ FX_BOOL leftToRight = !!leftRowIndicatorColumn;
for (int32_t barcodeColumnCount = 1; barcodeColumnCount <= maxBarcodeColumn;
barcodeColumnCount++) {
int32_t barcodeColumn = leftToRight ? barcodeColumnCount
@@ -113,7 +114,7 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
if (detectionResult->getDetectionResultColumn(barcodeColumn)) {
continue;
}
- CBC_DetectionResultColumn* detectionResultColumn = NULL;
+ CBC_DetectionResultColumn* detectionResultColumn = nullptr;
if (barcodeColumn == 0 || barcodeColumn == maxBarcodeColumn) {
detectionResultColumn = new CBC_DetectionResultRowIndicatorColumn(
boundingBox, barcodeColumn == 0);
@@ -153,7 +154,7 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
createDecoderResult(detectionResult, e);
if (e != BCExceptionNO) {
delete detectionResult;
- return NULL;
+ return nullptr;
}
return decoderresult;
}
@@ -181,33 +182,33 @@ CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(
CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn,
CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn,
int32_t& e) {
- if (leftRowIndicatorColumn == NULL && rightRowIndicatorColumn == NULL) {
+ if (!leftRowIndicatorColumn && !rightRowIndicatorColumn) {
e = BCExceptionIllegalArgument;
- return NULL;
+ return nullptr;
}
CBC_BarcodeMetadata* barcodeMetadata =
getBarcodeMetadata(leftRowIndicatorColumn, rightRowIndicatorColumn);
- if (barcodeMetadata == NULL) {
+ if (!barcodeMetadata) {
e = BCExceptionCannotMetadata;
- return NULL;
+ return nullptr;
}
CBC_BoundingBox* leftboundingBox =
adjustBoundingBox(leftRowIndicatorColumn, e);
if (e != BCExceptionNO) {
delete barcodeMetadata;
- return NULL;
+ return nullptr;
}
CBC_BoundingBox* rightboundingBox =
adjustBoundingBox(rightRowIndicatorColumn, e);
if (e != BCExceptionNO) {
delete barcodeMetadata;
- return NULL;
+ return nullptr;
}
CBC_BoundingBox* boundingBox =
CBC_BoundingBox::merge(leftboundingBox, rightboundingBox, e);
if (e != BCExceptionNO) {
delete barcodeMetadata;
- return NULL;
+ return nullptr;
}
CBC_DetectionResult* detectionresult =
new CBC_DetectionResult(barcodeMetadata, boundingBox);
@@ -216,11 +217,11 @@ CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(
CBC_BoundingBox* CBC_PDF417ScanningDecoder::adjustBoundingBox(
CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn,
int32_t& e) {
- if (rowIndicatorColumn == NULL) {
- return NULL;
- }
+ if (!rowIndicatorColumn)
+ return nullptr;
+
CFX_Int32Array* rowHeights = rowIndicatorColumn->getRowHeights(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
int32_t maxRowHeight = getMax(*rowHeights);
int32_t missingStartRows = 0;
for (int32_t i = 0; i < rowHeights->GetSize(); i++) {
@@ -232,8 +233,7 @@ CBC_BoundingBox* CBC_PDF417ScanningDecoder::adjustBoundingBox(
}
CFX_ArrayTemplate<CBC_Codeword*>* codewords =
rowIndicatorColumn->getCodewords();
- for (int32_t row = 0; missingStartRows > 0 && codewords->GetAt(row) == NULL;
- row++) {
+ for (int32_t row = 0; missingStartRows > 0 && !codewords->GetAt(row); row++) {
missingStartRows--;
}
int32_t missingEndRows = 0;
@@ -244,13 +244,13 @@ CBC_BoundingBox* CBC_PDF417ScanningDecoder::adjustBoundingBox(
}
}
for (int32_t row2 = codewords->GetSize() - 1;
- missingEndRows > 0 && codewords->GetAt(row2) == NULL; row2--) {
+ missingEndRows > 0 && !codewords->GetAt(row2); row2--) {
missingEndRows--;
}
CBC_BoundingBox* boundingBox =
rowIndicatorColumn->getBoundingBox()->addMissingRows(
missingStartRows, missingEndRows, rowIndicatorColumn->isLeft(), e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return boundingBox;
}
int32_t CBC_PDF417ScanningDecoder::getMax(CFX_Int32Array& values) {
@@ -264,22 +264,23 @@ int32_t CBC_PDF417ScanningDecoder::getMax(CFX_Int32Array& values) {
CBC_BarcodeMetadata* CBC_PDF417ScanningDecoder::getBarcodeMetadata(
CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn,
CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn) {
- CBC_BarcodeMetadata* leftBarcodeMetadata = NULL;
- CBC_BarcodeMetadata* rightBarcodeMetadata = NULL;
- if (leftRowIndicatorColumn == NULL ||
- (leftBarcodeMetadata = leftRowIndicatorColumn->getBarcodeMetadata()) ==
- NULL) {
- return rightRowIndicatorColumn == NULL
- ? NULL
- : rightRowIndicatorColumn->getBarcodeMetadata();
- }
- if (rightRowIndicatorColumn == NULL ||
- (rightBarcodeMetadata = rightRowIndicatorColumn->getBarcodeMetadata()) ==
- NULL) {
- return leftRowIndicatorColumn == NULL
- ? NULL
- : leftRowIndicatorColumn->getBarcodeMetadata();
+ CBC_BarcodeMetadata* leftBarcodeMetadata =
+ leftRowIndicatorColumn ? leftRowIndicatorColumn->getBarcodeMetadata()
+ : nullptr;
+ if (!leftBarcodeMetadata) {
+ return rightRowIndicatorColumn
+ ? rightRowIndicatorColumn->getBarcodeMetadata()
+ : nullptr;
+ }
+
+ CBC_BarcodeMetadata* rightBarcodeMetadata =
+ rightRowIndicatorColumn ? rightRowIndicatorColumn->getBarcodeMetadata()
+ : nullptr;
+ if (!rightBarcodeMetadata) {
+ return leftRowIndicatorColumn ? leftRowIndicatorColumn->getBarcodeMetadata()
+ : nullptr;
}
+
if (leftBarcodeMetadata->getColumnCount() !=
rightBarcodeMetadata->getColumnCount() &&
leftBarcodeMetadata->getErrorCorrectionLevel() !=
@@ -288,7 +289,7 @@ CBC_BarcodeMetadata* CBC_PDF417ScanningDecoder::getBarcodeMetadata(
rightBarcodeMetadata->getRowCount()) {
delete leftBarcodeMetadata;
delete rightBarcodeMetadata;
- return NULL;
+ return nullptr;
}
delete rightBarcodeMetadata;
return leftBarcodeMetadata;
@@ -446,7 +447,7 @@ CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(
}
}
e = BCExceptionChecksumInstance;
- return NULL;
+ return nullptr;
}
CBC_BarcodeValueArrayArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(
CBC_DetectionResult* detectionResult) {
@@ -466,16 +467,16 @@ CBC_BarcodeValueArrayArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(
CBC_DetectionResultColumn* detectionResultColumn =
(CBC_DetectionResultColumn*)detectionResult->getDetectionResultColumns()
.GetAt(i);
- if (detectionResultColumn == NULL) {
+ if (!detectionResultColumn)
continue;
- }
+
CFX_ArrayTemplate<CBC_Codeword*>* temp =
detectionResultColumn->getCodewords();
for (int32_t l = 0; l < temp->GetSize(); l++) {
CBC_Codeword* codeword = temp->GetAt(l);
- if (codeword == NULL || codeword->getRowNumber() == -1) {
+ if (!codeword || codeword->getRowNumber() == -1)
continue;
- }
+
barcodeMatrix->GetAt(codeword->getRowNumber())
->GetAt(i)
->setValue(codeword->getValue());
@@ -495,7 +496,7 @@ int32_t CBC_PDF417ScanningDecoder::getStartColumn(
int32_t imageRow,
FX_BOOL leftToRight) {
int32_t offset = leftToRight ? 1 : -1;
- CBC_Codeword* codeword = NULL;
+ CBC_Codeword* codeword = nullptr;
if (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
codeword = detectionResult->getDetectionResultColumn(barcodeColumn - offset)
->getCodeword(imageRow);
@@ -553,9 +554,9 @@ CBC_Codeword* CBC_PDF417ScanningDecoder::detectCodeword(
leftToRight, startColumn, imageRow);
CFX_Int32Array* moduleBitCount = getModuleBitCount(
image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
- if (moduleBitCount == NULL) {
- return NULL;
- }
+ if (!moduleBitCount)
+ return nullptr;
+
int32_t endColumn;
int32_t codewordBitCount = CBC_PDF417Common::getBitCountSum(*moduleBitCount);
if (leftToRight) {
@@ -575,7 +576,7 @@ CBC_Codeword* CBC_PDF417ScanningDecoder::detectCodeword(
int32_t codeword = CBC_PDF417Common::getCodeword(decodedValue);
delete moduleBitCount;
if (codeword == -1) {
- return NULL;
+ return nullptr;
}
return new CBC_Codeword(startColumn, endColumn,
getCodewordBucketNumber(decodedValue), codeword);
@@ -612,7 +613,7 @@ CFX_Int32Array* CBC_PDF417ScanningDecoder::getModuleBitCount(
return moduleBitCount;
}
delete moduleBitCount;
- return NULL;
+ return nullptr;
}
int32_t CBC_PDF417ScanningDecoder::getNumberOfECCodeWords(
int32_t barcodeECLevel) {
@@ -655,17 +656,17 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decodeCodewords(
int32_t& e) {
if (codewords.GetSize() == 0) {
e = BCExceptionFormatInstance;
- return NULL;
+ return nullptr;
}
int32_t numECCodewords = 1 << (ecLevel + 1);
correctErrors(codewords, erasures, numECCodewords, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
verifyCodewordCount(codewords, numECCodewords, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
CFX_ByteString bytestring;
CBC_CommonDecoderResult* decoderResult = CBC_DecodedBitStreamPaser::decode(
codewords, bytestring.FormatInteger(ecLevel), e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return decoderResult;
}
int32_t CBC_PDF417ScanningDecoder::correctErrors(CFX_Int32Array& codewords,
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
index 765c1d613c..43cf09e549 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
@@ -59,7 +59,7 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
encoder.setDimensions(30, 1, row, row);
}
encoder.generateBarcodeLogic(contents, m_iCorrectLevel, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
int32_t lineThickness = 2;
int32_t aspectRatio = 4;
CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix();