summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.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/common/reedsolomon/BC_ReedSolomon.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/common/reedsolomon/BC_ReedSolomon.cpp')
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
index eac1a1065a..25b4c852c1 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
@@ -44,10 +44,12 @@ 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, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
CBC_ReedSolomonGF256Poly* nextGenerator =
lastGenerator->Multiply(&temp_poly, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
m_cachedGenerators.Add(nextGenerator);
lastGenerator = nextGenerator;
}
@@ -59,15 +61,18 @@ void CBC_ReedSolomonEncoder::Encode(CFX_ArrayTemplate<int32_t>* toEncode,
int32_t& e) {
if (ecBytes == 0) {
e = BCExceptionNoCorrectionBytes;
- BC_EXCEPTION_CHECK_ReturnVoid(e);
+ if (e != BCExceptionNO)
+ return;
}
int32_t dataBytes = toEncode->GetSize() - ecBytes;
if (dataBytes <= 0) {
e = BCExceptionNoDataBytesProvided;
- BC_EXCEPTION_CHECK_ReturnVoid(e);
+ if (e != BCExceptionNO)
+ return;
}
CBC_ReedSolomonGF256Poly* generator = BuildGenerator(ecBytes, e);
- BC_EXCEPTION_CHECK_ReturnVoid(e);
+ if (e != BCExceptionNO)
+ return;
CFX_ArrayTemplate<int32_t> infoCoefficients;
infoCoefficients.SetSize(dataBytes);
for (int32_t x = 0; x < dataBytes; x++) {
@@ -75,13 +80,16 @@ void CBC_ReedSolomonEncoder::Encode(CFX_ArrayTemplate<int32_t>* toEncode,
}
CBC_ReedSolomonGF256Poly info;
info.Init(m_field, &infoCoefficients, e);
- BC_EXCEPTION_CHECK_ReturnVoid(e);
+ if (e != BCExceptionNO)
+ return;
std::unique_ptr<CBC_ReedSolomonGF256Poly> infoTemp(
info.MultiplyByMonomial(ecBytes, 1, e));
- BC_EXCEPTION_CHECK_ReturnVoid(e);
+ if (e != BCExceptionNO)
+ return;
std::unique_ptr<CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>> temp(
infoTemp->Divide(generator, e));
- BC_EXCEPTION_CHECK_ReturnVoid(e);
+ if (e != BCExceptionNO)
+ return;
CBC_ReedSolomonGF256Poly* remainder = (*temp)[1];
CFX_ArrayTemplate<int32_t>* coefficients = remainder->GetCoefficients();
int32_t numZeroCoefficients = ecBytes - coefficients->GetSize();