summaryrefslogtreecommitdiff
path: root/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-01 17:33:49 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-01 17:33:49 +0000
commit673af68584b6ada36682c33acddfea2bcd749030 (patch)
tree3b75d42726768d9f7476802eb5415d7cb809281f /fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
parent48ce3d08faa51bf00edaa3ae0afda9bf86e14a39 (diff)
downloadpdfium-673af68584b6ada36682c33acddfea2bcd749030.tar.xz
Remove some "exceptions" from reedsolomon code.
Change-Id: If8c45af624ed6df7b6d7416bb4e195f4097b0574 Reviewed-on: https://pdfium-review.googlesource.com/43191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp')
-rw-r--r--fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index ef83691d4f..0c56c6e60b 100644
--- a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -210,22 +210,22 @@ std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256Poly::Divide(
if (!remainder)
return nullptr;
- int e = BCExceptionNO;
int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
- int32_t inverseDenominatorLeadingTeam =
- m_field->Inverse(denominatorLeadingTerm, e);
- if (e != BCExceptionNO)
+ Optional<int32_t> inverseDenominatorLeadingTeam =
+ m_field->Inverse(denominatorLeadingTerm);
+ if (!inverseDenominatorLeadingTeam.has_value())
return nullptr;
+
while (remainder->GetDegree() >= other->GetDegree() && !remainder->IsZero()) {
int32_t degreeDifference = remainder->GetDegree() - other->GetDegree();
int32_t scale =
m_field->Multiply(remainder->GetCoefficients((remainder->GetDegree())),
- inverseDenominatorLeadingTeam);
+ inverseDenominatorLeadingTeam.value());
auto term = other->MultiplyByMonomial(degreeDifference, scale);
if (!term)
return nullptr;
- auto iteratorQuotient = m_field->BuildMonomial(degreeDifference, scale, e);
- if (e != BCExceptionNO)
+ auto iteratorQuotient = m_field->BuildMonomial(degreeDifference, scale);
+ if (!iteratorQuotient)
return nullptr;
quotient = quotient->AddOrSubtract(iteratorQuotient.get());
if (!quotient)