summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-02-24 18:20:51 -0800
committerLei Zhang <thestig@chromium.org>2016-02-24 18:20:51 -0800
commit2e6864282e65c55ff6809f5aaae011b31c3a361a (patch)
tree98daecaf078529986a4efc2c43a3f43c0dcc01dd /xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
parent969ea09df096b987662b9658e3ffa023ca4ebf70 (diff)
downloadpdfium-2e6864282e65c55ff6809f5aaae011b31c3a361a.tar.xz
Get rid of CBC_AutoPtr and use std::unique_ptr instead.
Also fix IWYU in various fxbarcode headers. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1734823002 .
Diffstat (limited to 'xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp')
-rw-r--r--xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index baafde023a..f138009ffa 100644
--- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -20,9 +20,12 @@
* limitations under the License.
*/
-#include "xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
#include "xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
+#include <memory>
+
+#include "xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+
CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field,
int32_t coefficients) {
if (field == NULL) {
@@ -216,12 +219,11 @@ CFX_PtrArray* CBC_ReedSolomonGF256Poly::Divide(CBC_ReedSolomonGF256Poly* other,
e = BCExceptionDivideByZero;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
- CBC_ReedSolomonGF256Poly* rsg1 = m_field->GetZero()->Clone(e);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> quotient(
+ m_field->GetZero()->Clone(e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_AutoPtr<CBC_ReedSolomonGF256Poly> quotient(rsg1);
- CBC_ReedSolomonGF256Poly* rsg2 = Clone(e);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> remainder(Clone(e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_AutoPtr<CBC_ReedSolomonGF256Poly> remainder(rsg2);
int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
int32_t inverseDenominatorLeadingTeam =
m_field->Inverse(denominatorLeadingTerm, e);
@@ -231,23 +233,16 @@ CFX_PtrArray* CBC_ReedSolomonGF256Poly::Divide(CBC_ReedSolomonGF256Poly* other,
int32_t scale =
m_field->Multiply(remainder->GetCoefficients((remainder->GetDegree())),
inverseDenominatorLeadingTeam);
- CBC_ReedSolomonGF256Poly* rsg3 =
- other->MultiplyByMonomial(degreeDifference, scale, e);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> term(
+ other->MultiplyByMonomial(degreeDifference, scale, e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_AutoPtr<CBC_ReedSolomonGF256Poly> term(rsg3);
- CBC_ReedSolomonGF256Poly* rsg4 =
- m_field->BuildMonomial(degreeDifference, scale, e);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> iteratorQuotient(
+ m_field->BuildMonomial(degreeDifference, scale, e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_AutoPtr<CBC_ReedSolomonGF256Poly> iteratorQuotient(rsg4);
- CBC_ReedSolomonGF256Poly* rsg5 =
- quotient->AddOrSubtract(iteratorQuotient.get(), e);
+ quotient.reset(quotient->AddOrSubtract(iteratorQuotient.get(), e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp(rsg5);
- quotient = temp;
- CBC_ReedSolomonGF256Poly* rsg6 = remainder->AddOrSubtract(term.get(), e);
+ remainder.reset(remainder->AddOrSubtract(term.get(), e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp1(rsg6);
- remainder = temp1;
}
CFX_PtrArray* tempPtrA = new CFX_PtrArray;
tempPtrA->Add(quotient.release());