summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-02-24 15:26:50 -0800
committerLei Zhang <thestig@chromium.org>2016-02-24 15:26:50 -0800
commit38eaaf36b09b816b963015e33dc4eb02580e0462 (patch)
tree9a2721eb404a2de4ddce91b50cac25b2cac0edb1
parente1fb98394a6885cf03bdc6391e5a3878aad5b375 (diff)
downloadpdfium-38eaaf36b09b816b963015e33dc4eb02580e0462.tar.xz
Remove foo != NULL checks in xfa/src/fxbarcode.
R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1726373002 .
-rw-r--r--xfa/src/fxbarcode/BC_BinaryBitmap.cpp5
-rw-r--r--xfa/src/fxbarcode/BC_TwoDimWriter.cpp5
-rw-r--r--xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp6
-rw-r--r--xfa/src/fxbarcode/common/BC_CommonByteArray.cpp23
-rw-r--r--xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp5
-rw-r--r--xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp4
-rw-r--r--xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp8
-rw-r--r--xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp10
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp10
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp5
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp7
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp5
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp5
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp10
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDReader.cpp19
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDimReader.cpp5
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp9
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp4
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp5
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp5
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp14
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp5
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp8
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp5
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp23
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417.cpp2
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp3
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp12
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp6
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp4
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp15
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp18
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp4
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp18
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp5
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp22
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp15
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp10
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp5
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp3
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp6
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp5
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp2
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp6
44 files changed, 121 insertions, 250 deletions
diff --git a/xfa/src/fxbarcode/BC_BinaryBitmap.cpp b/xfa/src/fxbarcode/BC_BinaryBitmap.cpp
index a21e00e9fe..be6258ef1f 100644
--- a/xfa/src/fxbarcode/BC_BinaryBitmap.cpp
+++ b/xfa/src/fxbarcode/BC_BinaryBitmap.cpp
@@ -30,10 +30,7 @@
CBC_BinaryBitmap::CBC_BinaryBitmap(CBC_Binarizer* binarizer)
: m_binarizer(binarizer), m_matrix(NULL) {}
CBC_BinaryBitmap::~CBC_BinaryBitmap() {
- if (m_matrix != NULL) {
- delete m_matrix;
- }
- m_matrix = NULL;
+ delete m_matrix;
}
int32_t CBC_BinaryBitmap::GetHeight() {
return m_binarizer->GetLuminanceSource()->GetHeight();
diff --git a/xfa/src/fxbarcode/BC_TwoDimWriter.cpp b/xfa/src/fxbarcode/BC_TwoDimWriter.cpp
index 3d36135482..a5483026eb 100644
--- a/xfa/src/fxbarcode/BC_TwoDimWriter.cpp
+++ b/xfa/src/fxbarcode/BC_TwoDimWriter.cpp
@@ -17,10 +17,7 @@ CBC_TwoDimWriter::CBC_TwoDimWriter() {
m_output = NULL;
}
CBC_TwoDimWriter::~CBC_TwoDimWriter() {
- if (m_output != NULL) {
- delete m_output;
- m_output = NULL;
- }
+ delete m_output;
}
void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
diff --git a/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp b/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp
index e346967a27..3a8fa15e2b 100644
--- a/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp
+++ b/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp
@@ -47,11 +47,7 @@ void CBC_CommonBitMatrix::Init(int32_t width, int32_t height) {
FXSYS_memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
}
CBC_CommonBitMatrix::~CBC_CommonBitMatrix() {
- if (m_bits != NULL) {
- FX_Free(m_bits);
- }
- m_bits = NULL;
- m_height = m_width = m_rowSize = 0;
+ FX_Free(m_bits);
}
FX_BOOL CBC_CommonBitMatrix::Get(int32_t x, int32_t y) {
int32_t offset = y * m_rowSize + (x >> 5);
diff --git a/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp b/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp
index e085ffcec2..1a6ef9f63f 100644
--- a/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp
+++ b/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp
@@ -42,12 +42,7 @@ CBC_CommonByteArray::CBC_CommonByteArray(uint8_t* byteArray, int32_t size) {
m_index = size;
}
CBC_CommonByteArray::~CBC_CommonByteArray() {
- if (m_bytes != NULL) {
- FX_Free(m_bytes);
- m_bytes = NULL;
- }
- m_index = 0;
- m_size = 0;
+ FX_Free(m_bytes);
}
int32_t CBC_CommonByteArray::At(int32_t index) {
return m_bytes[index] & 0xff;
@@ -72,19 +67,19 @@ void CBC_CommonByteArray::AppendByte(int32_t value) {
void CBC_CommonByteArray::Reserve(int32_t capacity) {
if (m_bytes == NULL || m_size < capacity) {
uint8_t* newArray = FX_Alloc(uint8_t, capacity);
- FXSYS_memset(newArray, 0, capacity);
- if (m_bytes != NULL) {
+ if (m_bytes) {
FXSYS_memcpy(newArray, m_bytes, m_size);
- FX_Free(m_bytes);
+ FXSYS_memset(newArray + m_size, 0, capacity - m_size);
+ } else {
+ FXSYS_memset(newArray, 0, capacity);
}
+ FX_Free(m_bytes);
m_bytes = newArray;
m_size = capacity;
}
}
void CBC_CommonByteArray::Set(uint8_t* source, int32_t offset, int32_t count) {
- if (m_bytes != NULL) {
- FX_Free(m_bytes);
- }
+ FX_Free(m_bytes);
m_bytes = FX_Alloc(uint8_t, count);
m_size = count;
FXSYS_memcpy(m_bytes, source + offset, count);
@@ -93,9 +88,7 @@ void CBC_CommonByteArray::Set(uint8_t* source, int32_t offset, int32_t count) {
void CBC_CommonByteArray::Set(CFX_ByteArray* source,
int32_t offset,
int32_t count) {
- if (m_bytes != NULL) {
- FX_Free(m_bytes);
- }
+ FX_Free(m_bytes);
m_bytes = FX_Alloc(uint8_t, count);
m_size = count;
int32_t i;
diff --git a/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp b/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp
index 656071fa31..69c39a766c 100644
--- a/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp
+++ b/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp
@@ -33,10 +33,7 @@ void CBC_CommonByteMatrix::Init() {
FXSYS_memset(m_bytes, 0xff, m_height * m_width);
}
CBC_CommonByteMatrix::~CBC_CommonByteMatrix() {
- if (m_bytes != NULL) {
- FX_Free(m_bytes);
- m_bytes = NULL;
- }
+ FX_Free(m_bytes);
}
int32_t CBC_CommonByteMatrix::GetHeight() {
return m_height;
diff --git a/xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp b/xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp
index 5342cfcca7..a4ad0c4e65 100644
--- a/xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp
+++ b/xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp
@@ -61,9 +61,7 @@ void CBC_CommonDecoderResult::setOther(CBC_PDF417ResultMetadata* other) {
m_other = other;
}
CBC_CommonDecoderResult::~CBC_CommonDecoderResult() {
- if (m_other != NULL) {
- delete m_other;
- }
+ delete m_other;
}
const CFX_ByteArray& CBC_CommonDecoderResult::GetRawBytes() {
return m_rawBytes;
diff --git a/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp b/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp
index 05d079c9c4..ed5899da37 100644
--- a/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp
+++ b/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp
@@ -129,7 +129,7 @@ CFX_PtrArray* CBC_WhiteRectangleDetector::Detect(int32_t& e) {
z = CBC_AutoPtr<CBC_ResultPoint>(
GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(down - i),
(FX_FLOAT)(left + i), (FX_FLOAT)(down)));
- if (z.get() != NULL) {
+ if (z.get()) {
break;
}
}
@@ -142,7 +142,7 @@ CFX_PtrArray* CBC_WhiteRectangleDetector::Detect(int32_t& e) {
t = CBC_AutoPtr<CBC_ResultPoint>(
GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(up + j),
(FX_FLOAT)(left + j), (FX_FLOAT)up));
- if (t.get() != NULL) {
+ if (t.get()) {
break;
}
}
@@ -155,7 +155,7 @@ CFX_PtrArray* CBC_WhiteRectangleDetector::Detect(int32_t& e) {
x = CBC_AutoPtr<CBC_ResultPoint>(
GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(up + k),
(FX_FLOAT)(right - k), (FX_FLOAT)up));
- if (x.get() != NULL) {
+ if (x.get()) {
break;
}
}
@@ -168,7 +168,7 @@ CFX_PtrArray* CBC_WhiteRectangleDetector::Detect(int32_t& e) {
y = CBC_AutoPtr<CBC_ResultPoint>(
GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(down - m),
(FX_FLOAT)(right - m), (FX_FLOAT)down));
- if (y.get() != NULL) {
+ if (y.get()) {
break;
}
}
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
index 993b9c526a..e5002ce6ee 100644
--- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -60,14 +60,8 @@ void CBC_ReedSolomonGF256::Init() {
m_one = new CBC_ReedSolomonGF256Poly(this, 1);
}
CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() {
- if (m_zero != NULL) {
- delete m_zero;
- m_zero = NULL;
- }
- if (m_one != NULL) {
- delete m_one;
- m_one = NULL;
- }
+ delete m_zero;
+ delete m_one;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() {
return m_zero;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp
index 4ba3a5c44b..be13c8580f 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp
@@ -46,14 +46,8 @@ void CBC_DataMatrixBitMatrixParser::Init(CBC_CommonBitMatrix* bitMatrix,
m_mappingBitMatrix->GetHeight());
}
CBC_DataMatrixBitMatrixParser::~CBC_DataMatrixBitMatrixParser() {
- if (m_mappingBitMatrix != NULL) {
- delete m_mappingBitMatrix;
- }
- m_mappingBitMatrix = NULL;
- if (m_readMappingMatrix != NULL) {
- delete m_readMappingMatrix;
- }
- m_readMappingMatrix = NULL;
+ delete m_mappingBitMatrix;
+ delete m_readMappingMatrix;
}
CBC_DataMatrixVersion* CBC_DataMatrixBitMatrixParser::GetVersion() {
return m_version;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp
index 45e9abda1f..49a1d1654a 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp
@@ -37,10 +37,7 @@ void CBC_DataMatrixDecoder::Init() {
new CBC_ReedSolomonDecoder(CBC_ReedSolomonGF256::DataMatrixField);
}
CBC_DataMatrixDecoder::~CBC_DataMatrixDecoder() {
- if (m_rsDecoder != NULL) {
- delete m_rsDecoder;
- }
- m_rsDecoder = NULL;
+ delete m_rsDecoder;
}
CBC_CommonDecoderResult* CBC_DataMatrixDecoder::Decode(
CBC_CommonBitMatrix* bits,
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp
index d1b36b9949..b89ef7066b 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp
@@ -40,10 +40,7 @@ void CBC_DataMatrixDetector::Init(int32_t& e) {
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
CBC_DataMatrixDetector::~CBC_DataMatrixDetector() {
- if (m_rectangleDetector != NULL) {
- delete m_rectangleDetector;
- }
- m_rectangleDetector = NULL;
+ delete m_rectangleDetector;
}
inline FX_BOOL ResultPointsAndTransitionsComparator(void* a, void* b) {
return ((CBC_ResultPointsAndTransitions*)b)->GetTransitions() >
@@ -82,7 +79,7 @@ CBC_QRDetectorResult* CBC_DataMatrixDetector::Detect(int32_t& e) {
CBC_ResultPoint* bottomLeft = NULL;
CBC_ResultPoint* maybeBottomRight = NULL;
FX_POSITION itBegin = pointCount.GetStartPosition();
- while (itBegin != NULL) {
+ while (itBegin) {
CBC_ResultPoint* key = 0;
int32_t value = 0;
pointCount.GetNextAssoc(itBegin, key, value);
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp
index 1b2f82d489..2586751107 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp
@@ -37,10 +37,7 @@ void CBC_DataMatrixReader::Init() {
m_decoder->Init();
}
CBC_DataMatrixReader::~CBC_DataMatrixReader() {
- if (m_decoder != NULL) {
- delete m_decoder;
- }
- m_decoder = NULL;
+ delete m_decoder;
}
CFX_ByteString CBC_DataMatrixReader::Decode(CBC_BinaryBitmap* image,
int32_t hints,
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp
index 28262ca1f0..4fb3a3fad6 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp
@@ -59,10 +59,7 @@ CBC_DataMatrixVersion::CBC_DataMatrixVersion(int32_t versionNumber,
m_totalCodewords = total;
}
CBC_DataMatrixVersion::~CBC_DataMatrixVersion() {
- if (m_ecBlocks != NULL) {
- delete m_ecBlocks;
- }
- m_ecBlocks = NULL;
+ delete m_ecBlocks;
}
int32_t CBC_DataMatrixVersion::GetVersionNumber() {
return m_versionNumber;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp
index 7c9d5a9688..7909054533 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp
@@ -150,15 +150,13 @@ CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
if (shape == FORCE_RECTANGLE && !symbol->m_rectangular) {
continue;
}
- if (minSize != NULL &&
- (symbol->getSymbolWidth(e) < minSize->getWidth() ||
- symbol->getSymbolHeight(e) < minSize->getHeight())) {
+ if (minSize && (symbol->getSymbolWidth(e) < minSize->getWidth() ||
+ symbol->getSymbolHeight(e) < minSize->getHeight())) {
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
continue;
}
- if (maxSize != NULL &&
- (symbol->getSymbolWidth(e) > maxSize->getWidth() ||
- symbol->getSymbolHeight(e) > maxSize->getHeight())) {
+ if (maxSize && (symbol->getSymbolWidth(e) > maxSize->getWidth() ||
+ symbol->getSymbolHeight(e) > maxSize->getHeight())) {
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
continue;
}
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
index 0b699c9624..7cb8ba51fa 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
@@ -21,6 +21,7 @@
*/
#include <algorithm>
+#include <memory>
#include "xfa/src/fxbarcode/BC_BinaryBitmap.h"
#include "xfa/src/fxbarcode/BC_Reader.h"
@@ -49,7 +50,6 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap* image,
int32_t hints,
int32_t& e) {
int32_t height = image->GetHeight();
- CBC_CommonBitArray* row = NULL;
int32_t middle = height >> 1;
FX_BOOL tryHarder = FALSE;
int32_t rowStep = std::max(1, height >> (tryHarder ? 8 : 5));
@@ -68,34 +68,23 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap* image,
if (rowNumber < 0 || rowNumber >= height) {
break;
}
- row = image->GetBlackRow(rowNumber, NULL, e);
+ std::unique_ptr<CBC_CommonBitArray> row(
+ image->GetBlackRow(rowNumber, nullptr, e));
if (e != BCExceptionNO) {
e = BCExceptionNO;
- if (row != NULL) {
- delete row;
- row = NULL;
- }
continue;
}
for (int32_t attempt = 0; attempt < 2; attempt++) {
if (attempt == 1) {
row->Reverse();
}
- CFX_ByteString result = DecodeRow(rowNumber, row, hints, e);
+ CFX_ByteString result = DecodeRow(rowNumber, row.get(), hints, e);
if (e != BCExceptionNO) {
e = BCExceptionNO;
continue;
}
- if (row != NULL) {
- delete row;
- row = NULL;
- }
return result;
}
- if (row != NULL) {
- delete row;
- row = NULL;
- }
}
e = BCExceptionNotFound;
return "";
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp
index 075e69f219..74f0db4068 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp
@@ -52,10 +52,7 @@ CFX_Int32Array* CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray* row,
startEndPattern[2] = START_END_PATTERN[2];
int32_t nextStart = 0;
while (!foundStart) {
- if (startRange != NULL) {
- delete startRange;
- startRange = NULL;
- }
+ delete startRange;
startRange = FindGuardPattern(row, nextStart, FALSE, &startEndPattern, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
int32_t start = (*startRange)[0];
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
index ed93e9852b..121b72cb05 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -43,10 +43,7 @@ CBC_OneDimWriter::CBC_OneDimWriter() {
m_output = NULL;
}
CBC_OneDimWriter::~CBC_OneDimWriter() {
- if (m_output != NULL) {
- delete m_output;
- m_output = NULL;
- }
+ delete m_output;
}
void CBC_OneDimWriter::SetPrintChecksum(FX_BOOL checksum) {
m_bPrintChecksum = checksum;
@@ -196,7 +193,7 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
device->FillRect(&re, m_backgroundColor);
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX,
(FX_FLOAT)(locY + iFontSize));
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix.Concat(*matrix);
}
device->DrawNormalText(str.GetLength(), pCharPos, m_pFont,
@@ -284,7 +281,7 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
geWidth = (FX_FLOAT)barWidth;
break;
}
- if (device != NULL) {
+ if (device) {
ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (FX_FLOAT)locX,
(FX_FLOAT)locY, barWidth);
} else {
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
index 8d9671089b..582f93bc15 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
@@ -190,7 +190,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber,
codeSet = CODE_CODE_C;
break;
default:
- if (startPatternInfo != NULL) {
+ if (startPatternInfo) {
startPatternInfo->RemoveAll();
delete startPatternInfo;
startPatternInfo = NULL;
@@ -203,7 +203,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber,
CFX_ByteString result;
int32_t lastStart = (*startPatternInfo)[0];
int32_t nextStart = (*startPatternInfo)[1];
- if (startPatternInfo != NULL) {
+ if (startPatternInfo) {
startPatternInfo->RemoveAll();
delete startPatternInfo;
startPatternInfo = NULL;
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp
index 73999a4818..5f0ad98d65 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp
@@ -58,10 +58,7 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(int32_t rowNumber,
CFX_Int32Array* start = FindAsteriskPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
int32_t nextStart = (*start)[1];
- if (start != NULL) {
- delete start;
- start = NULL;
- }
+ delete start;
int32_t end = row->GetSize();
while (nextStart < end && !row->Get(nextStart)) {
nextStart++;
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp
index fe05069d4f..1cb08cd9b8 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp
@@ -81,10 +81,7 @@ int32_t CBC_OnedEAN13Reader::DecodeMiddle(CBC_CommonBitArray* row,
FindGuardPattern(row, rowOffset, TRUE, &result, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
rowOffset = (*middleRange)[1];
- if (middleRange != NULL) {
- delete middleRange;
- middleRange = NULL;
- }
+ delete middleRange;
for (int32_t Y = 0; Y < 6 && rowOffset < end; Y++) {
int32_t bestMatch =
DecodeDigit(row, &counters, rowOffset,
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 9b8456d6ed..de71b2074a 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -171,7 +171,7 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
CFX_FxgeDevice geBitmap;
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
geBitmap.Attach(pOutBitmap);
}
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
@@ -216,7 +216,7 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
blank);
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
CFX_FxgeDevice ge;
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
ge.Create(strWidth, iTextHeight, FXDIB_Argb);
FX_RECT rect(0, 0, strWidth, iTextHeight);
ge.FillRect(&rect, m_backgroundColor);
@@ -229,7 +229,7 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(FX_FLOAT)leftPosition * m_outputHScale,
(FX_FLOAT)(m_Height - iTextHeight) + iFontSize);
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
@@ -242,7 +242,7 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
charsWidth = 0.0f;
CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (FX_FLOAT)strWidth, iFontSize,
blank);
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
FX_RECT rect1(0, 0, strWidth, iTextHeight);
ge.FillRect(&rect1, m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos + 7, m_pFont,
@@ -256,7 +256,7 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
1.0, 0.0, 0.0, -1.0,
(FX_FLOAT)(leftPosition + 47 * multiple) * m_outputHScale,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(iLen, pCharPos + 7, m_pFont,
@@ -272,7 +272,7 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
}
CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize,
blank);
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb);
ge.GetBitmap()->Clear(m_backgroundColor);
@@ -284,7 +284,7 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
} else {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(iLen, pCharPos, m_pFont,
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp
index 503454f71f..8d13d26347 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp
@@ -67,10 +67,7 @@ int32_t CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray* row,
e = BCExceptionNotFound;
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
}
- if (middleRange != NULL) {
- delete middleRange;
- middleRange = NULL;
- }
+ delete middleRange;
for (int32_t y = 0; y < 4 && rowOffset < end; y++) {
int32_t bestMatch =
DecodeDigit(row, &counters, rowOffset,
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index f552531e63..61fe75aae3 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -179,7 +179,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
int32_t strWidth = 7 * multiple * 4;
FX_FLOAT blank = 0.0;
CFX_FxgeDevice geBitmap;
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
geBitmap.Attach(pOutBitmap);
}
FX_FLOAT charsWidth = 0;
@@ -212,7 +212,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
blank);
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
CFX_FxgeDevice ge;
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb);
ge.GetBitmap()->Clear(m_backgroundColor);
@@ -236,7 +236,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
charsWidth = 0.0f;
CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize,
blank);
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb);
ge.GetBitmap()->Clear(m_backgroundColor);
@@ -251,7 +251,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
1.0, 0.0, 0.0, -1.0,
(FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(iLen, pCharPos + 4, m_pFont,
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp
index 14040632a7..416b08ae9a 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp
@@ -35,10 +35,7 @@ void CBC_OnedUPCAReader::Init() {
m_ean13Reader = new CBC_OnedEAN13Reader;
}
CBC_OnedUPCAReader::~CBC_OnedUPCAReader() {
- if (m_ean13Reader != NULL) {
- delete m_ean13Reader;
- }
- m_ean13Reader = NULL;
+ delete m_ean13Reader;
}
CFX_ByteString CBC_OnedUPCAReader::DecodeRow(int32_t rowNumber,
CBC_CommonBitArray* row,
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 08a849f362..55c50318a5 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -34,10 +34,7 @@ void CBC_OnedUPCAWriter::Init() {
m_subWriter = new CBC_OnedEAN13Writer;
}
CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {
- if (m_subWriter != NULL) {
- delete m_subWriter;
- }
- m_subWriter = NULL;
+ delete m_subWriter;
}
FX_BOOL CBC_OnedUPCAWriter::CheckContentValidity(
const CFX_WideStringC& contents) {
@@ -130,7 +127,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
FX_FLOAT strWidth = (FX_FLOAT)35 * multiple;
FX_FLOAT blank = 0.0;
CFX_FxgeDevice geBitmap;
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
geBitmap.Attach(pOutBitmap);
}
FX_FLOAT charsWidth = 0;
@@ -181,7 +178,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank);
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
CFX_FxgeDevice ge;
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
@@ -193,7 +190,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(FX_FLOAT)leftPosition * m_outputHScale,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
@@ -205,7 +202,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
iLen = tempStr.GetLength();
charsWidth = 0.0f;
CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
FX_RECT rect2(0, 0, (int)strWidth, iTextHeight);
ge.FillRect(&rect2, m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos + 6, m_pFont,
@@ -219,7 +216,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
1.0, 0.0, 0.0, -1.0,
(FX_FLOAT)(leftPosition + 40 * multiple) * m_outputHScale,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(iLen, pCharPos + 6, m_pFont,
@@ -234,7 +231,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
strWidth = strWidth * m_outputHScale;
}
CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
delete ge.GetBitmap();
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb);
ge.GetBitmap()->Clear(m_backgroundColor);
@@ -246,7 +243,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
} else {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(iLen, pCharPos, m_pFont,
@@ -257,7 +254,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
tempStr = str.Mid(11, 1);
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap != NULL) {
+ if (pOutBitmap) {
delete ge.GetBitmap();
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb);
ge.GetBitmap()->Clear(m_backgroundColor);
@@ -272,7 +269,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
1.0, 0.0, 0.0, -1.0,
(FX_FLOAT)(leftPosition + 85 * multiple) * m_outputHScale,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix != NULL) {
+ if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(iLen, pCharPos + 11, m_pFont,
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp
index c8b7c4cffa..c06f8112da 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp
@@ -553,7 +553,7 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(
}
FX_FLOAT newRatio =
((17 * cols + 69) * DEFAULT_MODULE_WIDTH) / (rows * HEIGHT);
- if (dimension != NULL &&
+ if (dimension &&
fabsf(newRatio - PREFERRED_RATIO) > fabsf(ratio - PREFERRED_RATIO)) {
continue;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
index df1ab78ba5..6deef4c969 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
@@ -33,8 +33,7 @@ CBC_BoundingBox::CBC_BoundingBox(CBC_CommonBitMatrix* image,
int32_t& e) {
if ((topLeft == NULL && topRight == NULL) ||
(bottomLeft == NULL && bottomRight == NULL) ||
- (topLeft != NULL && bottomLeft == NULL) ||
- (topRight != NULL && bottomRight == NULL)) {
+ (topLeft && bottomLeft == NULL) || (topRight && bottomRight == NULL)) {
e = BCExceptionNotFoundInstance;
}
init(image, topLeft, bottomLeft, topRight, bottomRight);
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
index f48faa3bb7..b9eee7c446 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
@@ -110,7 +110,7 @@ CFX_ByteString CBC_DetectionResult::toString() {
}
void CBC_DetectionResult::adjustIndicatorColumnRowNumbers(
CBC_DetectionResultColumn* detectionResultColumn) {
- if (detectionResultColumn != NULL) {
+ if (detectionResultColumn) {
((CBC_DetectionResultRowIndicatorColumn*)detectionResultColumn)
->adjustCompleteIndicatorColumnRowNumbers(*m_barcodeMetadata);
}
@@ -156,8 +156,8 @@ int32_t CBC_DetectionResult::adjustRowNumbersFromBothRI() {
->getCodewords();
for (int32_t codewordsRow = 0; codewordsRow < LRIcodewords->GetSize();
codewordsRow++) {
- if (LRIcodewords->GetAt(codewordsRow) != NULL &&
- RRIcodewords->GetAt(codewordsRow) != NULL &&
+ if (LRIcodewords->GetAt(codewordsRow) &&
+ RRIcodewords->GetAt(codewordsRow) &&
((CBC_Codeword*)LRIcodewords->GetAt(codewordsRow))->getRowNumber() ==
((CBC_Codeword*)RRIcodewords->GetAt(codewordsRow))
->getRowNumber()) {
@@ -208,7 +208,7 @@ int32_t CBC_DetectionResult::adjustRowNumbersFromRRI() {
m_detectionResultColumns.GetAt(barcodeColumn))
->getCodewords()
->GetAt(codewordsRow);
- if (codeword != NULL) {
+ if (codeword) {
invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber,
invalidRowCounts, codeword);
if (!codeword->hasValidRowNumber()) {
@@ -243,7 +243,7 @@ int32_t CBC_DetectionResult::adjustRowNumbersFromLRI() {
m_detectionResultColumns[barcodeColumn])
->getCodewords()
->GetAt(codewordsRow);
- if (codeword != NULL) {
+ if (codeword) {
invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber,
invalidRowCounts, codeword);
if (!codeword->hasValidRowNumber()) {
@@ -280,7 +280,7 @@ void CBC_DetectionResult::adjustRowNumbers(int32_t barcodeColumn,
barcodeColumn - 1))
->getCodewords();
CFX_PtrArray* nextColumnCodewords = previousColumnCodewords;
- if (m_detectionResultColumns[barcodeColumn + 1] != NULL) {
+ if (m_detectionResultColumns[barcodeColumn + 1]) {
nextColumnCodewords = ((CBC_DetectionResultColumn*)
m_detectionResultColumns[barcodeColumn + 1])
->getCodewords();
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
index 9c492ba010..e375b7c30f 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
@@ -41,21 +41,21 @@ CBC_DetectionResultColumn::~CBC_DetectionResultColumn() {
}
CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow) {
CBC_Codeword* codeword = getCodeword(imageRow);
- if (codeword != NULL) {
+ if (codeword) {
return codeword;
}
for (int32_t i = 1; i < MAX_NEARBY_DISTANCE; i++) {
int32_t nearImageRow = imageRowToCodewordIndex(imageRow) - i;
if (nearImageRow >= 0) {
codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow);
- if (codeword != NULL) {
+ if (codeword) {
return codeword;
}
}
nearImageRow = imageRowToCodewordIndex(imageRow) + i;
if (nearImageRow < m_codewords->GetSize()) {
codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow);
- if (codeword != NULL) {
+ if (codeword) {
return codeword;
}
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
index a5d61b9210..403c34c5fd 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
@@ -42,7 +42,7 @@ CBC_DetectionResultRowIndicatorColumn::
void CBC_DetectionResultRowIndicatorColumn::setRowNumbers() {
for (int32_t i = 0; i < m_codewords->GetSize(); i++) {
CBC_Codeword* codeword = (CBC_Codeword*)m_codewords->GetAt(i);
- if (codeword != NULL) {
+ if (codeword) {
codeword->setRowNumberAsRowIndicatorColumn();
}
}
@@ -119,7 +119,7 @@ CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(
result->SetSize(barcodeMetadata->getRowCount());
for (int32_t i = 0; i < getCodewords()->GetSize(); i++) {
CBC_Codeword* codeword = (CBC_Codeword*)getCodewords()->GetAt(i);
- if (codeword != NULL) {
+ if (codeword) {
result->SetAt(codeword->getRowNumber(),
result->GetAt(codeword->getRowNumber()) + 1);
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp
index 273f4906d1..54556af97c 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp
@@ -124,10 +124,10 @@ CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple,
for (int32_t i = 0; i < barcodeCoordinates->GetSize(); i++) {
CFX_PtrArray* barcodeCoordinate =
(CFX_PtrArray*)barcodeCoordinates->GetAt(i);
- if (barcodeCoordinate->GetAt(1) != NULL) {
+ if (barcodeCoordinate->GetAt(1)) {
row = row > ((CBC_ResultPoint*)barcodeCoordinate->GetAt(1))->GetY();
}
- if (barcodeCoordinate->GetAt(3) != NULL) {
+ if (barcodeCoordinate->GetAt(3)) {
row = row > ((CBC_ResultPoint*)barcodeCoordinate->GetAt(3))->GetY();
}
}
@@ -142,7 +142,7 @@ CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple,
if (!multiple) {
break;
}
- if (vertices->GetAt(2) != NULL) {
+ if (vertices->GetAt(2)) {
column = (int32_t)((CBC_ResultPoint*)vertices->GetAt(2))->GetX();
row = (int32_t)((CBC_ResultPoint*)vertices->GetAt(2))->GetY();
} else {
@@ -167,7 +167,7 @@ CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix,
sizeof(INDEXES_START_PATTERN) / sizeof(INDEXES_START_PATTERN[0]));
startptr->RemoveAll();
delete startptr;
- if (result->GetAt(4) != NULL) {
+ if (result->GetAt(4)) {
startColumn = (int32_t)((CBC_ResultPoint*)result->GetAt(4))->GetX();
startRow = (int32_t)((CBC_ResultPoint*)result->GetAt(4))->GetY();
}
@@ -204,12 +204,12 @@ CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix,
CFX_Int32Array* loc =
findGuardPattern(matrix, startColumn, startRow, width, FALSE, pattern,
patternLength, counters);
- if (loc != NULL) {
+ if (loc) {
while (startRow > 0) {
CFX_Int32Array* previousRowLoc =
findGuardPattern(matrix, startColumn, --startRow, width, FALSE,
pattern, patternLength, counters);
- if (previousRowLoc != NULL) {
+ if (previousRowLoc) {
delete loc;
loc = previousRowLoc;
} else {
@@ -236,8 +236,7 @@ CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix,
CFX_Int32Array* loc =
findGuardPattern(matrix, previousRowLoc[0], stopRow, width, FALSE,
pattern, patternLength, counters);
- if (loc != NULL &&
- abs(previousRowLoc[0] - loc->GetAt(0)) < MAX_PATTERN_DRIFT &&
+ if (loc && abs(previousRowLoc[0] - loc->GetAt(0)) < MAX_PATTERN_DRIFT &&
abs(previousRowLoc[1] - loc->GetAt(1)) < MAX_PATTERN_DRIFT) {
previousRowLoc.Copy(*loc);
skippedRowCount = 0;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
index 8090c79975..820b15e91d 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
@@ -70,12 +70,12 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn = NULL;
CBC_DetectionResult* detectionResult = NULL;
for (int32_t i = 0; i < 2; i++) {
- if (imageTopLeft != NULL) {
+ if (imageTopLeft) {
leftRowIndicatorColumn =
getRowIndicatorColumn(image, boundingBox, *imageTopLeft, TRUE,
minCodewordWidth, maxCodewordWidth);
}
- if (imageTopRight != NULL) {
+ if (imageTopRight) {
rightRowIndicatorColumn =
getRowIndicatorColumn(image, boundingBox, *imageTopRight, FALSE,
minCodewordWidth, maxCodewordWidth);
@@ -108,7 +108,7 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
barcodeColumnCount++) {
int32_t barcodeColumn = leftToRight ? barcodeColumnCount
: maxBarcodeColumn - barcodeColumnCount;
- if (detectionResult->getDetectionResultColumn(barcodeColumn) != NULL) {
+ if (detectionResult->getDetectionResultColumn(barcodeColumn)) {
continue;
}
CBC_DetectionResultColumn* detectionResultColumn = NULL;
@@ -135,7 +135,7 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(
CBC_Codeword* codeword = detectCodeword(
image, boundingBox->getMinX(), boundingBox->getMaxX(), leftToRight,
startColumn, imageRow, minCodewordWidth, maxCodewordWidth);
- if (codeword != NULL) {
+ if (codeword) {
detectionResultColumn->setCodeword(imageRow, codeword);
previousStartColumn = startColumn;
minCodewordWidth = minCodewordWidth < codeword->getWidth()
@@ -310,7 +310,7 @@ CBC_PDF417ScanningDecoder::getRowIndicatorColumn(CBC_CommonBitMatrix* image,
CBC_Codeword* codeword =
detectCodeword(image, 0, image->GetWidth(), leftToRight, startColumn,
imageRow, minCodewordWidth, maxCodewordWidth);
- if (codeword != NULL) {
+ if (codeword) {
rowIndicatorColumn->setCodeword(imageRow, codeword);
if (leftToRight) {
startColumn = codeword->getStartX();
@@ -515,19 +515,19 @@ int32_t CBC_PDF417ScanningDecoder::getStartColumn(
codeword = detectionResult->getDetectionResultColumn(barcodeColumn - offset)
->getCodeword(imageRow);
}
- if (codeword != NULL) {
+ if (codeword) {
return leftToRight ? codeword->getEndX() : codeword->getStartX();
}
codeword = detectionResult->getDetectionResultColumn(barcodeColumn)
->getCodewordNearby(imageRow);
- if (codeword != NULL) {
+ if (codeword) {
return leftToRight ? codeword->getStartX() : codeword->getEndX();
}
if (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
codeword = detectionResult->getDetectionResultColumn(barcodeColumn - offset)
->getCodewordNearby(imageRow);
}
- if (codeword != NULL) {
+ if (codeword) {
return leftToRight ? codeword->getEndX() : codeword->getStartX();
}
int32_t skippedColumns = 0;
@@ -543,7 +543,7 @@ int32_t CBC_PDF417ScanningDecoder::getStartColumn(
barcodeColumn)
->getCodewords()
->GetAt(i);
- if (previousRowCodeword != NULL) {
+ if (previousRowCodeword) {
return (leftToRight ? previousRowCodeword->getEndX()
: previousRowCodeword->getStartX()) +
offset * skippedColumns * (previousRowCodeword->getEndX() -
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp
index 19d3f2b411..2d1aa433a0 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp
@@ -73,7 +73,7 @@ CBC_QRAlignmentPattern* CBC_QRAlignmentPatternFinder::Find(int32_t& e) {
if (FoundPatternCross(stateCount)) {
CBC_QRAlignmentPattern* confirmed =
HandlePossibleCenter(stateCount, i, j);
- if (confirmed != NULL) {
+ if (confirmed) {
return confirmed;
}
}
@@ -96,7 +96,7 @@ CBC_QRAlignmentPattern* CBC_QRAlignmentPatternFinder::Find(int32_t& e) {
if (FoundPatternCross(stateCount)) {
CBC_QRAlignmentPattern* confirmed =
HandlePossibleCenter(stateCount, i, maxJ);
- if (confirmed != NULL) {
+ if (confirmed) {
return confirmed;
}
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp
index d4d0cb6148..d44995385a 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp
@@ -41,15 +41,11 @@ void CBC_QRBitMatrixParser::Init(CBC_CommonBitMatrix* bitMatrix, int32_t& e) {
m_version = NULL;
}
CBC_QRBitMatrixParser::~CBC_QRBitMatrixParser() {
- if (m_parsedFormatInfo != NULL) {
- delete m_parsedFormatInfo;
- m_parsedFormatInfo = NULL;
- }
- m_version = NULL;
+ delete m_parsedFormatInfo;
}
CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(
int32_t& e) {
- if (m_parsedFormatInfo != NULL) {
+ if (m_parsedFormatInfo) {
return m_parsedFormatInfo;
}
int32_t formatInfoBits = 0;
@@ -65,7 +61,7 @@ CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(
}
m_parsedFormatInfo =
CBC_QRCoderFormatInformation::DecodeFormatInformation(formatInfoBits);
- if (m_parsedFormatInfo != NULL) {
+ if (m_parsedFormatInfo) {
return m_parsedFormatInfo;
}
int32_t dimension = m_bitMatrix->GetDimension(e);
@@ -80,7 +76,7 @@ CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(
}
m_parsedFormatInfo =
CBC_QRCoderFormatInformation::DecodeFormatInformation(formatInfoBits);
- if (m_parsedFormatInfo != NULL) {
+ if (m_parsedFormatInfo) {
return m_parsedFormatInfo;
}
e = BCExceptionRead;
@@ -88,7 +84,7 @@ CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(
return NULL;
}
CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(int32_t& e) {
- if (m_version != NULL) {
+ if (m_version) {
return m_version;
}
int32_t dimension = m_bitMatrix->GetDimension(e);
@@ -109,7 +105,7 @@ CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(int32_t& e) {
}
m_version = CBC_QRCoderVersion::DecodeVersionInformation(versionBits, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- if (m_version != NULL && m_version->GetDimensionForVersion() == dimension) {
+ if (m_version && m_version->GetDimensionForVersion() == dimension) {
return m_version;
}
versionBits = 0;
@@ -121,7 +117,7 @@ CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(int32_t& e) {
}
m_version = CBC_QRCoderVersion::DecodeVersionInformation(versionBits, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- if (m_version != NULL && m_version->GetDimensionForVersion() == dimension) {
+ if (m_version && m_version->GetDimensionForVersion() == dimension) {
return m_version;
}
e = BCExceptionRead;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp
index 9eaffa119d..c594230428 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp
@@ -46,10 +46,7 @@ void CBC_QRCodeReader::Init() {
m_decoder->Init();
}
CBC_QRCodeReader::~CBC_QRCodeReader() {
- if (m_decoder != NULL) {
- delete m_decoder;
- }
- m_decoder = NULL;
+ delete m_decoder;
}
CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap* image,
int32_t hints,
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp
index ab370f8842..be46f2dec5 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp
@@ -39,19 +39,7 @@ CBC_QRCoder::CBC_QRCoder() {
m_matrix = NULL;
}
CBC_QRCoder::~CBC_QRCoder() {
- if (m_matrix != NULL) {
- delete m_matrix;
- m_matrix = NULL;
- }
- m_mode = NULL;
- m_ecLevel = NULL;
- m_version = -1;
- m_matrixWidth = -1;
- m_maskPattern = -1;
- m_numTotalBytes = -1;
- m_numDataBytes = -1;
- m_numECBytes = -1;
- m_numRSBlocks = -1;
+ delete m_matrix;
}
CBC_QRCoderMode* CBC_QRCoder::GetMode() {
return m_mode;
@@ -92,11 +80,11 @@ int32_t CBC_QRCoder::At(int32_t x, int32_t y, int32_t& e) {
return value;
}
FX_BOOL CBC_QRCoder::IsValid() {
- return m_mode != NULL && m_ecLevel != NULL && m_version != -1 &&
- m_matrixWidth != -1 && m_maskPattern != -1 && m_numTotalBytes != -1 &&
- m_numDataBytes != -1 && m_numECBytes != -1 && m_numRSBlocks != -1 &&
+ return m_mode && m_ecLevel && m_version != -1 && m_matrixWidth != -1 &&
+ m_maskPattern != -1 && m_numTotalBytes != -1 && m_numDataBytes != -1 &&
+ m_numECBytes != -1 && m_numRSBlocks != -1 &&
IsValidMaskPattern(m_maskPattern) &&
- m_numTotalBytes == m_numDataBytes + m_numECBytes && m_matrix != NULL &&
+ m_numTotalBytes == m_numDataBytes + m_numECBytes && m_matrix &&
m_matrixWidth == m_matrix->GetWidth() &&
m_matrix->GetWidth() == m_matrix->GetHeight();
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
index 28f30cab09..ad1b3200ab 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
@@ -32,17 +32,10 @@ void CBC_QRCoderBitVector::Init() {
m_array = FX_Alloc(uint8_t, m_size);
}
CBC_QRCoderBitVector::~CBC_QRCoderBitVector() {
- if (m_array != NULL) {
- FX_Free(m_array);
- }
- m_size = 0;
- m_sizeInBits = 0;
+ FX_Free(m_array);
}
void CBC_QRCoderBitVector::Clear() {
- if (m_array != NULL) {
- FX_Free(m_array);
- m_array = NULL;
- }
+ FX_Free(m_array);
m_sizeInBits = 0;
m_size = 32;
m_array = FX_Alloc(uint8_t, m_size);
@@ -122,9 +115,7 @@ void CBC_QRCoderBitVector::AppendByte(int32_t value) {
if ((m_sizeInBits >> 3) == m_size) {
uint8_t* newArray = FX_Alloc(uint8_t, m_size << 1);
FXSYS_memcpy(newArray, m_array, m_size);
- if (m_array != NULL) {
- FX_Free(m_array);
- }
+ FX_Free(m_array);
m_array = newArray;
m_size = m_size << 1;
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
index b3ed5d4d9b..b9accd6097 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
@@ -30,14 +30,8 @@ CBC_QRCoderBlockPair::CBC_QRCoderBlockPair(
m_errorCorrectionBytes = errorCorrection;
}
CBC_QRCoderBlockPair::~CBC_QRCoderBlockPair() {
- if (m_dataBytes != NULL) {
- delete m_dataBytes;
- m_dataBytes = NULL;
- }
- if (m_errorCorrectionBytes != NULL) {
- delete m_errorCorrectionBytes;
- m_errorCorrectionBytes = NULL;
- }
+ delete m_dataBytes;
+ delete m_errorCorrectionBytes;
}
CBC_CommonByteArray* CBC_QRCoderBlockPair::GetDataBytes() {
return m_dataBytes;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp
index fcef73acbf..ebaa40fd12 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp
@@ -39,10 +39,7 @@ void CBC_QRCoderDecoder::Init() {
m_rsDecoder = new CBC_ReedSolomonDecoder(CBC_ReedSolomonGF256::QRCodeFild);
}
CBC_QRCoderDecoder::~CBC_QRCoderDecoder() {
- if (m_rsDecoder != NULL) {
- delete m_rsDecoder;
- }
- m_rsDecoder = NULL;
+ delete m_rsDecoder;
}
CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image,
int32_t width,
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp
index 1bb5a295a0..97c6c2a091 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp
@@ -67,9 +67,8 @@ CBC_QRCoderFormatInformation::DecodeFormatInformation(
int32_t maskedFormatInfo) {
CBC_QRCoderFormatInformation* formatInfo =
DoDecodeFormatInformation(maskedFormatInfo);
- if (formatInfo != NULL) {
+ if (formatInfo)
return formatInfo;
- }
return DoDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR);
}
CBC_QRCoderFormatInformation*
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp
index 7ec3df2b08..337d21a9e9 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp
@@ -42,7 +42,7 @@ CBC_QRCoderMode::CBC_QRCoderMode(int32_t* characterCountBitsForVersions,
int32_t bits,
CFX_ByteString name) {
m_characterCountBitsForVersions = characterCountBitsForVersions;
- if (m_characterCountBitsForVersions != NULL) {
+ if (m_characterCountBitsForVersions) {
m_characterCountBitsForVersions[0] = x1;
m_characterCountBitsForVersions[1] = x2;
m_characterCountBitsForVersions[2] = x3;
@@ -51,9 +51,7 @@ CBC_QRCoderMode::CBC_QRCoderMode(int32_t* characterCountBitsForVersions,
m_bits = bits;
}
CBC_QRCoderMode::~CBC_QRCoderMode() {
- if (m_characterCountBitsForVersions != NULL) {
- FX_Free(m_characterCountBitsForVersions);
- }
+ FX_Free(m_characterCountBitsForVersions);
}
void CBC_QRCoderMode::Initialize() {
sBYTE = new CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 16, 16, 0x4, "BYTE");
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp
index 1e36dc1614..75ad077521 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp
@@ -30,10 +30,7 @@ CBC_QRDataBlock::CBC_QRDataBlock(int32_t numDataCodewords,
CFX_ByteArray* codewords)
: m_numDataCodewords(numDataCodewords), m_codewords(codewords) {}
CBC_QRDataBlock::~CBC_QRDataBlock() {
- if (m_codewords != NULL) {
- delete m_codewords;
- m_codewords = NULL;
- }
+ delete m_codewords;
}
int32_t CBC_QRDataBlock::GetNumDataCodewords() {
return m_numDataCodewords;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp
index b6a6f7e10b..1fd8742690 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp
@@ -115,7 +115,7 @@ CBC_CommonBitMatrix* CBC_QRDetector::SampleGrid(
FX_FLOAT bottomRightY;
FX_FLOAT sourceBottomRightX;
FX_FLOAT sourceBottomRightY;
- if (alignmentPattern != NULL) {
+ if (alignmentPattern) {
bottomRightX = alignmentPattern->GetX();
bottomRightY = alignmentPattern->GetY();
sourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0f;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp
index fad100816f..df83d35be7 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp
@@ -33,11 +33,7 @@ CBC_QRDetectorResult::~CBC_QRDetectorResult() {
}
m_points->RemoveAll();
delete m_points;
- m_points = NULL;
- if (m_bits != NULL) {
- delete m_bits;
- }
- m_bits = NULL;
+ delete m_bits;
}
CBC_CommonBitMatrix* CBC_QRDetectorResult::GetBits() {
return m_bits;