summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.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_ReedSolomonGF256Poly.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_ReedSolomonGF256Poly.cpp')
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index 748646bcad..e37d62e112 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -42,7 +42,8 @@ void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field,
int32_t& e) {
if (!coefficients || coefficients->GetSize() == 0) {
e = BCExceptionCoefficientsSizeIsNull;
- BC_EXCEPTION_CHECK_ReturnVoid(e);
+ if (e != BCExceptionNO)
+ return;
}
m_field = field;
int32_t coefficientsLength = coefficients->GetSize();
@@ -98,7 +99,8 @@ 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, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
return temp;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
@@ -132,7 +134,8 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &sumDiff, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
return temp;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
@@ -159,7 +162,8 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &product, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
return temp;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar,
@@ -177,7 +181,8 @@ 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, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
return temp;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
@@ -199,7 +204,8 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &product, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
return temp;
}
@@ -212,13 +218,16 @@ CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
}
std::unique_ptr<CBC_ReedSolomonGF256Poly> quotient(
m_field->GetZero()->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
std::unique_ptr<CBC_ReedSolomonGF256Poly> remainder(Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
int32_t inverseDenominatorLeadingTeam =
m_field->Inverse(denominatorLeadingTerm, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
while (remainder->GetDegree() >= other->GetDegree() && !remainder->IsZero()) {
int32_t degreeDifference = remainder->GetDegree() - other->GetDegree();
int32_t scale =
@@ -226,14 +235,18 @@ CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
inverseDenominatorLeadingTeam);
std::unique_ptr<CBC_ReedSolomonGF256Poly> term(
other->MultiplyByMonomial(degreeDifference, scale, e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
std::unique_ptr<CBC_ReedSolomonGF256Poly> iteratorQuotient(
m_field->BuildMonomial(degreeDifference, scale, e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
quotient.reset(quotient->AddOrSubtract(iteratorQuotient.get(), e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
remainder.reset(remainder->AddOrSubtract(term.get(), e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
}
CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* tempPtrA =
new CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>();