From 9941055ae6a99974024adf7b326906ab6578d68a Mon Sep 17 00:00:00 2001 From: favoritas37 Date: Tue, 4 Oct 2016 21:08:22 +0300 Subject: [PATCH] minor refactoring to simplify the code on the construction of ArrayRef instances --- src/zxing/zxing/common/reedsolomon/GenericGFPoly.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/zxing/zxing/common/reedsolomon/GenericGFPoly.cpp b/src/zxing/zxing/common/reedsolomon/GenericGFPoly.cpp index 3f4be96..9d5ce06 100644 --- a/src/zxing/zxing/common/reedsolomon/GenericGFPoly.cpp +++ b/src/zxing/zxing/common/reedsolomon/GenericGFPoly.cpp @@ -47,7 +47,7 @@ GenericGFPoly::GenericGFPoly(Ref field, if (firstNonZero == coefficientsLength) { coefficients_ = field->getZero()->getCoefficients(); } else { - coefficients_ = ArrayRef(new Array(coefficientsLength-firstNonZero)); + coefficients_ = ArrayRef(coefficientsLength-firstNonZero); for (int i = 0; i < (int)coefficients_->size(); i++) { coefficients_[i] = coefficients[i + firstNonZero]; } @@ -144,7 +144,7 @@ Ref GenericGFPoly::multiply(Ref other) { ArrayRef bCoefficients = other->getCoefficients(); int bLength = bCoefficients->size(); - ArrayRef product(new Array(aLength + bLength - 1)); + ArrayRef product(aLength + bLength - 1); for (int i = 0; i < aLength; i++) { int aCoeff = aCoefficients[i]; for (int j = 0; j < bLength; j++) { @@ -164,7 +164,7 @@ Ref GenericGFPoly::multiply(int scalar) { return Ref(this); } int size = coefficients_->size(); - ArrayRef product(new Array(size)); + ArrayRef product(size); for (int i = 0; i < size; i++) { product[i] = field_->multiply(coefficients_[i], scalar); } @@ -179,7 +179,7 @@ Ref GenericGFPoly::multiplyByMonomial(int degree, int coefficient return field_->getZero(); } int size = coefficients_->size(); - ArrayRef product(new Array(size+degree)); + ArrayRef product(size+degree); for (int i = 0; i < size; i++) { product[i] = field_->multiply(coefficients_[i], coefficient); }