diff options
Diffstat (limited to 'xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp')
-rw-r--r-- | xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp index b4effb91a5..58516913bc 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp @@ -372,10 +372,12 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension( int32_t& e) { if ((dimension % 4) != 1) { e = BCExceptionRead; - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; } CBC_QRCoderVersion* qcv = GetVersionForNumber((dimension - 17) >> 2, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; return qcv; } CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation( @@ -387,7 +389,8 @@ 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, nullptr); + if (e != BCExceptionNO) + return nullptr; return qcv; } int32_t bitsDifference = NumBitsDiffering(versionBits, targetVersion); @@ -398,7 +401,8 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation( } if (bestDifference <= 3) { CBC_QRCoderVersion* qcv = GetVersionForNumber(bestVersion, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; return qcv; } return nullptr; @@ -408,11 +412,14 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t& e) { CBC_CommonBitMatrix* bitMatrix = new CBC_CommonBitMatrix(); bitMatrix->Init(dimension); bitMatrix->SetRegion(0, 0, 9, 9, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; bitMatrix->SetRegion(dimension - 8, 0, 8, 9, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; bitMatrix->SetRegion(0, dimension - 8, 9, 8, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; int32_t max = m_alignmentPatternCenters.GetSize(); for (int32_t x = 0; x < max; x++) { int32_t i = m_alignmentPatternCenters[x] - 2; @@ -421,18 +428,23 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t& e) { continue; } bitMatrix->SetRegion(m_alignmentPatternCenters[y] - 2, i, 5, 5, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; } } bitMatrix->SetRegion(6, 9, 1, dimension - 17, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; bitMatrix->SetRegion(9, 6, dimension - 17, 1, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; if (m_versionNumber > 6) { bitMatrix->SetRegion(dimension - 11, 0, 3, 6, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; bitMatrix->SetRegion(0, dimension - 11, 6, 3, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; } return bitMatrix; } @@ -771,7 +783,8 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber( } if (versionNumber < 1 || versionNumber > 40) { e = BCExceptionIllegalArgument; - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; } return (*VERSION)[versionNumber - 1]; } |