summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-01-31 13:02:10 -0800
committerChromium commit bot <commit-bot@chromium.org>2017-01-31 22:52:16 +0000
commitc8017b2581b7ade6b05ba086eb7221465414173f (patch)
treef606dadefe9d6e27e7782bd9c33e2498810a7b2f /xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
parent00d4064e5414fc0845e354b50c7f1a8323449268 (diff)
downloadpdfium-c8017b2581b7ade6b05ba086eb7221465414173f.tar.xz
Remove BC_EXCEPTION_CHECK macroschromium/2999
These obfuscate control flow and save very few lines. Mechanical change (mostly), sed + clang-format and adding a few missing semicolons. Change-Id: If8ae06c23edea8c455c79eab589fee5142dc3409 Reviewed-on: https://pdfium-review.googlesource.com/2472 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp')
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp39
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];
}