From 6dc1d7753691c0ff2f390e8ffd95a3182064487e Mon Sep 17 00:00:00 2001 From: thestig Date: Thu, 9 Jun 2016 18:39:33 -0700 Subject: Get rid of NULLs in xfa/fxbarcode/ Review-Url: https://codereview.chromium.org/2048983002 --- xfa/fxbarcode/BC_BinaryBitmap.cpp | 12 +-- xfa/fxbarcode/BC_TwoDimWriter.cpp | 2 +- xfa/fxbarcode/common/BC_CommonBitMatrix.cpp | 6 +- xfa/fxbarcode/common/BC_CommonByteArray.cpp | 4 +- xfa/fxbarcode/common/BC_CommonByteMatrix.cpp | 2 +- xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp | 4 +- xfa/fxbarcode/common/BC_CommonDecoderResult.cpp | 4 +- xfa/fxbarcode/common/BC_CommonECI.cpp | 8 +- .../common/BC_GlobalHistogramBinarizer.cpp | 4 +- xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp | 2 +- .../common/reedsolomon/BC_ReedSolomon.cpp | 4 +- .../common/reedsolomon/BC_ReedSolomonDecoder.cpp | 8 +- .../common/reedsolomon/BC_ReedSolomonGF256.cpp | 10 +- .../common/reedsolomon/BC_ReedSolomonGF256Poly.cpp | 18 ++-- .../datamatrix/BC_DataMatrixBitMatrixParser.cpp | 12 +-- .../datamatrix/BC_DataMatrixDataBlock.cpp | 2 +- xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp | 2 +- xfa/fxbarcode/datamatrix/BC_DataMatrixReader.cpp | 2 +- xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp | 22 ++-- xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp | 8 +- xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp | 2 +- xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp | 114 ++++++++++----------- xfa/fxbarcode/datamatrix/BC_SymbolInfo.h | 10 +- xfa/fxbarcode/oned/BC_OneDimReader.cpp | 12 +-- xfa/fxbarcode/oned/BC_OneDimWriter.cpp | 27 ++--- xfa/fxbarcode/oned/BC_OneDimWriter.h | 2 +- xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp | 4 +- xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 6 +- xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp | 8 +- xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp | 6 +- xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp | 4 +- xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp | 18 ++-- xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp | 16 +-- xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp | 18 ++-- xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp | 2 +- xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp | 16 +-- xfa/fxbarcode/pdf417/BC_PDF417.cpp | 12 +-- xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp | 31 +++--- .../pdf417/BC_PDF417DecodedBitStreamParser.cpp | 10 +- xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp | 24 ++--- .../pdf417/BC_PDF417DetectionResultColumn.cpp | 4 +- .../BC_PDF417DetectionResultRowIndicatorColumn.cpp | 42 ++++---- xfa/fxbarcode/pdf417/BC_PDF417Detector.cpp | 10 +- .../pdf417/BC_PDF417ECErrorCorrection.cpp | 20 ++-- xfa/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp | 10 +- xfa/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp | 32 +++--- xfa/fxbarcode/pdf417/BC_PDF417Reader.cpp | 3 +- xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp | 111 ++++++++++---------- xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp | 2 +- .../qrcode/BC_QRAlignmentPatternFinder.cpp | 6 +- xfa/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp | 34 +++--- xfa/fxbarcode/qrcode/BC_QRCodeReader.cpp | 2 +- xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp | 10 +- xfa/fxbarcode/qrcode/BC_QRCoder.cpp | 6 +- xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp | 18 ++-- xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 12 +-- .../qrcode/BC_QRCoderErrorCorrectionLevel.cpp | 18 ++-- xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp | 32 +++--- xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp | 52 +++++----- xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp | 28 ++--- xfa/fxbarcode/qrcode/BC_QRDataBlock.cpp | 2 +- .../qrcode/BC_QRDecodedBitStreamParser.cpp | 36 +++---- xfa/fxbarcode/qrcode/BC_QRDetector.cpp | 12 +-- xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp | 11 +- xfa/fxbarcode/qrcode/BC_QRGridSampler.cpp | 2 +- 65 files changed, 491 insertions(+), 502 deletions(-) diff --git a/xfa/fxbarcode/BC_BinaryBitmap.cpp b/xfa/fxbarcode/BC_BinaryBitmap.cpp index ba08824efe..d8e866236b 100644 --- a/xfa/fxbarcode/BC_BinaryBitmap.cpp +++ b/xfa/fxbarcode/BC_BinaryBitmap.cpp @@ -28,7 +28,7 @@ #include "xfa/fxbarcode/utils.h" CBC_BinaryBitmap::CBC_BinaryBitmap(CBC_Binarizer* binarizer) - : m_binarizer(binarizer), m_matrix(NULL) {} + : m_binarizer(binarizer), m_matrix(nullptr) {} CBC_BinaryBitmap::~CBC_BinaryBitmap() { delete m_matrix; } @@ -39,9 +39,9 @@ int32_t CBC_BinaryBitmap::GetWidth() { return m_binarizer->GetLuminanceSource()->GetWidth(); } CBC_CommonBitMatrix* CBC_BinaryBitmap::GetMatrix(int32_t& e) { - if (m_matrix == NULL) { + if (!m_matrix) { m_matrix = m_binarizer->GetBlackMatrix(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } return m_matrix; } @@ -49,13 +49,13 @@ CBC_CommonBitArray* CBC_BinaryBitmap::GetBlackRow(int32_t y, CBC_CommonBitArray* row, int32_t& e) { CBC_CommonBitArray* temp = m_binarizer->GetBlackRow(y, row, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } CBC_CommonBitMatrix* CBC_BinaryBitmap::GetBlackMatrix(int32_t& e) { - if (m_matrix == NULL) { + if (!m_matrix) { m_matrix = m_binarizer->GetBlackMatrix(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } return m_matrix; } diff --git a/xfa/fxbarcode/BC_TwoDimWriter.cpp b/xfa/fxbarcode/BC_TwoDimWriter.cpp index c2fb37e091..fdad7e2a81 100644 --- a/xfa/fxbarcode/BC_TwoDimWriter.cpp +++ b/xfa/fxbarcode/BC_TwoDimWriter.cpp @@ -15,7 +15,7 @@ CBC_TwoDimWriter::CBC_TwoDimWriter() { m_iCorrectLevel = 1; m_bFixedSize = TRUE; - m_output = NULL; + m_output = nullptr; } CBC_TwoDimWriter::~CBC_TwoDimWriter() { delete m_output; diff --git a/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp b/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp index 4fff7b1a84..e52f3dca04 100644 --- a/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp +++ b/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp @@ -28,7 +28,7 @@ CBC_CommonBitMatrix::CBC_CommonBitMatrix() { m_width = 0; m_height = 0; m_rowSize = 0; - m_bits = NULL; + m_bits = nullptr; } void CBC_CommonBitMatrix::Init(int32_t dimension) { m_width = dimension; @@ -103,8 +103,8 @@ void CBC_CommonBitMatrix::SetRegion(int32_t left, } CBC_CommonBitArray* CBC_CommonBitMatrix::GetRow(int32_t y, CBC_CommonBitArray* row) { - CBC_CommonBitArray* rowArray = NULL; - if (row == NULL || row->GetSize() < m_width) { + CBC_CommonBitArray* rowArray = nullptr; + if (!row || row->GetSize() < m_width) { rowArray = new CBC_CommonBitArray(m_width); } else { rowArray = new CBC_CommonBitArray(row); diff --git a/xfa/fxbarcode/common/BC_CommonByteArray.cpp b/xfa/fxbarcode/common/BC_CommonByteArray.cpp index 1fd6e46420..be48d51b5b 100644 --- a/xfa/fxbarcode/common/BC_CommonByteArray.cpp +++ b/xfa/fxbarcode/common/BC_CommonByteArray.cpp @@ -25,7 +25,7 @@ #include "xfa/fxbarcode/common/BC_CommonByteArray.h" CBC_CommonByteArray::CBC_CommonByteArray() { - m_bytes = NULL; + m_bytes = nullptr; m_size = 0; m_index = 0; } @@ -65,7 +65,7 @@ void CBC_CommonByteArray::AppendByte(int32_t value) { m_index++; } void CBC_CommonByteArray::Reserve(int32_t capacity) { - if (m_bytes == NULL || m_size < capacity) { + if (!m_bytes || m_size < capacity) { uint8_t* newArray = FX_Alloc(uint8_t, capacity); if (m_bytes) { FXSYS_memcpy(newArray, m_bytes, m_size); diff --git a/xfa/fxbarcode/common/BC_CommonByteMatrix.cpp b/xfa/fxbarcode/common/BC_CommonByteMatrix.cpp index 05028bd395..234b384d7a 100644 --- a/xfa/fxbarcode/common/BC_CommonByteMatrix.cpp +++ b/xfa/fxbarcode/common/BC_CommonByteMatrix.cpp @@ -26,7 +26,7 @@ CBC_CommonByteMatrix::CBC_CommonByteMatrix(int32_t width, int32_t height) { m_height = height; m_width = width; - m_bytes = NULL; + m_bytes = nullptr; } void CBC_CommonByteMatrix::Init() { m_bytes = FX_Alloc2D(uint8_t, m_height, m_width); diff --git a/xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp b/xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp index d6fa9e472e..ebc5593bf2 100644 --- a/xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp +++ b/xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp @@ -36,9 +36,9 @@ void CBC_CommonCharacterSetECI::AddCharacterSet(int32_t value, CFX_ByteString encodingName) {} CBC_CommonCharacterSetECI* CBC_CommonCharacterSetECI::GetCharacterSetECIByValue( int32_t value) { - return NULL; + return nullptr; } CBC_CommonCharacterSetECI* CBC_CommonCharacterSetECI::GetCharacterSetECIByName( const CFX_ByteString& name) { - return NULL; + return nullptr; } diff --git a/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp b/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp index 45aff1cae1..ee131e5359 100644 --- a/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp +++ b/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp @@ -40,7 +40,7 @@ void CBC_CommonDecoderResult::Init(const CFX_ByteArray& rawBytes, m_text = text; m_byteSegments.Copy(byteSegments); m_ecLevel = ecLevel; - m_other = NULL; + m_other = nullptr; } void CBC_CommonDecoderResult::Init(const CFX_ByteArray& rawBytes, const CFX_ByteString& text, @@ -53,7 +53,7 @@ void CBC_CommonDecoderResult::Init(const CFX_ByteArray& rawBytes, m_rawBytes.Copy(rawBytes); m_text = text; m_pdf417ecLevel = ecLevel; - m_other = NULL; + m_other = nullptr; } void CBC_CommonDecoderResult::setOther(CBC_PDF417ResultMetadata* other) { m_other = other; diff --git a/xfa/fxbarcode/common/BC_CommonECI.cpp b/xfa/fxbarcode/common/BC_CommonECI.cpp index 4e37aec566..30d21310f4 100644 --- a/xfa/fxbarcode/common/BC_CommonECI.cpp +++ b/xfa/fxbarcode/common/BC_CommonECI.cpp @@ -32,11 +32,7 @@ int32_t CBC_CommonECI::GetValue() { return m_value; } CBC_CommonECI* CBC_CommonECI::GetEICByValue(int32_t value, int32_t& e) { - if (value < 0 || value > 999999) { + if (value < 0 || value > 999999) e = BCExceptionBadECI; - return NULL; - } - if (value < 900) { - } - return NULL; + return nullptr; } diff --git a/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp b/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp index d4a33229cf..53f18cc21b 100644 --- a/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp +++ b/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp @@ -87,7 +87,7 @@ CBC_CommonBitMatrix* CBC_GlobalHistogramBinarizer::GetBlackMatrix(int32_t& e) { for (y = 1; y < 5; y++) { int32_t row = height * y / 5; CFX_ByteArray* localLuminances = source->GetRow(row, m_luminance, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t right = (width << 2) / 5; int32_t x; for (x = width / 5; x < right; x++) { @@ -96,7 +96,7 @@ CBC_CommonBitMatrix* CBC_GlobalHistogramBinarizer::GetBlackMatrix(int32_t& e) { } } int32_t blackPoint = EstimateBlackPoint(localBuckets, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); std::unique_ptr localLuminances(source->GetMatrix()); for (y = 0; y < height; y++) { int32_t offset = y * width; diff --git a/xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp b/xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp index f64abb61c0..45ffd63858 100644 --- a/xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp +++ b/xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp @@ -197,7 +197,7 @@ CBC_ResultPoint* CBC_WhiteRectangleDetector::GetBlackPointOnSegment( return new CBC_ResultPoint((FX_FLOAT)x, (FX_FLOAT)y); } } - return NULL; + return nullptr; } int32_t CBC_WhiteRectangleDetector::DistanceL2(FX_FLOAT aX, FX_FLOAT aY, diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp index 40e5fa6625..352dc3dab1 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp @@ -44,10 +44,10 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(int32_t degree, temp.Add(m_field->Exp(d - 1)); CBC_ReedSolomonGF256Poly temp_poly; temp_poly.Init(m_field, &temp, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_ReedSolomonGF256Poly* nextGenerator = lastGenerator->Multiply(&temp_poly, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); m_cachedGenerators.Add(nextGenerator); lastGenerator = nextGenerator; } diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp index f31a54747f..8788afbda8 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp @@ -181,13 +181,13 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorLocations( for (int32_t i = 1; i < 256 && ie < numErrors; i++) { if (errorLocator->EvaluateAt(i) == 0) { (*result)[ie] = m_field->Inverse(i, ie); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); ie++; } } if (ie != numErrors) { e = BCExceptionDegreeNotMatchRoots; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } return result.release(); } @@ -202,7 +202,7 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes( std::unique_ptr result(tempArray); for (int32_t i = 0; i < s; i++) { int32_t xiInverse = m_field->Inverse(errorLocations->operator[](i), e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t denominator = 1; for (int32_t j = 0; j < s; j++) { if (i != j) { @@ -213,7 +213,7 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes( } } int32_t temp = m_field->Inverse(denominator, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); (*result)[i] = m_field->Multiply(errorEvaluator->EvaluateAt(xiInverse), temp); } diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp index 33771418d4..da0ad3ff05 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp @@ -23,8 +23,8 @@ #include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h" #include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h" -CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeFild = NULL; -CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = NULL; +CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeFild = nullptr; +CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = nullptr; void CBC_ReedSolomonGF256::Initialize() { QRCodeFild = new CBC_ReedSolomonGF256(0x011D); QRCodeFild->Init(); @@ -73,11 +73,11 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial( int32_t& e) { if (degree < 0) { e = BCExceptionDegreeIsNegative; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } if (coefficient == 0) { CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } CFX_Int32Array coefficients; @@ -85,7 +85,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial( coefficients[0] = coefficient; CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); temp->Init(this, &coefficients, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) { diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp index aec4a1ca22..0e376ce1a8 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp @@ -28,19 +28,19 @@ CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, int32_t coefficients) { - if (field == NULL) { + if (!field) return; - } + m_field = field; m_coefficients.Add(coefficients); } CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly() { - m_field = NULL; + m_field = nullptr; } void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field, CFX_Int32Array* coefficients, int32_t& e) { - if (coefficients == NULL || coefficients->GetSize() == 0) { + if (!coefficients || coefficients->GetSize() == 0) { e = BCExceptionCoefficientsSizeIsNull; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -98,7 +98,7 @@ int32_t CBC_ReedSolomonGF256Poly::EvaluateAt(int32_t a) { CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Clone(int32_t& e) { CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); temp->Init(m_field, &m_coefficients, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract( @@ -132,7 +132,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract( } CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); temp->Init(m_field, &sumDiff, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply( @@ -159,7 +159,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply( } CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); temp->Init(m_field, &product, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar, @@ -177,7 +177,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar, } CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); temp->Init(m_field, &product, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial( @@ -199,7 +199,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial( } CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); temp->Init(m_field, &product, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp index a0c00e9506..10d5a843e2 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp @@ -29,9 +29,9 @@ #include "xfa/fxbarcode/utils.h" CBC_DataMatrixBitMatrixParser::CBC_DataMatrixBitMatrixParser() { - m_mappingBitMatrix = NULL; - m_version = NULL; - m_readMappingMatrix = NULL; + m_mappingBitMatrix = nullptr; + m_version = nullptr; + m_readMappingMatrix = nullptr; } void CBC_DataMatrixBitMatrixParser::Init(CBC_CommonBitMatrix* bitMatrix, int32_t& e) { @@ -62,7 +62,7 @@ CBC_DataMatrixVersion* CBC_DataMatrixBitMatrixParser::ReadVersion( int32_t columns = bitMatrix->GetWidth(); CBC_DataMatrixVersion* temp = CBC_DataMatrixVersion::GetVersionForDimensions(rows, columns, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } CFX_ByteArray* CBC_DataMatrixBitMatrixParser::ReadCodewords(int32_t& e) { @@ -132,7 +132,7 @@ CFX_ByteArray* CBC_DataMatrixBitMatrixParser::ReadCodewords(int32_t& e) { } while ((row < numRows) || (column < numColumns)); if (resultOffset != m_version->GetTotalCodewords()) { e = BCExceptionFormatException; - return NULL; + return nullptr; } return result.release(); } @@ -340,7 +340,7 @@ CBC_CommonBitMatrix* CBC_DataMatrixBitMatrixParser::ExtractDataRegion( int32_t symbolSizeColumns = m_version->GetSymbolSizeColumns(); if (bitMatrix->GetHeight() != symbolSizeRows) { e = BCExceptionCanNotCallGetDimensionOnNonSquareMatrix; - return NULL; + return nullptr; } int32_t dataRegionSizeRows = m_version->GetDataRegionSizeRows(); int32_t dataRegionSizeColumns = m_version->GetDataRegionSizeColumns(); diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp index a41e46afc9..9371dc42e8 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp @@ -90,7 +90,7 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, } if (rawCodewordsOffset != rawCodewords->GetSize()) { e = BCExceptionIllegalArgument; - return NULL; + return nullptr; } return result.release(); } diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp index ffa0a4d9d1..5bfd51b09a 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp @@ -33,7 +33,7 @@ #include "xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h" CBC_DataMatrixDecoder::CBC_DataMatrixDecoder() { - m_rsDecoder = NULL; + m_rsDecoder = nullptr; } void CBC_DataMatrixDecoder::Init() { m_rsDecoder = diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixReader.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixReader.cpp index 9a22d4db3a..31d95b0cb7 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixReader.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixReader.cpp @@ -33,7 +33,7 @@ #include "xfa/fxbarcode/utils.h" CBC_DataMatrixReader::CBC_DataMatrixReader() { - m_decoder = NULL; + m_decoder = nullptr; } void CBC_DataMatrixReader::Init() { m_decoder = new CBC_DataMatrixDecoder; diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp index 03cd5fba50..f056ece258 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp @@ -55,29 +55,29 @@ uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents, int32_t& e) { if (outWidth < 0 || outHeight < 0) { e = BCExceptionHeightAndWidthMustBeAtLeast1; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } CBC_SymbolShapeHint::SymbolShapeHint shape = CBC_SymbolShapeHint::FORCE_SQUARE; - CBC_Dimension* minSize = NULL; - CBC_Dimension* maxSize = NULL; + CBC_Dimension* minSize = nullptr; + CBC_Dimension* maxSize = nullptr; CFX_WideString ecLevel; CFX_WideString encoded = CBC_HighLevelEncoder::encodeHighLevel( contents, ecLevel, shape, minSize, maxSize, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_SymbolInfo* symbolInfo = CBC_SymbolInfo::lookup( encoded.GetLength(), shape, minSize, maxSize, TRUE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CFX_WideString codewords = CBC_ErrorCorrection::encodeECC200(encoded, symbolInfo, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_DefaultPlacement* placement = new CBC_DefaultPlacement(codewords, symbolInfo->getSymbolDataWidth(e), symbolInfo->getSymbolDataHeight(e)); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); placement->place(); CBC_CommonByteMatrix* bytematrix = encodeLowLevel(placement, symbolInfo, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); outWidth = bytematrix->GetWidth(); outHeight = bytematrix->GetHeight(); uint8_t* result = FX_Alloc2D(uint8_t, outWidth, outHeight); @@ -91,12 +91,12 @@ CBC_CommonByteMatrix* CBC_DataMatrixWriter::encodeLowLevel( CBC_SymbolInfo* symbolInfo, int32_t& e) { int32_t symbolWidth = symbolInfo->getSymbolDataWidth(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t symbolHeight = symbolInfo->getSymbolDataHeight(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_CommonByteMatrix* matrix = new CBC_CommonByteMatrix( symbolInfo->getSymbolWidth(e), symbolInfo->getSymbolHeight(e)); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); matrix->Init(); int32_t matrixY = 0; for (int32_t y = 0; y < symbolHeight; y++) { diff --git a/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp b/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp index c99dcb7d7a..6e395837d4 100644 --- a/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp +++ b/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp @@ -46,10 +46,10 @@ CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString msg, m_shape = FORCE_NONE; m_newEncoding = -1; m_pos = 0; - m_symbolInfo = NULL; + m_symbolInfo = nullptr; m_skipAtEnd = 0; - m_maxSize = NULL; - m_minSize = NULL; + m_maxSize = nullptr; + m_minSize = nullptr; } CBC_EncoderContext::~CBC_EncoderContext() {} void CBC_EncoderContext::setSymbolShape(SymbolShapeHint shape) { @@ -97,7 +97,7 @@ void CBC_EncoderContext::updateSymbolInfo(int32_t& e) { updateSymbolInfo(getCodewordCount(), e); } void CBC_EncoderContext::updateSymbolInfo(int32_t len, int32_t& e) { - if (m_symbolInfo == NULL || len > m_symbolInfo->m_dataCapacity) { + if (!m_symbolInfo || len > m_symbolInfo->m_dataCapacity) { m_symbolInfo = CBC_SymbolInfo::lookup(len, m_shape, m_minSize, m_maxSize, true, e); BC_EXCEPTION_CHECK_ReturnVoid(e); diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp index 5388244351..7fcc039721 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp @@ -69,7 +69,7 @@ CFX_ByteArray& CBC_HighLevelEncoder::getBytesForMessage(CFX_WideString msg) { CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, int32_t& e) { - return encodeHighLevel(msg, ecLevel, FORCE_NONE, NULL, NULL, e); + return encodeHighLevel(msg, ecLevel, FORCE_NONE, nullptr, nullptr, e); } CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, diff --git a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp index d3d68541c4..b6323041f9 100644 --- a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp +++ b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp @@ -20,67 +20,66 @@ * limitations under the License. */ +#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h" + #include "xfa/fxbarcode/BC_Dimension.h" #include "xfa/fxbarcode/common/BC_CommonBitMatrix.h" #include "xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h" #include "xfa/fxbarcode/datamatrix/BC_Encoder.h" -#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h" #include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h" -#define SYMBOLS_COUNT 30 +namespace { + +const size_t kSymbolsCount = 30; + +CBC_SymbolInfo* g_symbols[kSymbolsCount] = { + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; + +} // namespace -CBC_SymbolInfo* CBC_SymbolInfo::m_PROD_SYMBOLS[30] = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -CBC_SymbolInfo* CBC_SymbolInfo::m_symbols[30] = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; void CBC_SymbolInfo::Initialize() { - m_PROD_SYMBOLS[0] = new CBC_SymbolInfo(FALSE, 3, 5, 8, 8, 1); - m_PROD_SYMBOLS[1] = new CBC_SymbolInfo(FALSE, 5, 7, 10, 10, 1); - m_PROD_SYMBOLS[2] = new CBC_SymbolInfo(TRUE, 5, 7, 16, 6, 1); - m_PROD_SYMBOLS[3] = new CBC_SymbolInfo(FALSE, 8, 10, 12, 12, 1); - m_PROD_SYMBOLS[4] = new CBC_SymbolInfo(TRUE, 10, 11, 14, 6, 2); - m_PROD_SYMBOLS[5] = new CBC_SymbolInfo(FALSE, 12, 12, 14, 14, 1); - m_PROD_SYMBOLS[6] = new CBC_SymbolInfo(TRUE, 16, 14, 24, 10, 1); - m_PROD_SYMBOLS[7] = new CBC_SymbolInfo(FALSE, 18, 14, 16, 16, 1); - m_PROD_SYMBOLS[8] = new CBC_SymbolInfo(FALSE, 22, 18, 18, 18, 1); - m_PROD_SYMBOLS[9] = new CBC_SymbolInfo(TRUE, 22, 18, 16, 10, 2); - m_PROD_SYMBOLS[10] = new CBC_SymbolInfo(FALSE, 30, 20, 20, 20, 1); - m_PROD_SYMBOLS[11] = new CBC_SymbolInfo(TRUE, 32, 24, 16, 14, 2); - m_PROD_SYMBOLS[12] = new CBC_SymbolInfo(FALSE, 36, 24, 22, 22, 1); - m_PROD_SYMBOLS[13] = new CBC_SymbolInfo(FALSE, 44, 28, 24, 24, 1); - m_PROD_SYMBOLS[14] = new CBC_SymbolInfo(TRUE, 49, 28, 22, 14, 2); - m_PROD_SYMBOLS[15] = new CBC_SymbolInfo(FALSE, 62, 36, 14, 14, 4); - m_PROD_SYMBOLS[16] = new CBC_SymbolInfo(FALSE, 86, 42, 16, 16, 4); - m_PROD_SYMBOLS[17] = new CBC_SymbolInfo(FALSE, 114, 48, 18, 18, 4); - m_PROD_SYMBOLS[18] = new CBC_SymbolInfo(FALSE, 144, 56, 20, 20, 4); - m_PROD_SYMBOLS[19] = new CBC_SymbolInfo(FALSE, 174, 68, 22, 22, 4); - m_PROD_SYMBOLS[20] = new CBC_SymbolInfo(FALSE, 204, 84, 24, 24, 4, 102, 42); - m_PROD_SYMBOLS[21] = new CBC_SymbolInfo(FALSE, 280, 112, 14, 14, 16, 140, 56); - m_PROD_SYMBOLS[22] = new CBC_SymbolInfo(FALSE, 368, 144, 16, 16, 16, 92, 36); - m_PROD_SYMBOLS[23] = new CBC_SymbolInfo(FALSE, 456, 192, 18, 18, 16, 114, 48); - m_PROD_SYMBOLS[24] = new CBC_SymbolInfo(FALSE, 576, 224, 20, 20, 16, 144, 56); - m_PROD_SYMBOLS[25] = new CBC_SymbolInfo(FALSE, 696, 272, 22, 22, 16, 174, 68); - m_PROD_SYMBOLS[26] = new CBC_SymbolInfo(FALSE, 816, 336, 24, 24, 16, 136, 56); - m_PROD_SYMBOLS[27] = - new CBC_SymbolInfo(FALSE, 1050, 408, 18, 18, 36, 175, 68); - m_PROD_SYMBOLS[28] = - new CBC_SymbolInfo(FALSE, 1304, 496, 20, 20, 36, 163, 62); - m_PROD_SYMBOLS[29] = new CBC_DataMatrixSymbolInfo144(); - for (int32_t i = 0; i < SYMBOLS_COUNT; i++) { - m_symbols[i] = m_PROD_SYMBOLS[i]; - } + g_symbols[0] = new CBC_SymbolInfo(FALSE, 3, 5, 8, 8, 1); + g_symbols[1] = new CBC_SymbolInfo(FALSE, 5, 7, 10, 10, 1); + g_symbols[2] = new CBC_SymbolInfo(TRUE, 5, 7, 16, 6, 1); + g_symbols[3] = new CBC_SymbolInfo(FALSE, 8, 10, 12, 12, 1); + g_symbols[4] = new CBC_SymbolInfo(TRUE, 10, 11, 14, 6, 2); + g_symbols[5] = new CBC_SymbolInfo(FALSE, 12, 12, 14, 14, 1); + g_symbols[6] = new CBC_SymbolInfo(TRUE, 16, 14, 24, 10, 1); + g_symbols[7] = new CBC_SymbolInfo(FALSE, 18, 14, 16, 16, 1); + g_symbols[8] = new CBC_SymbolInfo(FALSE, 22, 18, 18, 18, 1); + g_symbols[9] = new CBC_SymbolInfo(TRUE, 22, 18, 16, 10, 2); + g_symbols[10] = new CBC_SymbolInfo(FALSE, 30, 20, 20, 20, 1); + g_symbols[11] = new CBC_SymbolInfo(TRUE, 32, 24, 16, 14, 2); + g_symbols[12] = new CBC_SymbolInfo(FALSE, 36, 24, 22, 22, 1); + g_symbols[13] = new CBC_SymbolInfo(FALSE, 44, 28, 24, 24, 1); + g_symbols[14] = new CBC_SymbolInfo(TRUE, 49, 28, 22, 14, 2); + g_symbols[15] = new CBC_SymbolInfo(FALSE, 62, 36, 14, 14, 4); + g_symbols[16] = new CBC_SymbolInfo(FALSE, 86, 42, 16, 16, 4); + g_symbols[17] = new CBC_SymbolInfo(FALSE, 114, 48, 18, 18, 4); + g_symbols[18] = new CBC_SymbolInfo(FALSE, 144, 56, 20, 20, 4); + g_symbols[19] = new CBC_SymbolInfo(FALSE, 174, 68, 22, 22, 4); + g_symbols[20] = new CBC_SymbolInfo(FALSE, 204, 84, 24, 24, 4, 102, 42); + g_symbols[21] = new CBC_SymbolInfo(FALSE, 280, 112, 14, 14, 16, 140, 56); + g_symbols[22] = new CBC_SymbolInfo(FALSE, 368, 144, 16, 16, 16, 92, 36); + g_symbols[23] = new CBC_SymbolInfo(FALSE, 456, 192, 18, 18, 16, 114, 48); + g_symbols[24] = new CBC_SymbolInfo(FALSE, 576, 224, 20, 20, 16, 144, 56); + g_symbols[25] = new CBC_SymbolInfo(FALSE, 696, 272, 22, 22, 16, 174, 68); + g_symbols[26] = new CBC_SymbolInfo(FALSE, 816, 336, 24, 24, 16, 136, 56); + g_symbols[27] = new CBC_SymbolInfo(FALSE, 1050, 408, 18, 18, 36, 175, 68); + g_symbols[28] = new CBC_SymbolInfo(FALSE, 1304, 496, 20, 20, 36, 163, 62); + g_symbols[29] = new CBC_DataMatrixSymbolInfo144(); } + void CBC_SymbolInfo::Finalize() { - for (int32_t i = 0; i < SYMBOLS_COUNT; i++) { - delete m_PROD_SYMBOLS[i]; - m_PROD_SYMBOLS[i] = NULL; - m_symbols[i] = NULL; + for (size_t i = 0; i < kSymbolsCount; i++) { + delete g_symbols[i]; + g_symbols[i] = nullptr; } } + CBC_SymbolInfo::CBC_SymbolInfo(FX_BOOL rectangular, int32_t dataCapacity, int32_t errorCodewords, @@ -134,7 +133,7 @@ CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, SymbolShapeHint shape, FX_BOOL fail, int32_t& e) { - return lookup(dataCodewords, shape, NULL, NULL, fail, e); + return lookup(dataCodewords, shape, nullptr, nullptr, fail, e); } CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, SymbolShapeHint shape, @@ -142,8 +141,8 @@ CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, CBC_Dimension* maxSize, FX_BOOL fail, int32_t& e) { - for (int32_t i = 0; i < SYMBOLS_COUNT; i++) { - CBC_SymbolInfo* symbol = m_symbols[i]; + for (size_t i = 0; i < kSymbolsCount; i++) { + CBC_SymbolInfo* symbol = g_symbols[i]; if (shape == FORCE_SQUARE && symbol->m_rectangular) { continue; } @@ -152,24 +151,23 @@ CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, } if (minSize && (symbol->getSymbolWidth(e) < minSize->getWidth() || symbol->getSymbolHeight(e) < minSize->getHeight())) { - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); continue; } if (maxSize && (symbol->getSymbolWidth(e) > maxSize->getWidth() || symbol->getSymbolHeight(e) > maxSize->getHeight())) { - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); continue; } if (dataCodewords <= symbol->m_dataCapacity) { return symbol; } } - if (fail) { + if (fail) e = BCExceptionIllegalDataCodewords; - return NULL; - } - return NULL; + return nullptr; } + int32_t CBC_SymbolInfo::getHorizontalDataRegions(int32_t& e) { switch (m_dataRegions) { case 1: diff --git a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h index 7885c8da74..64270dd9ac 100644 --- a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h +++ b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h @@ -54,19 +54,12 @@ class CBC_SymbolInfo : public CBC_SymbolShapeHint { int32_t getDataLengthForInterleavedBlock(int32_t index); int32_t getErrorLengthForInterleavedBlock(int32_t index); - public: int32_t m_dataCapacity; int32_t m_errorCodewords; int32_t m_matrixWidth; int32_t m_matrixHeight; int32_t m_rsBlockData; int32_t m_rsBlockError; - static CBC_SymbolInfo* m_PROD_SYMBOLS[30]; - - private: - static CBC_SymbolInfo* m_symbols[30]; - FX_BOOL m_rectangular; - int32_t m_dataRegions; private: CBC_SymbolInfo(FX_BOOL rectangular, @@ -77,6 +70,9 @@ class CBC_SymbolInfo : public CBC_SymbolShapeHint { int32_t dataRegions, int32_t rsBlockData, int32_t rsBlockError); + + FX_BOOL m_rectangular; + int32_t m_dataRegions; }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_ diff --git a/xfa/fxbarcode/oned/BC_OneDimReader.cpp b/xfa/fxbarcode/oned/BC_OneDimReader.cpp index a1cfc9b492..e413adb6a4 100644 --- a/xfa/fxbarcode/oned/BC_OneDimReader.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimReader.cpp @@ -45,7 +45,7 @@ CBC_OneDimReader::~CBC_OneDimReader() {} CFX_Int32Array* CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray* row, int32_t& e) { FX_BOOL foundStart = FALSE; - CFX_Int32Array* startRange = NULL; + CFX_Int32Array* startRange = nullptr; CFX_Int32Array startEndPattern; startEndPattern.SetSize(3); startEndPattern[0] = START_END_PATTERN[0]; @@ -55,7 +55,7 @@ CFX_Int32Array* CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray* row, while (!foundStart) { delete startRange; startRange = FindGuardPattern(row, nextStart, FALSE, &startEndPattern, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t start = (*startRange)[0]; nextStart = (*startRange)[1]; if (start <= 1) { @@ -64,7 +64,7 @@ CFX_Int32Array* CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray* row, int32_t quietStart = start - (nextStart - start); if (quietStart >= 0) { FX_BOOL booT = row->IsRange(quietStart, start, FALSE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); foundStart = booT; } } @@ -136,7 +136,7 @@ CFX_Int32Array* CBC_OneDimReader::DecodeEnd(CBC_CommonBitArray* row, startEndPattern.Add(START_END_PATTERN[2]); CFX_Int32Array* FindGuard = FindGuardPattern(row, endStart, FALSE, &startEndPattern, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return FindGuard; } CFX_Int32Array* CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray* row, @@ -187,8 +187,8 @@ CFX_Int32Array* CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray* row, } } e = BCExceptionNotFound; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - return NULL; + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + return nullptr; } int32_t CBC_OneDimReader::DecodeDigit(CBC_CommonBitArray* row, CFX_Int32Array* counters, diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp index 8580650223..7330ae65b7 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp @@ -33,14 +33,14 @@ CBC_OneDimWriter::CBC_OneDimWriter() { m_bPrintChecksum = TRUE; m_iDataLenth = 0; m_bCalcChecksum = FALSE; - m_pFont = NULL; + m_pFont = nullptr; m_fFontSize = 10; m_iFontStyle = 0; m_fontColor = 0xff000000; m_iContentLen = 0; m_bLeftPadding = FALSE; m_bRightPadding = FALSE; - m_output = NULL; + m_output = nullptr; } CBC_OneDimWriter::~CBC_OneDimWriter() { delete m_output; @@ -55,9 +55,9 @@ void CBC_OneDimWriter::SetCalcChecksum(int32_t state) { m_bCalcChecksum = state; } FX_BOOL CBC_OneDimWriter::SetFont(CFX_Font* cFont) { - if (cFont == NULL) { + if (!cFont) return FALSE; - } + m_pFont = cFont; return TRUE; } @@ -82,14 +82,14 @@ uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t hints, int32_t& e) { - uint8_t* ret = NULL; + uint8_t* ret = nullptr; outHeight = 1; if (m_Width >= 20) { ret = Encode(contents, outWidth, e); } else { ret = Encode(contents, outWidth, e); } - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, @@ -98,7 +98,7 @@ uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, @@ -296,9 +296,9 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, const CFX_WideStringC& contents, int32_t& e) { - if (m_output == NULL) { + if (!m_output) BC_EXCEPTION_CHECK_ReturnVoid(e); - } + pOutBitmap = CreateDIBitmap(m_output->GetWidth(), m_output->GetHeight()); pOutBitmap->Clear(m_backgroundColor); if (!pOutBitmap) { @@ -318,7 +318,8 @@ void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, break; } if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) { - ShowChars(contents, pOutBitmap, NULL, NULL, m_barWidth, m_multiple, e); + ShowChars(contents, pOutBitmap, nullptr, nullptr, m_barWidth, m_multiple, + e); BC_EXCEPTION_CHECK_ReturnVoid(e); } CFX_DIBitmap* pStretchBitmap = pOutBitmap->StretchTo(m_Width, m_Height); @@ -330,9 +331,9 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, const CFX_WideStringC& contents, int32_t& e) { - if (m_output == NULL) { + if (!m_output) BC_EXCEPTION_CHECK_ReturnVoid(e); - } + CFX_GraphStateData stateData; CFX_PathData path; path.AppendRect(0, 0, (FX_FLOAT)m_Width, (FX_FLOAT)m_Height); @@ -357,7 +358,7 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, break; } if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) { - ShowChars(contents, NULL, device, matrix, m_barWidth, m_multiple, e); + ShowChars(contents, nullptr, device, matrix, m_barWidth, m_multiple, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } } diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.h b/xfa/fxbarcode/oned/BC_OneDimWriter.h index 15a1a1a6c7..a0a076217a 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.h @@ -34,7 +34,7 @@ class CBC_OneDimWriter : public CBC_Writer { virtual uint8_t* Encode(const CFX_ByteString& contents, int32_t& outLength, int32_t& e) { - return NULL; + return nullptr; } virtual void RenderResult(const CFX_WideStringC& contents, diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp index f3c39f2491..0fa0e9a29b 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp @@ -148,7 +148,7 @@ CFX_Int32Array* CBC_OnedCodaBarReader::FindAsteriskPattern( FX_BOOL btemp3 = row->IsRange(std::max(0, patternStart - (i - patternStart) / 2), patternStart, FALSE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (btemp3) { CFX_Int32Array* result = new CFX_Int32Array(); result->SetSize(2); @@ -172,7 +172,7 @@ CFX_Int32Array* CBC_OnedCodaBarReader::FindAsteriskPattern( } } e = BCExceptionNotFound; - return NULL; + return nullptr; } FX_BOOL CBC_OnedCodaBarReader::ArrayContains(const FX_CHAR array[], FX_CHAR key) { diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 2d9c2e5ad8..59f4d5ea4d 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -137,7 +137,7 @@ uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, @@ -148,11 +148,11 @@ uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_CODABAR) { e = BCExceptionOnlyEncodeCODEBAR; - return NULL; + return nullptr; } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp index a0479e7f6d..b868327a37 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp @@ -105,7 +105,7 @@ CFX_Int32Array* CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray* row, FX_BOOL btemp2 = row->IsRange(std::max(0, patternStart - (i - patternStart) / 2), patternStart, FALSE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (btemp2) { CFX_Int32Array* result = new CFX_Int32Array; result->SetSize(3); @@ -130,7 +130,7 @@ CFX_Int32Array* CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray* row, } } e = BCExceptionNotFound; - return NULL; + return nullptr; } int32_t CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray* row, CFX_Int32Array* counters, @@ -176,7 +176,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber, if (startPatternInfo) { startPatternInfo->RemoveAll(); delete startPatternInfo; - startPatternInfo = NULL; + startPatternInfo = nullptr; } e = BCExceptionFormatException; return ""; @@ -189,7 +189,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber, if (startPatternInfo) { startPatternInfo->RemoveAll(); delete startPatternInfo; - startPatternInfo = NULL; + startPatternInfo = nullptr; } CFX_Int32Array counters; counters.SetSize(6); diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp index bc9b14f04e..d5754230b5 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -107,11 +107,11 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_CODE_128) { e = BCExceptionOnlyEncodeCODE_128; - return NULL; + return nullptr; } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, @@ -120,7 +120,7 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } FX_BOOL CBC_OnedCode128Writer::IsDigits(const CFX_ByteString& contents, diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp b/xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp index 0eb4c990b4..331af7e887 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp @@ -141,7 +141,7 @@ CFX_Int32Array* CBC_OnedCode39Reader::FindAsteriskPattern( FX_BOOL bT1 = row->IsRange(std::max(0, patternStart - (i - patternStart) / 2), patternStart, FALSE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (bT1) { CFX_Int32Array* result = new CFX_Int32Array; result->SetSize(2); @@ -165,7 +165,7 @@ CFX_Int32Array* CBC_OnedCode39Reader::FindAsteriskPattern( } } e = BCExceptionNotFound; - return NULL; + return nullptr; } int32_t CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array* counters) { int32_t numCounters = counters->GetSize(); diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp index efebfe547d..58d9472e25 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -214,7 +214,7 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, @@ -225,11 +225,11 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_CODE_39) { e = BCExceptionOnlyEncodeCODE_39; - return NULL; + return nullptr; } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } void CBC_OnedCode39Writer::ToIntArray(int32_t a, int32_t* toReturn) { @@ -271,7 +271,7 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t& e) { FX_CHAR checksum = CalcCheckSum(contents, e); if (checksum == '*') { - return NULL; + return nullptr; } int32_t widths[9] = {0}; int32_t wideStrideNum = 3; @@ -300,13 +300,13 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t pos = AppendPattern(result, 0, widths, 9, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } int32_t narrowWhite[] = {1}; pos += AppendPattern(result, pos, narrowWhite, 1, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } for (int32_t l = m_iContentLen - 1; l >= 0; l--) { for (int32_t i = 0; i < len; i++) { @@ -315,21 +315,21 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, pos += AppendPattern(result, pos, widths, 9, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } } pos += AppendPattern(result, pos, narrowWhite, 1, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } ToIntArray(CBC_OnedCode39Reader::CHARACTER_ENCODINGS[39], widths); pos += AppendPattern(result, pos, widths, 9, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } for (int32_t i = 0; i < codeWidth / 2; i++) { result[i] ^= result[codeWidth - 1 - i]; diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 20b52774e8..933d009a73 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -82,7 +82,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, @@ -96,7 +96,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, @@ -104,7 +104,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (contents.GetLength() != 13) { e = BCExceptionDigitLengthShould13; - return NULL; + return nullptr; } m_iDataLenth = 13; int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1).c_str()); @@ -116,7 +116,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } int32_t i = 0; for (i = 1; i <= 6; i++) { @@ -128,13 +128,13 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, 4, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } pos += AppendPattern(result, pos, CBC_OneDimReader::MIDDLE_PATTERN, 5, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } for (i = 7; i <= 12; i++) { int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); @@ -142,14 +142,14 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } return result; } diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index 2aa57d18d1..f4a4dc86e1 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -92,7 +92,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, @@ -103,11 +103,11 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_EAN_8) { e = BCExceptionOnlyEncodeEAN_8; - return NULL; + return nullptr; } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, @@ -115,7 +115,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (contents.GetLength() != 8) { e = BCExceptionDigitLengthMustBe8; - return NULL; + return nullptr; } outLength = m_codeWidth; uint8_t* result = FX_Alloc(uint8_t, m_codeWidth); @@ -124,7 +124,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } int32_t i = 0; for (i = 0; i <= 3; i++) { @@ -133,13 +133,13 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } pos += AppendPattern(result, pos, CBC_OneDimReader::MIDDLE_PATTERN, 5, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } for (i = 4; i <= 7; i++) { int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); @@ -147,14 +147,14 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } return result; } diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp index eb197b916c..b8b7c9426a 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp @@ -29,7 +29,7 @@ #include "xfa/fxbarcode/utils.h" CBC_OnedUPCAReader::CBC_OnedUPCAReader() { - m_ean13Reader = NULL; + m_ean13Reader = nullptr; } void CBC_OnedUPCAReader::Init() { m_ean13Reader = new CBC_OnedEAN13Reader; diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index f7900d4195..19cb7ec6de 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -26,7 +26,7 @@ #include "xfa/fxbarcode/oned/BC_OnedUPCAWriter.h" CBC_OnedUPCAWriter::CBC_OnedUPCAWriter() { - m_subWriter = NULL; + m_subWriter = nullptr; m_bLeftPadding = TRUE; m_bRightPadding = TRUE; } @@ -84,7 +84,7 @@ uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, @@ -95,13 +95,13 @@ uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_UPC_A) { e = BCExceptionOnlyEncodeUPC_A; - return NULL; + return nullptr; } CFX_ByteString toEAN13String = '0' + contents; m_iDataLenth = 13; uint8_t* ret = m_subWriter->Encode(toEAN13String, BCFORMAT_EAN_13, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } @@ -171,9 +171,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, re = rect3.GetOutterRect(); device->FillRect(&re, m_backgroundColor); } - if (pOutBitmap == NULL) { + if (!pOutBitmap) strWidth = strWidth * m_outputHScale; - } + 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; @@ -225,9 +225,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, tempStr = str.Mid(0, 1); iLen = tempStr.GetLength(); strWidth = (FX_FLOAT)multiple * 7; - if (pOutBitmap == NULL) { + if (!pOutBitmap) strWidth = strWidth * m_outputHScale; - } + CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank); if (pOutBitmap) { delete ge.GetBitmap(); 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* 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* modulusPoly = new CFX_ArrayTemplate(); 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* 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* 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(); diff --git a/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp b/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp index 75565ca641..efc1014188 100644 --- a/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp @@ -105,8 +105,8 @@ CBC_QRAlignmentPattern* CBC_QRAlignmentPatternFinder::Find(int32_t& e) { return m_possibleCenters[0]->Clone(); } e = BCExceptionRead; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - return NULL; + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + return nullptr; } FX_FLOAT CBC_QRAlignmentPatternFinder::CenterFromEnd( const CFX_Int32Array& stateCount, @@ -195,5 +195,5 @@ CBC_QRAlignmentPattern* CBC_QRAlignmentPatternFinder::HandlePossibleCenter( m_possibleCenters.Add( new CBC_QRAlignmentPattern(centerJ, centerI, estimatedModuleSize)); } - return NULL; + return nullptr; } diff --git a/xfa/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp b/xfa/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp index 3fe6783d38..81d27538bf 100644 --- a/xfa/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp @@ -40,8 +40,8 @@ void CBC_QRBitMatrixParser::Init(CBC_CommonBitMatrix* bitMatrix, int32_t& e) { BC_EXCEPTION_CHECK_ReturnVoid(e); } m_bitMatrix = m_tempBitMatrix; - m_parsedFormatInfo = NULL; - m_version = NULL; + m_parsedFormatInfo = nullptr; + m_version = nullptr; } CBC_QRBitMatrixParser::~CBC_QRBitMatrixParser() { delete m_parsedFormatInfo; @@ -68,7 +68,7 @@ CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation( return m_parsedFormatInfo; } int32_t dimension = m_bitMatrix->GetDimension(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); formatInfoBits = 0; int32_t iMin = dimension - 8; for (j = dimension - 1; j >= iMin; j--) { @@ -83,20 +83,20 @@ CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation( return m_parsedFormatInfo; } e = BCExceptionRead; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - return NULL; + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + return nullptr; } CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(int32_t& e) { if (m_version) { return m_version; } int32_t dimension = m_bitMatrix->GetDimension(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t provisionVersion = (dimension - 17) >> 2; if (provisionVersion <= 6) { CBC_QRCoderVersion* qrv = CBC_QRCoderVersion::GetVersionForNumber(provisionVersion, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return qrv; } int32_t versionBits = 0; @@ -107,7 +107,7 @@ CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(int32_t& e) { } } m_version = CBC_QRCoderVersion::DecodeVersionInformation(versionBits, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (m_version && m_version->GetDimensionForVersion() == dimension) { return m_version; } @@ -119,13 +119,13 @@ CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(int32_t& e) { } } m_version = CBC_QRCoderVersion::DecodeVersionInformation(versionBits, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (m_version && m_version->GetDimensionForVersion() == dimension) { return m_version; } e = BCExceptionRead; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - return NULL; + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + return nullptr; } int32_t CBC_QRBitMatrixParser::CopyBit(int32_t i, int32_t j, @@ -134,18 +134,18 @@ int32_t CBC_QRBitMatrixParser::CopyBit(int32_t i, } CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(int32_t& e) { CBC_QRCoderFormatInformation* formatInfo = ReadFormatInformation(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL) CBC_QRCoderVersion* version = + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr) CBC_QRCoderVersion* version = ReadVersion(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_QRDataMask* dataMask = CBC_QRDataMask::ForReference((int32_t)(formatInfo->GetDataMask()), e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t dimension = m_bitMatrix->GetDimension(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); dataMask->UnmaskBitMatrix(m_bitMatrix, dimension); std::unique_ptr functionPattern( version->BuildFunctionPattern(e)); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); FX_BOOL readingUp = TRUE; std::unique_ptr result(new CFX_ByteArray); result->SetSize(version->GetTotalCodeWords()); @@ -177,7 +177,7 @@ CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(int32_t& e) { } if (resultOffset != version->GetTotalCodeWords()) { e = BCExceptionRead; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } return result.release(); } diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeReader.cpp b/xfa/fxbarcode/qrcode/BC_QRCodeReader.cpp index fc87785d5c..0f9c44f0c5 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCodeReader.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCodeReader.cpp @@ -41,7 +41,7 @@ #include "xfa/fxbarcode/qrcode/BC_QRDetector.h" #include "xfa/fxbarcode/qrcode/BC_QRDetectorResult.h" -CBC_QRCodeReader::CBC_QRCodeReader() : m_decoder(NULL) {} +CBC_QRCodeReader::CBC_QRCodeReader() : m_decoder(nullptr) {} void CBC_QRCodeReader::Init() { m_decoder = new CBC_QRCoderDecoder; m_decoder->Init(); diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp index cd4340e38c..8e1d6edb70 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp @@ -57,7 +57,7 @@ uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, int32_t& outWidth, int32_t& outHeight, int32_t& e) { - CBC_QRCoderErrorCorrectionLevel* ec = NULL; + CBC_QRCoderErrorCorrectionLevel* ec = nullptr; switch (ecLevel) { case 0: ec = CBC_QRCoderErrorCorrectionLevel::L; @@ -73,7 +73,7 @@ uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, break; default: { e = BCExceptionUnSupportEclevel; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } } CBC_QRCoder qr; @@ -83,7 +83,7 @@ uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, } else { CBC_QRCoderEncoder::Encode(contents, ec, &qr, e); } - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); outWidth = qr.GetMatrixWidth(); outHeight = qr.GetMatrixWidth(); uint8_t* result = FX_Alloc2D(uint8_t, outWidth, outHeight); @@ -96,12 +96,12 @@ uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t hints, int32_t& e) { - return NULL; + return nullptr; } uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, int32_t& e) { - return NULL; + return nullptr; } diff --git a/xfa/fxbarcode/qrcode/BC_QRCoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoder.cpp index 9e9ad06817..580ea7ded1 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoder.cpp @@ -27,8 +27,8 @@ #include "xfa/fxbarcode/utils.h" CBC_QRCoder::CBC_QRCoder() { - m_mode = NULL; - m_ecLevel = NULL; + m_mode = nullptr; + m_ecLevel = nullptr; m_version = -1; m_matrixWidth = -1; m_maskPattern = -1; @@ -36,7 +36,7 @@ CBC_QRCoder::CBC_QRCoder() { m_numDataBytes = -1; m_numECBytes = -1; m_numRSBlocks = -1; - m_matrix = NULL; + m_matrix = nullptr; } CBC_QRCoder::~CBC_QRCoder() { delete m_matrix; diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp index 360a69a0ec..97219ddd72 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderDecoder.cpp @@ -35,7 +35,7 @@ #include "xfa/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h" CBC_QRCoderDecoder::CBC_QRCoderDecoder() { - m_rsDecoder = NULL; + m_rsDecoder = nullptr; } void CBC_QRCoderDecoder::Init() { @@ -58,7 +58,7 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, } } CBC_CommonDecoderResult* cdr = Decode(&bits, height, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return cdr; } CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, @@ -66,17 +66,17 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, int32_t& e) { CBC_QRBitMatrixParser parser; parser.Init(bits, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_QRCoderVersion* version = parser.ReadVersion(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_QRCoderFormatInformation* temp = parser.ReadFormatInformation(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_QRCoderErrorCorrectionLevel* ecLevel = temp->GetErrorCorrectionLevel(); std::unique_ptr codewords(parser.ReadCodewords(e)); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CFX_ArrayTemplate* dataBlocks = CBC_QRDataBlock::GetDataBlocks(codewords.get(), version, ecLevel, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t totalBytes = 0; for (int32_t i = 0; i < dataBlocks->GetSize(); i++) { totalBytes += (*dataBlocks)[i]->GetNumDataCodewords(); @@ -92,7 +92,7 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, delete (*dataBlocks)[k]; } delete dataBlocks; - return NULL; + return nullptr; } for (int32_t i = 0; i < numDataCodewords; i++) { resultBytes.Add((*codewordBytes)[i]); @@ -104,7 +104,7 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, delete dataBlocks; CBC_CommonDecoderResult* cdr = CBC_QRDecodedBitStreamParser::Decode( &resultBytes, version, ecLevel, byteModeDecode, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return cdr; } void CBC_QRCoderDecoder::CorrectErrors(CFX_ByteArray* codewordBytes, diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index eb7642649d..812b7926ac 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -256,8 +256,8 @@ int32_t CBC_QRCoderEncoder::GetSpanByVersion(CBC_QRCoderMode* modeFirst, void CBC_QRCoderEncoder::MergeString(CFX_ArrayTemplate* result, int32_t versionNum, int32_t& e) { - Make_Pair* first = NULL; - Make_Pair* second = NULL; + Make_Pair* first = nullptr; + Make_Pair* second = nullptr; size_t mergeNum = 0; int32_t i; for (i = 0; ((i < result->GetSize()) && (i + 1 < result->GetSize())); i++) { @@ -358,7 +358,7 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion( dataBits.Init(); SplitString(content, &splitResult); MergeString(&splitResult, versionSpecify, e); - BC_EXCEPTION_CHECK_ReturnVoid(e) CBC_QRCoderMode* tempMode = NULL; + BC_EXCEPTION_CHECK_ReturnVoid(e) CBC_QRCoderMode* tempMode = nullptr; for (int32_t i = 0; i < splitResult.GetSize(); i++) { AppendBytes(splitResult[i]->m_string, splitResult[i]->m_mode, &dataBits, encoding, e); @@ -428,7 +428,7 @@ void CBC_QRCoderEncoder::EncodeWithAutoVersion( SplitString(content, &splitResult); MergeString(&splitResult, 8, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CBC_QRCoderMode* tempMode = NULL; + CBC_QRCoderMode* tempMode = nullptr; for (int32_t i = 0; i < splitResult.GetSize(); i++) { AppendBytes(splitResult[i]->m_string, splitResult[i]->m_mode, &dataBits, encoding, e); @@ -442,7 +442,7 @@ void CBC_QRCoderEncoder::EncodeWithAutoVersion( InitQRCode(numInputBytes, ecLevel, mode, qrCode, e); BC_EXCEPTION_CHECK_ReturnVoid(e) CBC_QRCoderBitVector headerAndDataBits; headerAndDataBits.Init(); - tempMode = NULL; + tempMode = nullptr; int32_t versionNum = qrCode->GetVersion(); sign: AppendDataModeLenghInfo(splitResult, headerAndDataBits, tempMode, qrCode, @@ -934,7 +934,7 @@ CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes( CBC_ReedSolomonEncoder encode(CBC_ReedSolomonGF256::QRCodeFild); encode.Init(); encode.Encode(&toEncode, numEcBytesInBlock, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_CommonByteArray* ecBytes = new CBC_CommonByteArray(numEcBytesInBlock); for (int32_t j = 0; j < numEcBytesInBlock; j++) { ecBytes->Set(j, toEncode[numDataBytes + j]); diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp index a1ce747b40..c6a81fab48 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp @@ -22,10 +22,10 @@ #include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h" -CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::L = NULL; -CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::M = NULL; -CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::Q = NULL; -CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::H = NULL; +CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::L = nullptr; +CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::M = nullptr; +CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::Q = nullptr; +CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::H = nullptr; CBC_QRCoderErrorCorrectionLevel::CBC_QRCoderErrorCorrectionLevel( int32_t ordinal, @@ -69,24 +69,24 @@ CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::ForBits( case 0x03: return Q; default: - return NULL; + return nullptr; } } void CBC_QRCoderErrorCorrectionLevel::Destroy() { if (L) { delete CBC_QRCoderErrorCorrectionLevel::L; - L = NULL; + L = nullptr; } if (M) { delete CBC_QRCoderErrorCorrectionLevel::M; - M = NULL; + M = nullptr; } if (H) { delete CBC_QRCoderErrorCorrectionLevel::H; - H = NULL; + H = nullptr; } if (Q) { delete CBC_QRCoderErrorCorrectionLevel::Q; - Q = NULL; + Q = nullptr; } } diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp index 65cf0365cb..f5df04ee9c 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp @@ -77,7 +77,7 @@ const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_MASK_PATTERN = 0x5412; void CBC_QRCoderMatrixUtil::ClearMatrix(CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -90,7 +90,7 @@ void CBC_QRCoderMatrixUtil::BuildMatrix( int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -108,7 +108,7 @@ void CBC_QRCoderMatrixUtil::BuildMatrix( void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -126,7 +126,7 @@ void CBC_QRCoderMatrixUtil::EmbedTypeInfo( int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -154,7 +154,7 @@ void CBC_QRCoderMatrixUtil::EmbedTypeInfo( void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(int32_t version, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -180,7 +180,7 @@ void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits, int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL || dataBits == NULL) { + if (!matrix || !dataBits) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -243,7 +243,7 @@ void CBC_QRCoderMatrixUtil::MakeTypeInfoBits( int32_t maskPattern, CBC_QRCoderBitVector* bits, int32_t& e) { - if (bits == NULL) { + if (!bits) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -271,7 +271,7 @@ void CBC_QRCoderMatrixUtil::MakeTypeInfoBits( void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(int32_t version, CBC_QRCoderBitVector* bits, int32_t& e) { - if (bits == NULL) { + if (!bits) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -294,7 +294,7 @@ FX_BOOL CBC_QRCoderMatrixUtil::IsValidValue(int32_t value) { } void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -319,7 +319,7 @@ void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner( CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -334,7 +334,7 @@ void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern( int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -351,7 +351,7 @@ void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern( int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -368,7 +368,7 @@ void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern( int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -387,7 +387,7 @@ void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern( int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -404,7 +404,7 @@ void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern( void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators( CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } @@ -437,7 +437,7 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns( int32_t version, CBC_CommonByteMatrix* matrix, int32_t& e) { - if (matrix == NULL) { + if (!matrix) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp index 2abdab55a5..5a05d9f633 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp @@ -24,16 +24,16 @@ #include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h" #include "xfa/fxbarcode/utils.h" -CBC_QRCoderMode* CBC_QRCoderMode::sBYTE = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sNUMERIC = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sALPHANUMERIC = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sKANJI = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sECI = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sGBK = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sTERMINATOR = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_FIRST_POSITION = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_SECOND_POSITION = NULL; -CBC_QRCoderMode* CBC_QRCoderMode::sSTRUCTURED_APPEND = NULL; +CBC_QRCoderMode* CBC_QRCoderMode::sBYTE = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sNUMERIC = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sALPHANUMERIC = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sKANJI = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sECI = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sGBK = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sTERMINATOR = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_FIRST_POSITION = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_SECOND_POSITION = nullptr; +CBC_QRCoderMode* CBC_QRCoderMode::sSTRUCTURED_APPEND = nullptr; CBC_QRCoderMode::CBC_QRCoderMode(int32_t* characterCountBitsForVersions, int32_t x1, @@ -57,7 +57,7 @@ void CBC_QRCoderMode::Initialize() { sBYTE = new CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 16, 16, 0x4, "BYTE"); sALPHANUMERIC = new CBC_QRCoderMode(FX_Alloc(int32_t, 3), 9, 11, 13, 0x2, "ALPHANUMERIC"); - sECI = new CBC_QRCoderMode(NULL, 0, 0, 0, 0x7, "ECI"); + sECI = new CBC_QRCoderMode(nullptr, 0, 0, 0, 0x7, "ECI"); sKANJI = new CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 10, 12, 0x8, "KANJI"); sNUMERIC = new CBC_QRCoderMode(FX_Alloc(int32_t, 3), 10, 12, 14, 0x1, "NUMERIC"); @@ -65,9 +65,9 @@ void CBC_QRCoderMode::Initialize() { sTERMINATOR = new CBC_QRCoderMode(FX_Alloc(int32_t, 3), 0, 0, 0, 0x00, "TERMINATOR"); sFNC1_FIRST_POSITION = - new CBC_QRCoderMode(NULL, 0, 0, 0, 0x05, "FNC1_FIRST_POSITION"); + new CBC_QRCoderMode(nullptr, 0, 0, 0, 0x05, "FNC1_FIRST_POSITION"); sFNC1_SECOND_POSITION = - new CBC_QRCoderMode(NULL, 0, 0, 0, 0x09, "FNC1_SECOND_POSITION"); + new CBC_QRCoderMode(nullptr, 0, 0, 0, 0x09, "FNC1_SECOND_POSITION"); sSTRUCTURED_APPEND = new CBC_QRCoderMode(FX_Alloc(int32_t, 3), 0, 0, 0, 0x03, "STRUCTURED_APPEND"); } @@ -107,10 +107,10 @@ CBC_QRCoderMode* CBC_QRCoderMode::ForBits(int32_t bits, int32_t& e) { return sGBK; default: { e = BCExceptionUnsupportedMode; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } } - return NULL; + return nullptr; } int32_t CBC_QRCoderMode::GetBits() { return m_bits; @@ -120,7 +120,7 @@ CFX_ByteString CBC_QRCoderMode::GetName() { } int32_t CBC_QRCoderMode::GetCharacterCountBits(CBC_QRCoderVersion* version, int32_t& e) { - if (m_characterCountBitsForVersions == NULL) { + if (!m_characterCountBitsForVersions) { e = BCExceptionCharacterNotThisMode; BC_EXCEPTION_CHECK_ReturnValue(e, 0); } @@ -138,42 +138,42 @@ int32_t CBC_QRCoderMode::GetCharacterCountBits(CBC_QRCoderVersion* version, void CBC_QRCoderMode::Destroy() { if (sBYTE) { delete CBC_QRCoderMode::sBYTE; - sBYTE = NULL; + sBYTE = nullptr; } if (sNUMERIC) { delete CBC_QRCoderMode::sNUMERIC; - sNUMERIC = NULL; + sNUMERIC = nullptr; } if (sALPHANUMERIC) { delete CBC_QRCoderMode::sALPHANUMERIC; - sALPHANUMERIC = NULL; + sALPHANUMERIC = nullptr; } if (sKANJI) { delete CBC_QRCoderMode::sKANJI; - sKANJI = NULL; + sKANJI = nullptr; } if (sECI) { delete CBC_QRCoderMode::sECI; - sECI = NULL; + sECI = nullptr; } if (sGBK) { delete CBC_QRCoderMode::sGBK; - sGBK = NULL; + sGBK = nullptr; } if (sTERMINATOR) { delete CBC_QRCoderMode::sTERMINATOR; - sTERMINATOR = NULL; + sTERMINATOR = nullptr; } if (sFNC1_FIRST_POSITION) { delete CBC_QRCoderMode::sFNC1_FIRST_POSITION; - sFNC1_FIRST_POSITION = NULL; + sFNC1_FIRST_POSITION = nullptr; } if (sFNC1_SECOND_POSITION) { delete CBC_QRCoderMode::sFNC1_SECOND_POSITION; - sFNC1_SECOND_POSITION = NULL; + sFNC1_SECOND_POSITION = nullptr; } if (sSTRUCTURED_APPEND) { delete CBC_QRCoderMode::sSTRUCTURED_APPEND; - sSTRUCTURED_APPEND = NULL; + sSTRUCTURED_APPEND = nullptr; } } diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp index 9c3a1cc138..cae0d54c7c 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp @@ -354,10 +354,10 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension( int32_t& e) { if ((dimension % 4) != 1) { e = BCExceptionRead; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } CBC_QRCoderVersion* qcv = GetVersionForNumber((dimension - 17) >> 2, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return qcv; } CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation( @@ -369,7 +369,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation( int32_t targetVersion = VERSION_DECODE_INFO[i]; if (targetVersion == versionBits) { CBC_QRCoderVersion* qcv = GetVersionForNumber(i + 7, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return qcv; } int32_t bitsDifference = CBC_QRCoderFormatInformation::NumBitsDiffering( @@ -381,21 +381,21 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation( } if (bestDifference <= 3) { CBC_QRCoderVersion* qcv = GetVersionForNumber(bestVersion, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return qcv; } - return NULL; + return nullptr; } CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t& e) { int32_t dimension = GetDimensionForVersion(); CBC_CommonBitMatrix* bitMatrix = new CBC_CommonBitMatrix(); bitMatrix->Init(dimension); bitMatrix->SetRegion(0, 0, 9, 9, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); bitMatrix->SetRegion(dimension - 8, 0, 8, 9, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); bitMatrix->SetRegion(0, dimension - 8, 9, 8, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t max = m_alignmentPatternCenters.GetSize(); for (int32_t x = 0; x < max; x++) { int32_t i = m_alignmentPatternCenters[x] - 2; @@ -404,18 +404,18 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t& e) { continue; } bitMatrix->SetRegion(m_alignmentPatternCenters[y] - 2, i, 5, 5, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } } bitMatrix->SetRegion(6, 9, 1, dimension - 17, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); bitMatrix->SetRegion(9, 6, dimension - 17, 1, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (m_versionNumber > 6) { bitMatrix->SetRegion(dimension - 11, 0, 3, 6, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); bitMatrix->SetRegion(0, dimension - 11, 6, 3, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } return bitMatrix; } @@ -754,7 +754,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber( } if (versionNumber < 1 || versionNumber > 40) { e = BCExceptionIllegalArgument; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } return (*VERSION)[versionNumber - 1]; } diff --git a/xfa/fxbarcode/qrcode/BC_QRDataBlock.cpp b/xfa/fxbarcode/qrcode/BC_QRDataBlock.cpp index 31f0b1841d..0be3c8d61e 100644 --- a/xfa/fxbarcode/qrcode/BC_QRDataBlock.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRDataBlock.cpp @@ -48,7 +48,7 @@ CFX_ArrayTemplate* CBC_QRDataBlock::GetDataBlocks( int32_t& e) { if (rawCodewords->GetSize() != version->GetTotalCodeWords()) { e = BCExceptionIllegalArgument; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel); int32_t totalBlocks = 0; diff --git a/xfa/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp b/xfa/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp index 8919c3a9a1..062b326bd7 100644 --- a/xfa/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp @@ -44,21 +44,21 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode( int32_t& e) { CBC_CommonBitSource bits(bytes); CFX_ByteString result; - CBC_CommonCharacterSetECI* currentCharacterSetECI = NULL; + CBC_CommonCharacterSetECI* currentCharacterSetECI = nullptr; FX_BOOL fc1Infact = FALSE; CFX_Int32Array byteSegments; - CBC_QRCoderMode* mode = NULL; + CBC_QRCoderMode* mode = nullptr; do { if (bits.Available() < 4) { mode = CBC_QRCoderMode::sTERMINATOR; } else { int32_t iTemp1 = bits.ReadBits(4, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); mode = CBC_QRCoderMode::ForBits(iTemp1, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - if (mode == NULL) { + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (!mode) { e = BCExceptionUnSupportMode; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } } if (!(mode == CBC_QRCoderMode::sTERMINATOR)) { @@ -67,47 +67,47 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode( fc1Infact = TRUE; } else if (mode == CBC_QRCoderMode::sSTRUCTURED_APPEND) { bits.ReadBits(16, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } else if (mode == CBC_QRCoderMode::sECI) { int32_t value = ParseECIValue(&bits, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); currentCharacterSetECI = CBC_CommonCharacterSetECI::GetCharacterSetECIByValue(value); } else { if (mode == CBC_QRCoderMode::sGBK) { bits.ReadBits(4, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } int32_t numBits = mode->GetCharacterCountBits(version, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t count = bits.ReadBits(numBits, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (mode == CBC_QRCoderMode::sNUMERIC) { DecodeNumericSegment(&bits, result, count, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } else if (mode == CBC_QRCoderMode::sALPHANUMERIC) { DecodeAlphanumericSegment(&bits, result, count, fc1Infact, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } else if (mode == CBC_QRCoderMode::sBYTE) { DecodeByteSegment(&bits, result, count, currentCharacterSetECI, &byteSegments, byteModeDecode, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } else if (mode == CBC_QRCoderMode::sGBK) { DecodeGBKSegment(&bits, result, count, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } else if (mode == CBC_QRCoderMode::sKANJI) { DecodeKanjiSegment(&bits, result, count, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } else { e = BCExceptionUnSupportMode; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } } } } while (!(mode == CBC_QRCoderMode::sTERMINATOR)); CBC_CommonDecoderResult* tempCd = new CBC_CommonDecoderResult(); tempCd->Init(*bytes, result, byteSegments, ecLevel, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return tempCd; } void CBC_QRDecodedBitStreamParser::DecodeGBKSegment(CBC_CommonBitSource* bits, diff --git a/xfa/fxbarcode/qrcode/BC_QRDetector.cpp b/xfa/fxbarcode/qrcode/BC_QRDetector.cpp index 35915cd673..3ed1ea14b8 100644 --- a/xfa/fxbarcode/qrcode/BC_QRDetector.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRDetector.cpp @@ -41,9 +41,9 @@ CBC_QRDetector::~CBC_QRDetector() {} CBC_QRDetectorResult* CBC_QRDetector::Detect(int32_t hints, int32_t& e) { CBC_QRFinderPatternFinder finder(m_image); std::unique_ptr info(finder.Find(hints, e)); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CBC_QRDetectorResult* qdr = ProcessFinderPatternInfo(info.get(), e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return qdr; } CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo( @@ -92,7 +92,7 @@ CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo( CBC_CommonBitMatrix* bits = SampleGrid(m_image, topLeft.get(), topRight.get(), bottomLeft.get(), (CBC_ResultPoint*)(alignmentPattern), dimension, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); CFX_ArrayTemplate* points = new CFX_ArrayTemplate(); @@ -131,7 +131,7 @@ CBC_CommonBitMatrix* CBC_QRDetector::SampleGrid( sourceBottomRightX, sourceBottomRightY, 3.5f, dimMinusThree, topLeft->GetX(), topLeft->GetY(), topRight->GetX(), topRight->GetY(), bottomRightX, bottomRightY, bottomLeft->GetX(), bottomLeft->GetY(), e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return cbm; } int32_t CBC_QRDetector::ComputeDimension(CBC_ResultPoint* topLeft, @@ -263,7 +263,7 @@ CBC_QRAlignmentPattern* CBC_QRDetector::FindAlignmentInRegion( std::min(m_image->GetWidth() - 1, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { e = BCExceptionRead; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } int32_t alignmentAreaTopY = std::max(0, estAlignmentY - allowance); int32_t alignmentAreaBottomY = @@ -273,6 +273,6 @@ CBC_QRAlignmentPattern* CBC_QRDetector::FindAlignmentInRegion( alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize); CBC_QRAlignmentPattern* qap = alignmentFinder.Find(e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return qap; } diff --git a/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp b/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp index dc63131d01..5ceeefac53 100644 --- a/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp @@ -166,7 +166,7 @@ CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(int32_t hint, } std::unique_ptr> patternInfo( SelectBestpatterns(e)); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); OrderBestPatterns(patternInfo.get()); return new CBC_QRFinderPatternInfo(patternInfo.get()); } @@ -400,18 +400,17 @@ int32_t CBC_QRFinderPatternFinder::FindRowSkip() { if (max <= 1) { return 0; } - FinderPattern* firstConfirmedCenter = NULL; + FinderPattern* firstConfirmedCenter = nullptr; for (int32_t i = 0; i < max; i++) { CBC_QRFinderPattern* center = m_possibleCenters[i]; if (center->GetCount() >= CENTER_QUORUM) { - if (firstConfirmedCenter == NULL) { - firstConfirmedCenter = center; - } else { + if (firstConfirmedCenter) { m_hasSkipped = TRUE; return (int32_t)((fabs(firstConfirmedCenter->GetX() - center->GetX()) - fabs(firstConfirmedCenter->GetY() - center->GetY())) / 2); } + firstConfirmedCenter = center; } } return 0; @@ -445,7 +444,7 @@ CBC_QRFinderPatternFinder::SelectBestpatterns(int32_t& e) { int32_t startSize = m_possibleCenters.GetSize(); if (m_possibleCenters.GetSize() < 3) { e = BCExceptionRead; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); } FX_FLOAT average = 0.0f; if (startSize > 3) { diff --git a/xfa/fxbarcode/qrcode/BC_QRGridSampler.cpp b/xfa/fxbarcode/qrcode/BC_QRGridSampler.cpp index 881e74a98c..be7407ceff 100644 --- a/xfa/fxbarcode/qrcode/BC_QRGridSampler.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRGridSampler.cpp @@ -128,7 +128,7 @@ CBC_CommonBitMatrix* CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix* image, } transform->TransformPoints(&points); CheckAndNudgePoints(image, &points, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); for (x = 0; x < max; x += 2) { if (image->Get((int32_t)points[x], (int32_t)points[x + 1])) { bits->Set(x >> 1, y); -- cgit v1.2.3