summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/qrcode
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src/fxbarcode/qrcode')
-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
12 files changed, 27 insertions, 74 deletions
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;