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 --- .../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 +- 16 files changed, 140 insertions(+), 141 deletions(-) (limited to 'xfa/fxbarcode/qrcode') 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